Skip to content

Commit 319655f

Browse files
authored
Merge branch 'master' into erich/fix-file-permission
2 parents 9378fa1 + e8fd3c6 commit 319655f

File tree

139 files changed

+68867
-10040
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+68867
-10040
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
- [ ] If applicable, the changes made in the PR have proper test coverage
1616
- [ ] For public API changes to cmdlets:
1717
- [ ] a cmdlet design review was approved for the changes in [this repository](https://github.com/Azure/azure-powershell-cmdlet-review-pr) (_Microsoft internal only_)
18+
- {Please put the link here}
1819
- [ ] the markdown help files have been regenerated using the commands listed [here](../blob/master/documentation/development-docs/help-generation.md#updating-all-markdown-files-in-a-module)

src/Accounts/Accounts/Account/ConnectAzureRmAccount.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ public override void ExecuteCmdlet()
404404
subscriptionName,
405405
password,
406406
SkipValidation,
407-
WriteWarning,
407+
WriteWarningEvent, //Could not use WriteWarning directly because it may be in worker thread
408408
name,
409409
shouldPopulateContextList,
410410
MaxContextPopulation));
@@ -419,7 +419,7 @@ public override void ExecuteCmdlet()
419419

420420
try
421421
{
422-
var result = (PSAzureProfile)(task.ConfigureAwait(false).GetAwaiter().GetResult());
422+
var result = (PSAzureProfile)task.Result;
423423
WriteObject(result);
424424
}
425425
catch (AuthenticationFailedException ex)

src/Accounts/Accounts/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020
## Upcoming Release
2121
* Fixed an issue that error happens if user profile path is inaccessible
22+
* Fixed an issue causing Write-Object error during Connect-AzAccount [#13419]
2223
* Added parameter "ContainerRegistryEndpointSuffix" to: `Add-AzEnvironment`, `Set-AzEnvironment`
2324
* Supported interrupting login by hitting <kbd>CTRL</kbd>+<kbd>C</kbd>
2425
* Fixed an issue causing `Connect-AzAccount -KeyVaultAccessToken` not working [#13127]

src/Accounts/Authentication/Factories/AuthenticationFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public IAccessToken Authenticate(
123123
{
124124
while (processAuthenticator != null && processAuthenticator.TryAuthenticate(GetAuthenticationParameters(tokenCacheProvider, account, environment, tenant, password, promptBehavior, promptAction, tokenCache, resourceId), out authToken))
125125
{
126-
token = authToken?.ConfigureAwait(true).GetAwaiter().GetResult();
126+
token = authToken?.ConfigureAwait(false).GetAwaiter().GetResult();
127127
if (token != null)
128128
{
129129
// token.UserId is null when getting tenant token in ADFS environment
@@ -142,7 +142,7 @@ public IAccessToken Authenticate(
142142
{
143143
if (!IsTransientException(e) || retries == 0)
144144
{
145-
throw e;
145+
throw;
146146
}
147147

148148
TracingAdapter.Information(string.Format("[AuthenticationFactory] Exception caught when calling TryAuthenticate, retrying authentication - Exception message: '{0}'", e.Message));

src/Accounts/Authenticators/DeviceCodeAuthenticator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
using Microsoft.Azure.Commands.Common.Authentication;
2323
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
24+
using Microsoft.Azure.Commands.ResourceManager.Common;
2425

2526
namespace Microsoft.Azure.PowerShell.Authenticators
2627
{
@@ -74,7 +75,7 @@ public override bool CanAuthenticate(AuthenticationParameters parameters)
7475
private void WriteWarning(string message)
7576
{
7677
EventHandler<StreamEventArgs> writeWarningEvent;
77-
if (AzureSession.Instance.TryGetComponent("WriteWarning", out writeWarningEvent))
78+
if (AzureSession.Instance.TryGetComponent(AzureRMCmdlet.WriteWarningKey, out writeWarningEvent))
7879
{
7980
writeWarningEvent(this, new StreamEventArgs() { Message = message });
8081
}

src/Accounts/Authenticators/MsalAccessToken.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public static async Task<IAccessToken> GetAccessTokenAsync(
7373
string userId = null,
7474
string homeAccountId = "")
7575
{
76-
var token = await tokenCredential.GetTokenAsync(requestContext, cancellationToken);
76+
var token = await tokenCredential.GetTokenAsync(requestContext, cancellationToken).ConfigureAwait(false);
7777
return new MsalAccessToken(tokenCredential, requestContext, token.Token, token.ExpiresOn, tenantId, userId, homeAccountId);
7878
}
7979

@@ -84,9 +84,9 @@ public static async Task<IAccessToken> GetAccessTokenAsync(
8484
TokenRequestContext requestContext,
8585
CancellationToken cancellationToken)
8686
{
87-
var record = await authTask;
87+
var record = await authTask.ConfigureAwait(false);
8888
cancellationToken.ThrowIfCancellationRequested();
89-
var token = await tokenCredential.GetTokenAsync(requestContext, cancellationToken);
89+
var token = await tokenCredential.GetTokenAsync(requestContext, cancellationToken).ConfigureAwait(false);
9090

9191
return new MsalAccessToken(tokenCredential, requestContext, token.Token, token.ExpiresOn, record.TenantId, record.Username, record.HomeAccountId);
9292
}

src/CosmosDB/CosmosDB/ChangeLog.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@
2121
## Upcoming Release
2222

2323
## Version 0.2.0
24-
Introduced support for throughput Migration, allowing custoers to migrate their resources from manually provisioned throughput to autoscaled throughput. Customers can use this feature using the following cmdlets:
25-
'Invoke-AzCosmosDBSqlContainerThroughputMigration',
26-
'Invoke-AzCosmosDBSqlDatabaseThroughputMigration',
27-
'Invoke-AzCosmosDBMongoDBCollectionThroughputMigration',
28-
'Invoke-AzCosmosDBMongoDBDatabaseThroughputMigration',
29-
'Invoke-AzCosmosDBGremlinGraphThroughputMigration',
30-
'Invoke-AzCosmosDBGremlinDatabaseThroughputMigration',
31-
'Invoke-AzCosmosDBCassandraTableThroughputMigration',
32-
'Invoke-AzCosmosDBCassandraKeyspaceThroughputMigration',
33-
'Invoke-AzCosmosDBTableThroughputMigration'
24+
* Introduced support for throughput Migration, allowing custoers to migrate their resources from manually provisioned throughput to autoscaled throughput. Customers can use this feature using the following cmdlets:
25+
- 'Invoke-AzCosmosDBSqlContainerThroughputMigration',
26+
- 'Invoke-AzCosmosDBSqlDatabaseThroughputMigration',
27+
- 'Invoke-AzCosmosDBMongoDBCollectionThroughputMigration',
28+
- 'Invoke-AzCosmosDBMongoDBDatabaseThroughputMigration',
29+
- 'Invoke-AzCosmosDBGremlinGraphThroughputMigration',
30+
- 'Invoke-AzCosmosDBGremlinDatabaseThroughputMigration',
31+
- 'Invoke-AzCosmosDBCassandraTableThroughputMigration',
32+
- 'Invoke-AzCosmosDBCassandraKeyspaceThroughputMigration',
33+
- 'Invoke-AzCosmosDBTableThroughputMigration'
34+
3435
## Version 0.1.6
3536
* Introduced support for Autoscale, as a result of which all cmdlets which create or modify resources with throughput have an additional parameter called AutoscaleMaxThroughput.
3637
* New-AzCosmosDBAccount cmdlet was updated with new paramters: EnableFreeTier, EnableAnalyticalStorage, ServerVersion, IpRule.

src/NetAppFiles/NetAppFiles.Test/NetAppFiles.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Azure.Management.NetApp" Version="1.6.0" />
14+
<PackageReference Include="Microsoft.Azure.Management.NetApp" Version="1.7.0" />
1515
<PackageReference Include="Microsoft.Azure.Management.Network" Version="20.1.1" />
1616
</ItemGroup>
1717

src/NetAppFiles/NetAppFiles.Test/ScenarioTests/AccountTests.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ function Test-AccountActiveDirectory
2222
$accName1 = Get-ResourceName
2323
$accName2 = Get-ResourceName
2424
$accName3 = Get-ResourceName
25-
$resourceLocation = Get-ProviderLocation "Microsoft.NetApp"
26-
25+
#$resourceLocation = Get-ProviderLocation "Microsoft.NetApp"
26+
$resourceLocation = 'westus2'
27+
2728
$activeDirectory1 = @{
2829
Username = "sdkuser"
2930
<#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="...")]#>
@@ -57,7 +58,7 @@ function Test-AccountActiveDirectory
5758
$newTagValue = "tagValue1"
5859
#$retrievedAcc = New-AzNetAppFilesAccount -ResourceGroupName $resourceGroup -Location $resourceLocation -Name $accName1 -Tag @{$newTagName = $newTagValue} -ActiveDirector $activeDirectories
5960

60-
Assert-ThrowsContains{ New-AzNetAppFilesAccount -ResourceGroupName $resourceGroup -Location $resourceLocation -Name $accName1 -Tag @{$newTagName = $newTagValue} -ActiveDirector $activeDirectories} 'Only one active directory allowed';
61+
Assert-ThrowsContains{ New-AzNetAppFilesAccount -ResourceGroupName $resourceGroup -Location $resourceLocation -Name $accName1 -Tag @{$newTagName = $newTagValue} -ActiveDirectory $activeDirectories} 'Only one active directory allowed';
6162
#Assert-True { $false }
6263
}
6364
catch
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
16+
using Xunit;
17+
18+
namespace Microsoft.Azure.Commands.NetAppFiles.Test.ScenarioTests.ScenarioTest
19+
{
20+
public class ActiveDirectoryTests
21+
{
22+
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;
23+
24+
public ActiveDirectoryTests(Xunit.Abstractions.ITestOutputHelper output)
25+
{
26+
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
27+
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
28+
}
29+
30+
[Fact]
31+
[Trait(Category.AcceptanceType, Category.CheckIn)]
32+
public void TestActiveDirectoryCrud()
33+
{
34+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ActiveDirectoryCrud");
35+
}
36+
37+
[Fact]
38+
[Trait(Category.AcceptanceType, Category.CheckIn)]
39+
public void TestActiveDirectoryPipelines()
40+
{
41+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ActiveDirectoryPipelines");
42+
}
43+
}
44+
}
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
15+
<#
16+
.SYNOPSIS
17+
Test Active Directory cmdLet CRUD operations
18+
#>
19+
function Test-ActiveDirectoryCrud
20+
{
21+
$resourceGroup = Get-ResourceGroupName
22+
$accName1 = Get-ResourceName
23+
$activeDirectoryName1 = Get-ResourceName
24+
$activeDirectoryName2 = Get-ResourceName
25+
$accName2 = Get-ResourceName
26+
#$resourceLocation = Get-ProviderLocation "Microsoft.NetApp"
27+
$resourceLocation = 'westus2'
28+
$adUsername = "sdkuser"
29+
<#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="...")]#>
30+
$adPassword = "sdkpass"
31+
$adDomain = "sdkdomain"
32+
$adDns = "192.0.2.2"
33+
$adSmbServerName = "PSSMBSName"
34+
$adSmbServerName2 = "PSMBSName2"
35+
36+
try
37+
{
38+
# create the resource group
39+
New-AzResourceGroup -Name $resourceGroup -Location $resourceLocation
40+
41+
# try creating an Account -
42+
$newTagName = "tag1"
43+
$newTagValue = "tagValue1"
44+
$retrievedAcc = New-AzNetAppFilesAccount -ResourceGroupName $resourceGroup -Location $resourceLocation -Name $accName1 -Tag @{$newTagName = $newTagValue}
45+
Assert-AreEqual $accName1 $retrievedAcc.Name
46+
$sPass = ConvertTo-SecureString $adPassword -AsPlainText -Force
47+
# create and check ActiveDirectory
48+
$retrievedAd = New-AzNetAppFilesActiveDirectory -ResourceGroupName $resourceGroup -AccountName $accName1 -AdName $activeDirectoryName1 -Username $adUsername -Password $sPass -Domain $adDomain -Dns $adDns -SmbServerName $adSmbServerName
49+
$activeDirectoryId = $retrievedAd.ActiveDirectoryId
50+
Assert-AreEqual $adDomain $retrievedAd.Domain
51+
Assert-AreEqual $adUsername $retrievedAd.Username
52+
Assert-AreEqual $adDns $retrievedAd.Dns
53+
Assert-AreEqual $adSmbServerName $retrievedAd.SmbServerName
54+
55+
# get and check account
56+
$retrievedAcc = Get-AzNetAppFilesAccount -ResourceGroupName $resourceGroup -Name $accName1
57+
Assert-AreEqual $adSmbServerName $retrievedAcc.ActiveDirectories[0].SmbServerName
58+
Assert-AreEqual $adUsername $retrievedAcc.ActiveDirectories[0].Username
59+
60+
# get and check a ActiveDirectory by id and check again
61+
$getRetrievedAd = Get-AzNetAppFilesActiveDirectory -ResourceGroupName $resourceGroup -AccountName $accName1 -ActiveDirectoryId $activeDirectoryId
62+
Assert-AreEqual $activeDirectoryName1 $getRetrievedAd.AdName
63+
Assert-AreEqual $adDomain $getRetrievedAd.Domain
64+
Assert-AreEqual $adUsername $getRetrievedAd.Username
65+
Assert-AreEqual $adDns $getRetrievedAd.Dns
66+
Assert-AreEqual $adSmbServerName $getRetrievedAd.SmbServerName
67+
68+
#update AD
69+
$getUpdateddAd = Update-AzNetAppFilesActiveDirectory -ResourceGroupName $resourceGroup -AccountName $accName1 -ActiveDirectoryId $getRetrievedAd.ActiveDirectoryId -SmbServerName $adSmbServerName2 -Password $sPass
70+
Assert-AreEqual $adSmbServerName2 $getUpdateddAd.SmbServerName
71+
72+
# delete activeDirectory retrieved
73+
# but test the WhatIf first, should not be removed
74+
Remove-AzNetAppFilesActiveDirectory -ResourceGroupName $resourceGroup -AccountName $accName1 -ActiveDirectoryId $getRetrievedAd.ActiveDirectoryId -WhatIf
75+
$retrievedActiveDirectoryList = Get-AzNetAppFilesActiveDirectory -ResourceGroupName $resourceGroup -AccountName $accName1
76+
Assert-AreEqual 1 $retrievedActiveDirectoryList.Length
77+
78+
#remove by name
79+
Remove-AzNetAppFilesActiveDirectory -ResourceGroupName $resourceGroup -AccountName $accName1 -ActiveDirectoryId $getRetrievedAd.ActiveDirectoryId
80+
Start-Sleep -s 15
81+
$retrievedActiveDirectoryList = Get-AzNetAppFilesActiveDirectory -ResourceGroupName $resourceGroup -AccountName $accName1
82+
Assert-AreEqual 0 $retrievedActiveDirectoryList.Length
83+
}
84+
finally
85+
{
86+
# Cleanup
87+
Clean-ResourceGroup $resourceGroup
88+
}
89+
}
90+
91+
<#
92+
.SYNOPSIS
93+
Test activeDirectory Pipeline operations (uses command aliases)
94+
#>
95+
function Test-ActiveDirectoryPipelines
96+
{
97+
$resourceGroup = Get-ResourceGroupName
98+
$accName1 = Get-ResourceName
99+
#$resourceLocation = Get-ProviderLocation "Microsoft.NetApp"
100+
$resourceLocation = 'westus2'
101+
$activeDirectoryName1 = Get-ResourceName
102+
$adUsername = "sdkuser"
103+
<#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="...")]#>
104+
$adPassword = "sdkpass"
105+
$adDomain = "sdkdomain"
106+
$adDns = "192.0.2.2"
107+
$adSmbServerName = "PSSMBSName"
108+
109+
try
110+
{
111+
# create the resource group
112+
New-AzResourceGroup -Name $resourceGroup -Location $resourceLocation
113+
114+
New-AnfAccount -ResourceGroupName $resourceGroup -Location $resourceLocation -Name $accName1
115+
$sPass = ConvertTo-SecureString $adPassword -AsPlainText -Force
116+
#create AD piping in Account
117+
$retrievedAd = Get-AzNetAppFilesAccount -ResourceGroupName $resourceGroup -Name $accName1 | New-AzNetAppFilesActiveDirectory -AdName $activeDirectoryName1 -Username $adUsername -Password $sPass -Domain $adDomain -Dns $adDns -SmbServerName $adSmbServerName
118+
119+
$getRetrievedAd = Get-AzNetAppFilesAccount -ResourceGroupName $resourceGroup -Name $accName1 | Get-AzNetAppFilesActiveDirectory -ActiveDirectoryId $retrievedAd.ActiveDirectoryId
120+
}
121+
finally
122+
{
123+
# Cleanup
124+
Clean-ResourceGroup $resourceGroup
125+
}
126+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
16+
using Xunit;
17+
18+
namespace Microsoft.Azure.Commands.NetAppFiles.Test.ScenarioTests.ScenarioTest
19+
{
20+
public class BackupPolicyTests
21+
{
22+
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;
23+
24+
public BackupPolicyTests(Xunit.Abstractions.ITestOutputHelper output)
25+
{
26+
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
27+
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
28+
}
29+
30+
[Fact]
31+
[Trait(Category.AcceptanceType, Category.CheckIn)]
32+
public void TestBackupPolicyCrud()
33+
{
34+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-BackupPolicyCrud");
35+
}
36+
37+
[Fact]
38+
[Trait(Category.AcceptanceType, Category.CheckIn)]
39+
public void TestBackupPolicyPipelines()
40+
{
41+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-BackupPolicyPipelines");
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)