Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ResourceManager/Resources/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
-->
## Current Release
* Fixed issue with importing aliases
* Add Support for DataActions and NotDataActions to be passed in roledefinition create calls

## Version 5.4.0
* Register-AzureRmProviderFeature: Added missing example in the docs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Graph.RBAC.3.4.0-preview\lib\net452\Microsoft.Azure.Graph.RBAC.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.Authorization, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.6.0-preview\lib\net452\Microsoft.Azure.Management.Authorization.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.7.0-preview\lib\net452\Microsoft.Azure.Management.Authorization.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Insights">
<HintPath>..\..\..\packages\Microsoft.Azure.Insights.0.10.0-preview\lib\net45\Microsoft.Azure.Insights.dll</HintPath>
Expand Down Expand Up @@ -308,6 +308,9 @@
<None Include="Resources\NewRoleDefinition.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\DataActionsRoleDefinition.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="sampleDeploymentTemplate.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -440,6 +443,9 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ProviderTests\TestAzureProvider_WithZoneMappings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ProviderTests\TestAzureProviderOperationDataActions.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ResourceGroupTests\TestExportResourceGroup.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -707,6 +713,24 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.RoleDefinitionTests\RDUpdate.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.RoleDefinitionTests\RoleDefinitionDataActionsCreateTests.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.RoleDefinitionTests\RDRemoveScenario.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.RoleDefinitionTests\RDGetAtScopeFilterRoles.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.RoleDefinitionTests\RDDataActionsNegativeTestCases.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.RoleDefinitionTests\RDGetCustomRoles.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.RoleDefinitionTests\RDGetScenario.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="sampleTemplate.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"Name": "CustomRole Tests Role New",
"Description": "Test role",
"Actions": [],
"NotActions": [],
"DataActions": [
"Microsoft.Storage/storageAccounts/blobServices/containers/blobs/*"
],
"NotDataActions": [
"Microsoft.Storage/storageAccounts/blobServices/containers/blobs/write"
],
"AssignableScopes": ["/subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,12 @@ public void TestAzureProviderOperation()
{
ResourcesController.NewInstance.RunPsTest("Test-AzureProviderOperation");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAzureProviderOperationDataActions()
{
ResourcesController.NewInstance.RunPsTest("Test-AzureProviderOperationDataActions");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ function Test-AzureProviderOperation
foreach ($action in $insightsActions)
{
Assert-True { $action.Operation.ToLower().StartsWith("microsoft.insights/"); }
Assert-NotNull $action.isDataAction
}

# Case insenstive search
Expand All @@ -109,6 +110,7 @@ function Test-AzureProviderOperation
foreach ($action in $insightsCaseActions)
{
Assert-True { $action.Operation.ToLower().Startswith("microsoft.insights/"); }
Assert-NotNull $action.isDataAction
}

# Get all Read operations of microsoft.insights provider
Expand All @@ -119,6 +121,7 @@ function Test-AzureProviderOperation
{
Assert-True { $action.Operation.ToLower().EndsWith("/read"); }
Assert-True { $action.Operation.ToLower().StartsWith("microsoft.insights/");}
Assert-NotNull $action.isDataAction
}

# Get all Read operations of all providers
Expand All @@ -130,6 +133,7 @@ function Test-AzureProviderOperation
foreach ($action in $readActions)
{
Assert-True { $action.Operation.ToLower().EndsWith("/read"); }
Assert-NotNull $action.isDataAction
}

# Get a particular operation
Expand All @@ -141,7 +145,7 @@ function Test-AzureProviderOperation
Assert-True { $action.Length -eq 0 }

# Get operations for non-existing provider
$exceptionMessage = "Provider NonExistentProvider not found.";
$exceptionMessage = "Provider 'NonExistentProvider' not found.";
Assert-Throws { Get-AzureRmProviderOperation NonExistentProvider/* } $exceptionMessage

# Get operations for non-existing provider
Expand All @@ -158,4 +162,22 @@ function Test-AzureProviderOperation
# Get operations with ? in search string
$exceptionMessage = "Wildcard character ? is not supported.";
Assert-Throws {Get-AzureRmProviderOperation Microsoft.Sql/servers/*/rea? } $exceptionMessage
}

<#
.SYNOPSIS
Tests querying for a resource provider's operations/actions
#>
function Test-AzureProviderOperationDataActions
{

# Get all operations of microsoft.insights provider
$storageDataActions = Get-AzureRmProviderOperation Microsoft.Storage/storageAccounts/blobServices/containers/blobs/*

foreach ($action in $storageDataActions)
{
Assert-NotNull $action
Assert-AreEqual $action.isDataAction $true
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,42 +35,70 @@ public void RoleDefinitionCreateTests()
ResourcesController.NewInstance.RunPsTest("Test-RoleDefinitionCreateTests");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RoleDefinitionDataActionsCreateTests()
{
ResourcesController.NewInstance.RunPsTest("Test-RoleDefinitionDataActionsCreateTests");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RdNegativeScenarios()
{
ResourcesController.NewInstance.RunPsTest("Test-RdNegativeScenarios");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RdPositiveScenarios()
{
ResourcesController.NewInstance.RunPsTest("Test-RDPositiveScenarios");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RDUpdate()
{
ResourcesController.NewInstance.RunPsTest("Test-RDUpdate");
}
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RDUpdate()
{
ResourcesController.NewInstance.RunPsTest("Test-RDUpdate");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RDCreateFromFile()
{
ResourcesController.NewInstance.RunPsTest("Test-RDCreateFromFile");
}
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RDCreateFromFile()
{
ResourcesController.NewInstance.RunPsTest("Test-RDCreateFromFile");
}

[Fact(Skip = "Unskip after service side change")]
[Fact(Skip = "Unskip after service side change")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you unskip this test now, or is this still waiting on other changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is still waiting for the changes

[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RDRemoveScenario()
{
ResourcesController.NewInstance.RunPsTest("Test-RDRemove");
}

[Fact(Skip = "Unskip after service side change")]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RDGetCustomRoles()
{
ResourcesController.NewInstance.RunPsTest("Test-RDGetCustomRoles");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RDGetAtScopeFilterRoles()
{
ResourcesController.NewInstance.RunPsTest("Test-RDGetAtScopeFilterRoles");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RDDataActionsNegativeTestCases()
{
ResourcesController.NewInstance.RunPsTest("Test-RDDataActionsNegativeTestCases");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RDGetScenario()
{
Expand Down
Loading