@Vijay Kumar
Thank you for your post!
Based off your az keyvault create and secret set CLI commands, those should be correct when using CLI. However, when it comes to assigning Key Vault access policies via CLI, you can use the az keyvault set-policy
command - For more info.
If you're trying to create an Azure Key Vault via PowerShell - Create Azure Key Vault with PowerShell:
Connect-AzAccount
#Create a resource group
New-AzResourceGroup -Name "myResourceGroup" -Location "EastUS"
#Create a key vault
New-AzKeyVault -Name "<your-unique-keyvault-name>" -ResourceGroupName "myResourceGroup" -Location "East US"
#Give your user account permissions to manage secrets in Key Vault
Set-AzKeyVaultAccessPolicy -VaultName "<your-unique-keyvault-name>" -UserPrincipalName "user@domain.com" -PermissionsToSecrets get,set,delete
For more info - https://learn.microsoft.com/en-us/azure/key-vault/secrets/quick-create-powershell
Additional Links:
Assign a Key Vault access policy - PowerShell
Az.KeyVault - PowerShell
Set and retrieve a secret from Azure Key Vault using Azure CLI
az keyvault - CLI
If you have any other questions, please let me know.
Thank you for your time and patience throughout this issue.
----------
Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.