Skip to content

Commit 6a3567f

Browse files
unknownunknown
authored andcommitted
Merge branch 'ignite' of https://github.com/Azure/azure-powershell-pr into ignite_team
2 parents c6e2c91 + 4313f24 commit 6a3567f

File tree

62 files changed

+9842
-16943
lines changed

Some content is hidden

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

62 files changed

+9842
-16943
lines changed

src/ResourceManager/Batch/Commands.Batch.Test/Commands.Batch.Test.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
<HintPath>..\..\..\packages\Microsoft.Azure.Gallery.2.6.2-preview\lib\net40\Microsoft.Azure.Gallery.dll</HintPath>
6161
</Reference>
6262
<Reference Include="Microsoft.Azure.Management.Authorization">
63-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.1-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
63+
<SpecificVersion>False</SpecificVersion>
64+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6465
</Reference>
6566
<Reference Include="Microsoft.Azure.Management.Batch">
6667
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Batch.1.3.0-preview\lib\net40\Microsoft.Azure.Management.Batch.dll</HintPath>

src/ResourceManager/Batch/Commands.Batch.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<package id="Microsoft.Azure.Common.Authentication" version="1.0.22-preview" targetFramework="net45" />
77
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
88
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
9-
<package id="Microsoft.Azure.Management.Authorization" version="0.18.1-preview" targetFramework="net45" />
9+
<package id="Microsoft.Azure.Management.Authorization" version="0.18.2-preview" targetFramework="net45" />
1010
<package id="Microsoft.Azure.Management.Batch" version="1.3.0-preview" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Management.Resources" version="2.18.0-preview" targetFramework="net45" />
1212
<package id="Microsoft.Azure.Test.Framework" version="1.0.5571.32271-prerelease" targetFramework="net45" />

src/ResourceManager/DataFactories/Commands.DataFactories.Test/Commands.DataFactories.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
</Reference>
6161
<Reference Include="Microsoft.Azure.Management.Authorization">
6262
<SpecificVersion>False</SpecificVersion>
63-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.1-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
63+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6464
</Reference>
6565
<Reference Include="Microsoft.Azure.Management.DataFactories">
6666
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataFactories.0.15.6-preview\lib\net40\Microsoft.Azure.Management.DataFactories.dll</HintPath>

src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<package id="Microsoft.Azure.Common.Authentication" version="1.0.22-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
77
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
8-
<package id="Microsoft.Azure.Management.Authorization" version="0.18.1-preview" targetFramework="net45" />
8+
<package id="Microsoft.Azure.Management.Authorization" version="0.18.2-preview" targetFramework="net45" />
99
<package id="Microsoft.Azure.Management.DataFactories" version="0.15.6-preview" targetFramework="net45" />
1010
<package id="Microsoft.Azure.Management.Resources" version="2.18.0-preview" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Test.Framework" version="1.0.5571.32271-prerelease" targetFramework="net45" />

src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
<HintPath>..\..\..\packages\Microsoft.Azure.Graph.RBAC.1.7.0-preview\lib\net40\Microsoft.Azure.Graph.RBAC.dll</HintPath>
6565
</Reference>
6666
<Reference Include="Microsoft.Azure.Management.Authorization">
67-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.1-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
67+
<SpecificVersion>False</SpecificVersion>
68+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6869
</Reference>
6970
<Reference Include="Microsoft.Azure.ResourceManager">
7071
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
@@ -246,7 +247,9 @@
246247
<Content Include="ScenarioTests\AuthorizationTests.ps1">
247248
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
248249
</Content>
249-
<None Include="Resources\RoleDefinition.json" />
250+
<None Include="Resources\NewRoleDefinition.json">
251+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
252+
</None>
250253
<None Include="ScenarioTests\ActiveDirectoryTests.ps1">
251254
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
252255
</None>
@@ -268,7 +271,9 @@
268271
<None Include="ScenarioTests\RoleAssignmentTests.ps1">
269272
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
270273
</None>
271-
<None Include="ScenarioTests\RoleDefinitionTests.ps1" />
274+
<None Include="ScenarioTests\RoleDefinitionTests.ps1">
275+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
276+
</None>
272277
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ActiveDirectoryTests\TestGetADUserWithMail.json">
273278
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
274279
</None>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"Name": "CustomRole Test Role",
3+
"Description": "Test role",
4+
"Actions": [
5+
"Microsoft.Authorization/*/read",
6+
"Microsoft.Support/*"
7+
],
8+
"NotActions": [],
9+
"AssignableScopes": ["Scope1" , "Scope2"]
10+
}

src/ResourceManager/Resources/Commands.Resources.Test/Resources/RoleDefinition.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/RoleDefinitionTests.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,21 @@ namespace Microsoft.Azure.Commands.Resources.Test.ScenarioTests
2020
{
2121
public class RoleDefinitionTests
2222
{
23+
// TODO: Add [Trait(Category.AcceptanceType, Category.CheckIn)] attribute for each test once it gets implemented fully
24+
25+
[Fact(Skip = "Not implemented")]
26+
public void RoleDefinitionCreateTests()
27+
{
28+
ResourcesController.NewInstance.RunPsTest("Test-RoleDefinitionCreateTests");
29+
}
30+
2331
[Fact(Skip="Not implemented")]
24-
[Trait(Category.AcceptanceType, Category.CheckIn)]
2532
public void RdNegativeScenarios()
2633
{
2734
ResourcesController.NewInstance.RunPsTest("Test-RdNegativeScenarios");
2835
}
2936

3037
[Fact(Skip = "Not implemented")]
31-
[Trait(Category.AcceptanceType, Category.CheckIn)]
3238
public void RdPositiveScenarios()
3339
{
3440
ResourcesController.NewInstance.RunPsTest("Test-RDPositiveScenarios");

src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/RoleDefinitionTests.ps1

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,43 @@
1212
# limitations under the License.
1313
# ----------------------------------------------------------------------------------
1414

15+
<#
16+
.SYNOPSIS
17+
Tests verify scenarios for RoleDefinitions creation.
18+
#>
19+
function Test-RoleDefinitionCreateTests
20+
{
21+
# Basic positive case - read from file
22+
$rdName = 'CustomRole Test Role'
23+
New-AzureRoleDefinition -InputFile .\Resources\NewRoleDefinition.json
24+
$rd = Get-AzureRoleDefinition -Name $rdName
25+
Assert-NotNull $rd
26+
Assert-AreEqual "Test role" $rd.Description
27+
Assert-AreEqual $true $rd.IsCustom
28+
Assert-NotNull $rd.Actions
29+
Assert-AreEqual "Microsoft.Authorization/*/read" $rd.Actions[0]
30+
Assert-AreEqual "Microsoft.Support/*" $rd.Actions[1]
31+
Assert-NotNull $rd.AssignableScopes
32+
# The below scopes may need to be changed to actual scope values like /subscriptions/.... to satisfy the ARM access checks for PUT requests
33+
Assert-AreEqual "Scope1" $rd.AssignableScopes[0]
34+
Assert-AreEqual "Scope2" $rd.AssignableScopes[1]
35+
36+
# Basic positive case - read from object
37+
$roleDef = Get-AzureRoleDefinition -Name "Virtual Machine Contributor"
38+
$roleDef.Id = $null
39+
$roleDef.Name = "Virtual machine restarter"
40+
$roleDef.Actions.Add("Microsoft.ClassicCompute/virtualMachines/restart/action")
41+
$roleDef.Description = "Can monitor and restart virtual machines"
42+
43+
New-AzureRoleDefinition -Role $roleDef
44+
$addedRoleDef = Get-AzureRoleDefinition -Name "Virtual machine restarter"
45+
46+
Assert-AreEqual $roleDef.Actions $addedRoleDef.Actions
47+
Assert-AreEqual $roleDef.Description $addedRoleDef.Description
48+
Assert-AreEqual $roleDef.AssignableScopes $addedRoleDef.AssignableScopes
49+
Assert-AreEqual $true $roleDef.IsCustom
50+
}
51+
1552
<#
1653
.SYNOPSIS
1754
Tests verify negative scenarios for RoleDefinitions
@@ -34,7 +71,7 @@ function Test-RdNegativeScenarios
3471
$rdNull = Get-AzureRoleDefinition -Name $rdName
3572

3673
# Create a role definition
37-
# $rd = New-AzureRoleDefinition -InputFile .Resources\RoleDefinition.json
74+
$rd = New-AzureRoleDefinition -InputFile .Resources\RoleDefinition.json
3875

3976
# Role Defintion not provided.
4077
$roleDefNotProvided = "Role definition not provided."
@@ -59,7 +96,7 @@ function Test-RDPositiveScenarios
5996
{
6097
# Create a role definition with Name rdNamme.
6198
$rdName = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
62-
# $rd = New-AzureRoleDefinition -InputFile .\Resources\RoleDefinition.json
99+
$rd = New-AzureRoleDefinition -InputFile .\Resources\RoleDefinition.json
63100
$rd = Get-AzureRoleDefinition -Name $rdName
64101

65102
# Update the role definition with name $rdName that was created in the step above.
@@ -78,6 +115,6 @@ function Test-RDPositiveScenarios
78115
$readRd = Get-AzureRoleDefinition -Name $rd.Name
79116
Assert-Null $readRd
80117

81-
# $rdReCreated = New-AzureRoleDefinition -Role $rd
118+
$rdReCreated = New-AzureRoleDefinition -Role $rd
82119
$rdReDeleted = Get-AzureRoleDefinition -Name $rd.Name | Remove-AzureRoleDefinition -Force
83-
}
120+
}

src/ResourceManager/Resources/Commands.Resources.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
77
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
88
<package id="Microsoft.Azure.Graph.RBAC" version="1.7.0-preview" targetFramework="net45" />
9-
<package id="Microsoft.Azure.Management.Authorization" version="0.18.1-preview" targetFramework="net45" />
9+
<package id="Microsoft.Azure.Management.Authorization" version="0.18.2-preview" targetFramework="net45" />
1010
<package id="Microsoft.Azure.Management.Resources" version="2.18.0-preview" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Test.Framework" version="1.0.5571.32271-prerelease" targetFramework="net45" />
1212
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.0.5571.32271-prerelease" targetFramework="net45" />

src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@
6868
<SpecificVersion>False</SpecificVersion>
6969
<HintPath>..\..\..\packages\Microsoft.Azure.Graph.RBAC.1.7.0-preview\lib\net40\Microsoft.Azure.Graph.RBAC.dll</HintPath>
7070
</Reference>
71-
<Reference Include="Microsoft.Azure.Management.Authorization">
72-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.1-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
71+
<Reference Include="Microsoft.Azure.Management.Authorization, Version=0.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
72+
<SpecificVersion>False</SpecificVersion>
73+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
7374
</Reference>
7475
<Reference Include="Microsoft.Azure.ResourceManager">
7576
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
@@ -132,6 +133,11 @@
132133
<Compile Include="ActiveDirectory\RemoveAzureADServicePrincipalCommand.cs" />
133134
<Compile Include="ActiveDirectory\NewAzureADServicePrincipalCommand.cs" />
134135
<Compile Include="Models.ResourceGroups\PSResourceProviderOperation.cs" />
136+
<Compile Include="Properties\Resources.Designer.cs">
137+
<AutoGen>True</AutoGen>
138+
<DesignTime>True</DesignTime>
139+
<DependentUpon>Resources.resx</DependentUpon>
140+
</Compile>
135141
<Compile Include="ProviderFeatures\AzureProviderFeatureCmdletsBase.cs" />
136142
<Compile Include="ProviderFeatures\GetAzureProviderFeatureCmdlet.cs" />
137143
<Compile Include="Models.ActiveDirectory\ActiveDirectoryBaseCmdlet.cs" />
@@ -184,7 +190,7 @@
184190
<Compile Include="Models.Authorization\AuthorizationClient.cs" />
185191
<Compile Include="ProviderFeatures\RegisterAzureProviderFeatureCmdlet.cs" />
186192
<Compile Include="Providers\GetAzureProviderCmdlet.cs" />
187-
<Compile Include="Providers\GetAzureProviderOperationCmdlet.cs" />
193+
<Compile Include="Providers\GetAzureProviderOperationCmdlet.cs" />
188194
<Compile Include="Providers\RegisterAzureProviderCmdlet.cs" />
189195
<Compile Include="Providers\UnregisterAzureProviderCmdlet.cs" />
190196
<Compile Include="ResourceGroups\GetAzureResourceGroupLogCommand.cs" />
@@ -196,8 +202,7 @@
196202
<Compile Include="RoleAssignments\GetAzureRoleAssignmentCommand.cs" />
197203
<Compile Include="RoleAssignments\NewAzureRoleAssignmentCommand.cs" />
198204
<Compile Include="RoleDefinitions\GetAzureRoleDefinitionCommand.cs" />
199-
<Compile Include="RoleDefinitions\RemoveAzureRoleDefinitionCommand.cs" />
200-
<Compile Include="RoleDefinitions\SetAzureRoleDefinitionCommand.cs" />
205+
<Compile Include="RoleDefinitions\NewAzureRoleDefinitionCommand.cs" />
201206
<Compile Include="Templates\TestAzureResourceGroupTemplateCommand.cs" />
202207
<Compile Include="Templates\SaveAzureResourceGroupGalleryTemplateCommand.cs" />
203208
<Compile Include="Templates\GetAzureResourceGroupGalleryTemplateCommand.cs" />
@@ -213,11 +218,6 @@
213218
<Compile Include="Models.ResourceGroups\SetResourceMode.cs" />
214219
<Compile Include="Models.ResourceGroups\TemplateFile.cs" />
215220
<Compile Include="Models.ResourceGroups\TemplateFileParameterV1.cs" />
216-
<Compile Include="Properties\Resources.Designer.cs">
217-
<AutoGen>True</AutoGen>
218-
<DesignTime>True</DesignTime>
219-
<DependentUpon>Resources.resx</DependentUpon>
220-
</Compile>
221221
<Compile Include="Models.ResourceGroups\ResourceClient.ResourceManager.cs" />
222222
<Compile Include="Properties\AssemblyInfo.cs" />
223223
<Compile Include="ResourceGroupDeployments\StopAzureResourceGroupDeploymentCommand.cs" />
@@ -266,8 +266,8 @@
266266
<ItemGroup>
267267
<EmbeddedResource Include="Properties\Resources.resx">
268268
<Generator>ResXFileCodeGenerator</Generator>
269-
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
270269
<SubType>Designer</SubType>
270+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
271271
</EmbeddedResource>
272272
</ItemGroup>
273273
<ItemGroup />

0 commit comments

Comments
 (0)