-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set-AzKeyVaultAccessPolicy - "all","purge" permissions bug #15844
Comments
Hey @pmsousa , thanks for reaching out to us! PS C:\> Set-AzKeyVaultAccessPolicy -VaultName *** -ResourceGroupName *** -UserPrincipalName '***@microsoft.com' -PermissionsToKeys all,purge -PermissionsToSecrets get -PermissionsToCertificates get
PS C:\> Get-AzKeyVault -VaultName ***
......
Access Policies :
Tenant ID : 72f988bf-86f1-41af-91ab-2d7cd011db47
Object ID : ***
Application ID :
Display Name : *** (***@microsoft.com)
Permissions to Keys : all, purge <----------- here
Permissions to Secrets : get
Permissions to Certificates : get
Permissions to (Key Vault Managed) Storage : If you are using a previous version could you update and try it again? And if the problem still reproduces please share the debug log with us by running |
Hey @isra-fel I've checked my Az modules and I had Az.KeyVault 3.4.5. I've updated the module and the problem persists. Module versions:
Name Version Az 6.4.0 Executing:
Results in: |
According to my test, after the |
@jlichwa Hi Jack, we have an issue when you set the access policy of a vault to |
@qinl-li can you take a look. It seems like 'all' is missing purge. |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @RandalliLama, @schaabs, @jlichwa. Issue DetailsDescriptionSet-AzKeyVaultAccessPolicy with "all" should allow to set all permissions, including "purge" or @("all","purge") should be accepted as valid. Second options is preferable because "purge" is a Privileged Permission and should be treated as that. At this moment, to set all permissions and also purge, we have to fall back to the enumerating all the options. This was first reported in feature request #12722 and Steps to reproduceSet-AzKeyVaultAccessPolicy -VaultName $vaultName -ObjectID $id -PermissionsToKeys 'all' -PermissionsToSecrets 'all' -PermissionsToCertificates 'all'
(Get-AzKeyVault -KeyVaultName $vaultName).AccessPolicies This will result in all the permissions to be set except purge. Set-AzKeyVaultAccessPolicy -VaultName $vaultName -ObjectID $group.id `
-PermissionsToKeys ('decrypt','encrypt','unwrapKey','wrapKey','verify','sign','get','list','update','create','import','delete','backup','restore','recover','purge') `
-PermissionsToSecrets ('get','list','set','delete','backup','restore','recover','purge') `
-PermissionsToCertificates ('get','list','delete','create','import','update','managecontacts','getissuers','listissuers','setissuers','deleteissuers','manageissuers','recover','purge','backup','restore')
(Get-AzKeyVault -KeyVaultName $vaultName).AccessPolicies This will result in all the permissions, including purge, to be set. Desired solutionSet-AzKeyVaultAccessPolicy -VaultName $vaultName -ObjectID $id -PermissionsToKeys 'all','purge' -PermissionsToSecrets 'all','purge' -PermissionsToCertificates 'all','purge'
Get-AzKeyVault -KeyVaultName $vaultName ).AccessPolicies
|
this is by design that 'purge' permission should be granted with caution. |
@sebansal the problem here is that even when customer wants to set purge for their administrator it does not work through our API.
|
I'm pretty sure the issue was portal GUI cannot handle the combination of "all" and "purge". While the API handled it well. |
Yes. Portal doesn't understand when it returned keys: ["all"]. It expects an array with each permission listed. I will get it fixed. |
The fix is rolling to prod. |
Description
Set-AzKeyVaultAccessPolicy with "all" should allow to set all permissions, including "purge" or @("all","purge") should be accepted as valid. Second options is preferable because "purge" is a Privileged Permission and should be treated as that.
At this moment, to set all permissions and also purge, we have to fall back to the enumerating all the options. This was first reported in feature request #12722 and
Steps to reproduce
This will result in all the permissions to be set except purge.
This will result in all the permissions, including purge, to be set.
Desired solution
The text was updated successfully, but these errors were encountered: