5

Purging Deleted Azure Key Vaults

 1 year ago
source link: https://paulyu.dev/code/purge-deleted-azure-vaults/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Purging Deleted Azure Key Vaults

February 27, 2023

1 min read

Azure Key Vault

Do you constantly provision and delete Azure Key Vaults? If so, you may have noticed attempts to recreate a recently deleted key vault will result in the following error: The vault name is already in use.. This is because Azure Key Vaults are kept in a deleted state and not automatically purged. You must manually purge these key vaults to be able to reuse the name.

To confirm the key vault in question is in “deleted” state, you can run the following:

az keyvault list-deleted --query "[].name" -o tsv

Using Bash, we can loop through all deleted key vaults and purge them so that the name can be re-used:

az keyvault list-deleted --query "[].name" -o tsv | while read keyvault; do
  az keyvault purge -n $keyvault;
done

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK