Skip to content

Commit d0dca3d

Browse files
authored
Merge pull request #11137 from Grayer123/feature/tagApi-2019-10-01
Cmdlet changes for 2019-10-01 Tags API for resources and subscriptions
2 parents 2bbb0bb + 8b1f53d commit d0dca3d

36 files changed

+5426
-102
lines changed

src/Accounts/Accounts/AzureRmAlias/Mappings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2023,7 +2023,8 @@
20232023
"Set-AzADUser": "Set-AzureRmADUser",
20242024
"Remove-AzTag": "Remove-AzureRmTag",
20252025
"Get-AzTag": "Get-AzureRmTag",
2026-
"New-AzTag": "New-AzureRmTag"
2026+
"New-AzTag": "New-AzureRmTag",
2027+
"Update-AzTag": "Update-AzureRmTag"
20272028
},
20282029
"Az.Scheduler": {
20292030
"Disable-AzSchedulerJobCollection": "Disable-AzureRmSchedulerJobCollection",

src/Resources/ResourceManager/ResourceManager.csproj

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

1414
<ItemGroup>
15-
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="3.0.0-preview" />
15+
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="3.3.0-preview" />
1616
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
1717
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.2.0" />
1818
</ItemGroup>

src/Resources/ResourceManager/SdkClient/ResourceManagerSdkClient.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,13 +560,15 @@ private TemplateValidationInfo GetTemplateValidationResult(PSDeploymentCmdletPar
560560

561561
private DeploymentValidateResult ValidateDeployment(PSDeploymentCmdletParameters parameters, Deployment deployment)
562562
{
563+
var scopedDeployment = new ScopedDeployment { Properties = deployment.Properties, Location = deployment.Location };
564+
563565
switch (parameters.ScopeType)
564566
{
565567
case DeploymentScopeType.Tenant:
566-
return ResourceManagementClient.Deployments.ValidateAtTenantScope(parameters.DeploymentName, deployment);
568+
return ResourceManagementClient.Deployments.ValidateAtTenantScope(parameters.DeploymentName, scopedDeployment);
567569

568570
case DeploymentScopeType.ManagementGroup:
569-
return ResourceManagementClient.Deployments.ValidateAtManagementGroupScope(parameters.ManagementGroupId, parameters.DeploymentName, deployment);
571+
return ResourceManagementClient.Deployments.ValidateAtManagementGroupScope(parameters.ManagementGroupId, parameters.DeploymentName, scopedDeployment);
570572

571573
case DeploymentScopeType.ResourceGroup:
572574
return ResourceManagementClient.Deployments.Validate(parameters.ResourceGroupName, parameters.DeploymentName, deployment);
@@ -687,14 +689,16 @@ private bool CheckDeploymentExistence(string subscriptionId, string resourceGrou
687689

688690
private void BeginDeployment(PSDeploymentCmdletParameters parameters, Deployment deployment)
689691
{
692+
var scopedDeployment = new ScopedDeployment { Properties = deployment.Properties, Location = deployment.Location };
693+
690694
switch (parameters.ScopeType)
691695
{
692696
case DeploymentScopeType.Tenant:
693-
ResourceManagementClient.Deployments.BeginCreateOrUpdateAtTenantScope(parameters.DeploymentName, deployment);
697+
ResourceManagementClient.Deployments.BeginCreateOrUpdateAtTenantScope(parameters.DeploymentName, scopedDeployment);
694698
break;
695699

696700
case DeploymentScopeType.ManagementGroup:
697-
ResourceManagementClient.Deployments.BeginCreateOrUpdateAtManagementGroupScope(parameters.ManagementGroupId, parameters.DeploymentName, deployment);
701+
ResourceManagementClient.Deployments.BeginCreateOrUpdateAtManagementGroupScope(parameters.ManagementGroupId, parameters.DeploymentName, scopedDeployment);
698702
break;
699703

700704
case DeploymentScopeType.ResourceGroup:

src/Resources/Resources.Test/Resources.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</ItemGroup>
3232

3333
<ItemGroup>
34-
<PackageReference Update="Microsoft.Azure.Management.ResourceManager" Version="3.0.0-preview" />
34+
<PackageReference Update="Microsoft.Azure.Management.ResourceManager" Version="3.3.0-preview" />
3535
</ItemGroup>
3636

3737
</Project>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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+
using Xunit.Abstractions;
18+
19+
namespace Microsoft.Azure.Commands.Resources.Test.ScenarioTests
20+
{
21+
public class TagTests : ResourceTestRunner
22+
{
23+
public TagTests(ITestOutputHelper output) : base(output)
24+
{
25+
}
26+
27+
[Fact]
28+
[Trait(Category.AcceptanceType, Category.CheckIn)]
29+
public void TagCreateOrUpdateWithResourceIdParamsForSubscription()
30+
{
31+
TestRunner.RunTestScript("Test-TagCreateOrUpdateWithResourceIdParamsForSubscription");
32+
}
33+
34+
[Fact]
35+
[Trait(Category.AcceptanceType, Category.CheckIn)]
36+
public void TagCreateOrUpdateWithResourceIdParamsForResource()
37+
{
38+
TestRunner.RunTestScript("Test-TagCreateOrUpdateWithResourceIdParamsForResource");
39+
}
40+
41+
[Fact]
42+
[Trait(Category.AcceptanceType, Category.CheckIn)]
43+
public void TagUpdateWithResourceIdParamsForSubscription()
44+
{
45+
TestRunner.RunTestScript("Test-TagUpdateWithResourceIdParamsForSubscription");
46+
}
47+
48+
[Fact]
49+
[Trait(Category.AcceptanceType, Category.CheckIn)]
50+
public void TagUpdateWithResourceIdParamsForResource()
51+
{
52+
TestRunner.RunTestScript("Test-TagUpdateWithResourceIdParamsForResource");
53+
}
54+
55+
[Fact]
56+
[Trait(Category.AcceptanceType, Category.CheckIn)]
57+
public void TagGetWithResourceIdParamsForSubscription()
58+
{
59+
TestRunner.RunTestScript("Test-TagGetWithResourceIdParamsForSubscription");
60+
}
61+
62+
[Fact]
63+
[Trait(Category.AcceptanceType, Category.CheckIn)]
64+
public void TagGetWithResourceIdParamsForResource()
65+
{
66+
TestRunner.RunTestScript("Test-TagGetWithResourceIdParamsForResource");
67+
}
68+
69+
[Fact]
70+
[Trait(Category.AcceptanceType, Category.CheckIn)]
71+
public void TagDeleteWithResourceIdParamsForSubscription()
72+
{
73+
TestRunner.RunTestScript("Test-TagDeleteWithResourceIdParamsForSubscription");
74+
}
75+
76+
[Fact]
77+
[Trait(Category.AcceptanceType, Category.CheckIn)]
78+
public void TagDeleteWithResourceIdParamsForResource()
79+
{
80+
TestRunner.RunTestScript("Test-TagDeleteWithResourceIdParamsForResource");
81+
}
82+
}
83+
}

0 commit comments

Comments
 (0)