Azure Course Labs

Lab Solution

Browse to your Key Vault in the Portal and open Secrets. You’ll see a warning saying your client IP does not have access - add it in the Networking tab (you can find it at https://ifconfig.me).

Open secret01 on the Secrets page and select Delete - you’ll see a message about soft-delete being enabled.

Click on Generate/Import and create a new secret:

You’ll see an unhelpful error about a conflict

Try from the CLI instead:

az keyvault secret set --name secret01 --value azure-labs --vault-name <kv-name>

Now the error is more sensible:

Secret secret01 is currently in a deleted but recoverable state, and its name cannot be reused; in this state, the secret can only be recovered or purged.

Back in the Portal click on Manage deleted secrets from the Secrets tab. Here you can Purge the secret which deletes it permanently.

But you don’t have permission!

No-one gets purge permissions by default, you need to add it to your account in Access Policies. Then you can purge the secret and recreate it.

As soon as the new secret is created, you can read it in the VM.