az keyvault recover

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.

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 ResourceGroupName

Example

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 MyNewResGrp

After 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.

az keyvault recover

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

recover key vault

Video Tutorial

You may also like the following articles below.

Azure Virtual Machine

DOWNLOAD FREE AZURE VIRTUAL MACHINE PDF

Download our free 25+ page Azure Virtual Machine guide and master cloud deployment today!