-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Supported "all" as an option when setting key vault access policies (#…
…13524) * Supported "all" as an option when setting key vault access policies * minor fix in docs * fix test
- Loading branch information
Showing
15 changed files
with
1,528 additions
and
23 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/KeyVault/KeyVault.Test/ScenarioTests/AccessPolicyTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Microsoft.WindowsAzure.Commands.ScenarioTest; | ||
using Xunit; | ||
|
||
namespace Microsoft.Azure.Commands.KeyVault.Test.ScenarioTests | ||
{ | ||
public class AccessPolicyTests : KeyVaultTestRunner | ||
{ | ||
public AccessPolicyTests(Xunit.Abstractions.ITestOutputHelper output) : base(output) | ||
{ | ||
} | ||
|
||
[Fact] | ||
[Trait(Category.AcceptanceType, Category.CheckIn)] | ||
public void TestSetAllAccessPolicies() | ||
{ | ||
TestRunner.RunTestScript("Test-SetAllAccessPolicies"); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/KeyVault/KeyVault.Test/ScenarioTests/AccessPolicyTests.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
function Test-SetAllAccessPolicies() | ||
{ | ||
$rg = Get-ResourceGroupName | ||
$vaultName = GetAssetName | ||
$rgLocation = Get-Location "Microsoft.Resources" "resourceGroups" "West US" | ||
$vaultLocation = Get-Location "Microsoft.KeyVault" "vault" "West US" | ||
$objectId = "d7e17135-d5a7-4b8b-89e5-252aa15b7e01" | ||
New-AzResourceGroup -Name $rg -Location $rgLocation | ||
|
||
try { | ||
New-AzKeyVault -ResourceGroupName $rg -VaultName $vaultName -Location $vaultLocation | ||
Set-AzKeyVaultAccessPolicy -VaultName $vaultName -ObjectId $objectId -PermissionsToCertificates all -PermissionsToKeys all -PermissionsToSecrets all -PermissionsToStorage all -BypassObjectIdValidation | ||
$vault = Get-AzKeyVault -ResourceGroupName $rg -VaultName $vaultName | ||
$accessPolicy = $vault.AccessPolicies | ? {$_.ObjectId -eq $objectId} | ||
Assert-NotNull $accessPolicy | ||
Assert-AreEqual "all" $accessPolicy.PermissionsToCertificatesStr | ||
Assert-AreEqual "all" $accessPolicy.PermissionsToKeysStr | ||
Assert-AreEqual "all" $accessPolicy.PermissionsToSecretsStr | ||
Assert-AreEqual "all" $accessPolicy.PermissionsToStorageStr | ||
} | ||
finally { | ||
Remove-AzResourceGroup -Name $rg -Force | ||
} | ||
} |
1,438 changes: 1,438 additions & 0 deletions
1,438
...zure.Commands.KeyVault.Test.ScenarioTests.AccessPolicyTests/TestSetAllAccessPolicies.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters