Due to failed command az keyvault create , I cannot remove resource on Azure Key Vault or create a new one.

Rodrigo Rios 1 Reputation point
2020-08-24T22:51:31.913+00:00

I am running a Lab for creating a key vault with az CLI on my free tier subscription.

The first step was to create a resource group.

az group create -n keyvault-aad-pod-identity-rg -l eastus

During the second step, I typed wrong the --location parameter.

az keyvault create --location westeurope --resource-group keyvault-aad-pod-identity-rg  --name keyvaultk8s

but them when I tried to delete it because I noticed that I created it in the wrong location. Look of what happens:

az keyvault delete --name keyvaultk8s
Message: The Resource 'Microsoft.KeyVault/vaults/keyvaultk8s' not found within subscription.

Then I try to purge it:

 az keyvault purge --name keyvaultk8s 
 Message: The specified resource does not exist.

Then I try to create it again:

$:~/Azure-AKS/keyvault-sample$ az keyvault create --location eastus --resource-group keyvault-aad-pod-identity-rg  --name keyvaultk8s

output: The name 'keyvaultk8s' is already in use.

$:~/Azure-AKS/keyvault-sample$ az keyvault create --location westeurope --resource-group keyvault-aad-pod-identity-rg  --name keyvaultk8s

output: The name 'keyvaultk8s' is already in use.

I have no idea how to fix this...

warm regards,
Rodrigo R

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,144 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JamesTran-MSFT 36,476 Reputation points Microsoft Employee
    2020-08-24T23:52:49.863+00:00

    @Rodrigo Rios
    Are you able to delete your Key Vault via the Portal or are you still not able to locate it there?
    -You can go to the Azure Portal -> In the Search bar type, Key Vault -> Select the correct Key Vault and delete it, once your vault is deleted you can then continue with your lab.

    20032-kvportal.jpg

    You can also make sure to select the correct subscription when deleting the Key Vault (if you have multiple subscriptions):
    az keyvault delete --name "keyvaultk8s" --resource-group "aad-pod-identity-rg" --subscription "subscriptionID or subscriptionName"

    Please let me know if you're still experiencing issues or have any other questions.
    Thank you for your time!