An external user is made a co-administrator of a tenant and is tasked with creating a new Azure Key Vault. However, that user receives the following warning when the vault is created:
If the external user tries to perform the recommended step of running Set-AzureRmKeyVaultAccessPolicy to configure the access policy, the following error is triggered:
PS C:\> New-AzureRmKeyVault -VaultName <Key_Vault_Name> -ResourceGroupName <Resource_Group> -Location <Region>
WARNING: The usage of Tag parameter in this cmdlet will be modified in a future release. This will impact creating,
updating and appending tags for Azure resources. For more details about the change, please visit https://github.com/Azure/azure-powershell/issues/726#issuecomment-213545494
WARNING: Guest users are not allowed to perform this action.
Vault Name : <Key_Vault_Name>
Resource Group Name : <Resource_Group>
Location : <Region>
Resource
ID : /subscriptions/<SubscriptionID>/resourceGroups/<Resource_Group>/providers/Microsoft.KeyVault/vaults/<Key_Vault_Name>
Vault URI : https://.vault.azure.net
Tenant ID : <TenantID>
SKU : Standard
Enabled For Deployment? : False
Enabled For Template Deployment? : False
Enabled For Disk Encryption? : False
Access Policies :
Tags :
WARNING: Access policy is not set. No user or application have access permission to use this vault. Please use Set-AzureRmKeyVaultAccessPolicy to set access policies.
Additionally, all attempts by that user to manage the Key Vault access policy or to add keys or secrets to the vault trigger errors and fail.WARNING: The usage of Tag parameter in this cmdlet will be modified in a future release. This will impact creating,
updating and appending tags for Azure resources. For more details about the change, please visit https://github.com/Azure/azure-powershell/issues/726#issuecomment-213545494
WARNING: Guest users are not allowed to perform this action.
Vault Name : <Key_Vault_Name>
Resource Group Name : <Resource_Group>
Location : <Region>
Resource
ID : /subscriptions/<SubscriptionID>/resourceGroups/<Resource_Group>/providers/Microsoft.KeyVault/vaults/<Key_Vault_Name>
Vault URI : https://
Tenant ID : <TenantID>
SKU : Standard
Enabled For Deployment? : False
Enabled For Template Deployment? : False
Enabled For Disk Encryption? : False
Access Policies :
Tags :
WARNING: Access policy is not set. No user or application have access permission to use this vault. Please use Set-AzureRmKeyVaultAccessPolicy to set access policies.
If the external user tries to perform the recommended step of running Set-AzureRmKeyVaultAccessPolicy to configure the access policy, the following error is triggered:
PS C:\> Set-AzureRmKeyVaultAccessPolicy -VaultName <Key_Vault_Name> -ResourceGroupName <Resource_Group> -UserPrincipalName <username>@contoso.com -PermissionsToKeys get,create,delete,list,update,import,backup,restore -PermissionsToSecrets all
Set-AzureRmKeyVaultAccessPolicy : Guest users are not allowed to perform this action.
At line:1 char:1
+ Set-AzureRmKeyVaultAccessPolicy -VaultName <Key_Vault_Name> -ResourceGroupName ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzureRmKeyVaultAccessPolicy], ODataErrorException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultAccessPolicy
If the user attempts to view the Key Vault it fails with this error:PS C:\> Get-AzureKeyVaultKey -VaultName <Key_Vault_Name>
Get-AzureKeyVaultKey : Operation "list" is not allowed
At line:1 char:1
+ Get-AzureKeyVaultKey -VaultName <Key_Vault_Name>
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureKeyVaultKey], KeyVaultClientException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultKeyIf the user attempts to add a Key to the Key Vault it fails with this error:If the user attempts to add a Key to the Key Vault it fails with this error:PS C:\> Add-AzureKeyVaultKey -VaultName <Key_Vault_Name> -Name <Key_Encryption_Key> -Destination Software
Add-AzureKeyVaultKey : Operation "create" is not allowed
At line:1 char:1
+ Add-AzureKeyVaultKey -VaultName <Key_Vault_Name> -Name KEK -Destination Softwa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Add-AzureKeyVaultKey], KeyVaultClientException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.KeyVault.AddAzureKeyVaultKeyIf the user attempts to add a Secret to the Key Vault it fails with this error:PS C:\> $Secret = ConvertTo-SecureString -String 'Password1' -AsPlainText -Force
PS C:\> Set-AzureKeyVaultSecret -VaultName <Key_Vault_Name> -Name G-Secret -SecretValue $Secret
Set-AzureKeyVaultSecret : Operation "set" is not allowed
At line:1 char:1
+ Set-AzureKeyVaultSecret -VaultName <Key_Vault_Name> -Name G-Secret -SecretValu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzureKeyVaultSecret], KeyVaultClientException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultSecret
Set-AzureRmKeyVaultAccessPolicy : Guest users are not allowed to perform this action.
At line:1 char:1
+ Set-AzureRmKeyVaultAccessPolicy -VaultName <Key_Vault_Name> -ResourceGroupName ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzureRmKeyVaultAccessPolicy], ODataErrorException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultAccessPolicy
If the user attempts to view the Key Vault it fails with this error:PS C:\> Get-AzureKeyVaultKey -VaultName <Key_Vault_Name>
Get-AzureKeyVaultKey : Operation "list" is not allowed
At line:1 char:1
+ Get-AzureKeyVaultKey -VaultName <Key_Vault_Name>
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureKeyVaultKey], KeyVaultClientException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultKeyIf the user attempts to add a Key to the Key Vault it fails with this error:If the user attempts to add a Key to the Key Vault it fails with this error:PS C:\> Add-AzureKeyVaultKey -VaultName <Key_Vault_Name> -Name <Key_Encryption_Key> -Destination Software
Add-AzureKeyVaultKey : Operation "create" is not allowed
At line:1 char:1
+ Add-AzureKeyVaultKey -VaultName <Key_Vault_Name> -Name KEK -Destination Softwa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Add-AzureKeyVaultKey], KeyVaultClientException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.KeyVault.AddAzureKeyVaultKeyIf the user attempts to add a Secret to the Key Vault it fails with this error:PS C:\> $Secret = ConvertTo-SecureString -String 'Password1' -AsPlainText -Force
PS C:\> Set-AzureKeyVaultSecret -VaultName <Key_Vault_Name> -Name G-Secret -SecretValue $Secret
Set-AzureKeyVaultSecret : Operation "set" is not allowed
At line:1 char:1
+ Set-AzureKeyVaultSecret -VaultName <Key_Vault_Name> -Name G-Secret -SecretValu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzureKeyVaultSecret], KeyVaultClientException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultSecret