Recently, I accidentally deleted a key vault, and my client asked me to restore that one as it was critical. So, I got the opportunity to use the az keyvault recover command to achieve this. In this article, I will walk you through the syntax and usage of the az keyvault recover command with specific examples.
Table of Contents
az keyvault recover
This command helps you to recover a deleted Vault or HSM for which soft delete was enabled.
Syntax
az keyvault recover --location locationname --name keyvaultname --resource-group ResourceGroupNameExample
In this example, I just restored the Azure keyvault named azurelessonsKV that comes under the resource group named MyNewResGrp.
az keyvault recover --location eastus --name azurelessonsKV --resource-group MyNewResGrpAfter executing the above command, I got the expected output as below and the Azure keyvault was restored successfully.
{
"id": "/subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups/MyNewResGrp/providers/Microsoft.KeyVault/vaults/azurelessonsKV",
"location": "eastus",
"name": "azurelessonsKV",
"properties": {
"accessPolicies": [],
"createMode": null,
"enablePurgeProtection": null,
"enableRbacAuthorization": true,
"enableSoftDelete": true,
"enabledForDeployment": false,
"enabledForDiskEncryption": false,
"enabledForTemplateDeployment": false,
"hsmPoolResourceId": null,
"networkAcls": {
"bypass": "None",
"defaultAction": "Allow",
"ipRules": [],
"virtualNetworkRules": []
},
"privateEndpointConnections": null,
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled",
"sku": {
"family": "A",
"name": "Standard"
},
"softDeleteRetentionInDays": 90,
"tenantId": "5d9d690a-0310-474d-ae8b-42df2d549228",
"vaultUri": "https://azurelessonskv.vault.azure.net/"
},
"resourceGroup": "MyNewResGrp",
"systemData": {
"createdAt": "2025-01-30T10:51:30.126000+00:00",
"createdBy": "fewlines4biju@hotmail.com",
"createdByType": "User",
"lastModifiedAt": "2025-01-31T11:25:25.449000+00:00",
"lastModifiedBy": "fewlines4biju@hotmail.com",
"lastModifiedByType": "User"
},
"tags": {},
"type": "Microsoft.KeyVault/vaults"
}You can see the same output shown in the screenshot below.

Now, to cross-check, I just logged in to the Azure Portal and verified that the Azure key vault was restored successfully.

Video Tutorial
You may also like the following articles below.

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
