Nick's Blog

ERROR: Max retries exceeded attempting to connect to vault. The vault may not exist or you may need to flush your DNS cache and try again later.

I was working on Azure Key Vault in Azure DevOps. I’m trying to retrieve the secret from Azure Key Vault from Azure DevOps pipeline.

 
az login \
    --service-principal \
    --username $CLIENT_ID \
    --password $CLIENT_SECRET \
    --tenant $TENANT_ID

After logged into Azure, when I ran the az keyvault secret show command. I was getting the following error:

ERROR: Max retries exceeded attempting to connect to vault. The vault may not exist or you may need to flush your DNS cache and try again later.

After the troubleshooting, I realised I messed up with name and vault name. So essentially name is the secret name, and vault name is the name of the vault. So the command will be something like below.

az keyvault secret show -n "KIALIUSERNAME" --vault-name "azkv"