Symptoms
- Every app that uses the account fails at once. Typical errors:
getaddrinfo ENOTFOUND <account>.blob.core.windows.net,The remote name could not be resolved,ResourceNotFound, or Functions hosts that won't start becauseAzureWebJobsStoragepoints at the account. - The account is missing from the portal and from
az storage account list. - The activity log shows
Microsoft.Storage/storageAccounts/delete, often from a Terraform or Bicep pipeline, a cleanup script, or a resource group tidy-up.
Microsoft can recover a deleted account on a best-effort basis if all of these are true:
| Condition | Why it matters |
|---|---|
| Deleted within the last 14 days | After that the account can't be recovered |
| Created with Azure Resource Manager (not classic) | Classic accounts aren't covered |
| No new account with the same name has been created | Reusing the name blocks recovery for good |
| The resource group exists | Recreate it with the same name if it was deleted too |
| Customer-managed key vault still exists | Recover the key vault first if the account used CMK |
Caution
The most common way to lose the account for good is an IaC pipeline that "fixes drift" by creating a new, empty account with the same name. Pause those pipelines before you do anything else.
1. Freeze anything that can recreate the name (2 minutes)
- Disable or cancel scheduled Terraform, Bicep and ARM pipelines that manage this account or its resource group.
- Tell the team in the incident channel not to create the account by hand to "get things working".
- If the resource group was deleted too, recreate it with the same name and region and nothing else in it yet:
az group show -n rg-app-prod -o table 2>/dev/null || az group create -n rg-app-prod -l westeurope
2. Confirm what was deleted, when and by whom
az monitor activity-log list --offset 3d \
--query "[?operationName.value=='Microsoft.Storage/storageAccounts/delete'].{time:eventTimestamp, status:status.value, caller:caller, id:resourceId}" \
-o table
Write down the exact account name, resource group, subscription and deletion time. You need them for the recovery and for the support case if self-service fails.
If the account used customer-managed keys, check the key vault and key:
az keyvault list-deleted --query "[].{name:name, deleted:properties.deletionDate}" -o table
az keyvault recover --name kv-app-prod # only if the vault itself was deleted
3. Recover the account
You need a role with Microsoft.Storage/storageAccounts/write on the resource group (Contributor or Storage Account Contributor).
- In the Azure portal, open Storage accounts.
- Use the Restore option for deleted accounts at the top of the list. Portal labels change over time; if you can't find it, search the Microsoft Learn article "Recover a deleted storage account" for the current steps.
- Pick the subscription, then the deleted account, and confirm.
If the account isn't listed or the restore fails, open a Severity A support request straight away with the details from step 2. Don't wait for the 14-day window to get close.
Recovery brings back the account and its data services. Check it:
az storage account show -n stappprod -g rg-app-prod \
--query "{state:provisioningState, kind:kind, sku:sku.name, publicAccess:publicNetworkAccess}" -o table
az storage container list --account-name stappprod --auth-mode login --query "[].name" -o tsv | head
az storage share list --account-name stappprod --auth-mode login --query "[].name" -o tsv 2>/dev/null | head
Tip
Pick a few known blob paths and compare sizes or
lastModifiedwith what the app expects. Recovery should restore the data as it was at deletion time, but check before you call it fixed.
4. Rebuild what did not come back with the account
Items outside the account resource, or attached to it from other resources, may be missing or broken. Check each one:
| Item | Check | Fix |
|---|---|---|
| Private endpoints | az network private-endpoint-connection list --id <account-id> -o table | Recreate or re-approve; confirm the privatelink.blob.core.windows.net A record |
| Role assignments scoped to the account | az role assignment list --scope <account-id> -o table | Reapply from IaC |
| Diagnostic settings | az monitor diagnostic-settings list --resource <account-id>/blobServices/default | Recreate |
| Event Grid subscriptions | az eventgrid event-subscription list --source-resource-id <account-id> | Recreate |
| Resource locks | az lock list --resource-group rg-app-prod -o table | Add a delete lock (below) |
| Account keys and connection strings | Apps using shared keys | Rotate or confirm the keys apps use still match |
Get the account ID once:
id=$(az storage account show -n stappprod -g rg-app-prod --query id -o tsv)
Then restart the consumers that cache failed connections: Function Apps, App Service, AKS deployments.
az functionapp restart -g rg-app-prod -n func-orders-prod
kubectl rollout restart deployment/orders-api -n orders
5. If recovery isn't possible
- Restore blob data from Azure Backup (operational or vaulted backup) into a new account, if you had it configured.
- Rehydrate from object replication or geo copies in another account.
- Restore file shares from Azure Backup snapshots, if the backup vault still has them.
- Re-ingest from source systems for anything that has no copy.
A new account needs a different name unless Microsoft confirms recovery is impossible. Update app settings and Key Vault references to point at the new name.
Verify recovery
nslookup stappprod.blob.core.windows.netresolves (to the private IP if you use private endpoints).- App error rates and storage
TransactionsbyResponseTypereturn to baseline in Azure Monitor metrics. - Pipelines resume and write new data; check one end to end.
Communicate
"Storage account
Prevent it next time
Put a delete lock on every production storage account:
az lock create --name no-delete --lock-type CanNotDelete \
--resource-group rg-app-prod --resource-name stappprod \
--resource-type Microsoft.Storage/storageAccounts
- Use
prevent_destroyin Terraform (or deployment stacks with deny settings in Bicep) on stateful resources, and require approval for plans that destroy them. - Alert on
Microsoft.Storage/storageAccounts/deletewith an activity log alert routed to on-call. - Enable blob soft delete, container soft delete and versioning. They don't protect against account deletion, but they cover the more common accidental deletes inside the account.
- Back up critical blob containers and file shares with Azure Backup into a vault with immutability turned on.
- Keep account names, private endpoints and role assignments in IaC so the rebuild in step 4 is one deployment.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get