Az lab Set and retrieve a secret from Azure Key Vault using PowerShell

Quickstart – Set & retrieve a secret from Key Vault using PowerShell | Microsoft Learn

Created key vault in we

# Give your user account permissions to manage secrets in Key Vault

Set-AzKeyVaultAccessPolicy -VaultName name -UserPrincipalName upn -PermissionsToSecrets get,set,delete

# Adding a secret to Key Vault

$secretvalue = ConvertTo-SecureString "Vikingswasnothere78-" -AsPlainText -Force
# Then, use the Azure PowerShell Set-AzKeyVaultSecret cmdlet to create a secret in Key Vault called ExamplePassword

$secret = Set-AzKeyVaultSecret -VaultName name -Name "ExamplePassword" -SecretValue $secretvalue
Retrieve a secret from Key Vault
$secret = Get-AzKeyVaultSecret -VaultName name -Name "ExamplePassword" -AsPlainText
# view it
write-host $secret

Output on portal powershell

But not in the resource

Adding this role

Nope, adding this

Azure Key Vault portal not showing secrets – Stack Overflow

Lets add a manually, done. But still not showing, takes a bit time

You can get the secret in the vault also

Scroll to Top