we accidently deleted sql server and database in azure , how to recover

Atharv Atre 0 Reputation points
2025-10-31T08:28:00.42+00:00

We accidentally deleted SQL Server and the database in Azure yesterday, so we want to recover it .we want the backup of SQL Server and the database because it contains essential data

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Alex Burlachenko 18,390 Reputation points Volunteer Moderator
    2025-10-31T08:52:57.9633333+00:00

    Atharv Atre this is a critical situation, don't panic.

    you have a good chance of recovery if you act quickly. the most important thing. stop creating new resources in the same azure subscription. any new activity reduces the chance of a successful recovery.

    for azure sql database, there is a built in safety net. when you delete a logical sql server, its databases are not immediately permanently erased. they are kept in a soft deleted state for a limited time, usually between 1 to 7 days, depending on your service tier.

    you need to use the azure cli or powershell, as the portal might not show these soft deleted resources easily. open azure cloud shell or your local terminal with the az cli installed. then, run this command to list the recoverable deleted servers.

    az sql deleted-server list --resource-group your-resource-group-name

    this will show you the servers that have been soft deleted. note the name and deletion date of your server.

    to restore the entire server and its databases, you use the restore command. you cannot restore just the server, you must restore it to a new server with a different name.

    az sql db restore --deleted-name your-deleted-server-name --name your-new-server-name --resource-group your-resource-group-name --service-objective your-service-tier --edition your-edition

    you will need to specify the service objective and edition, so have that information ready.

    if you only need a specific database and not the whole server, you can also restore a single deleted database to a new database on a different server.

    az sql db restore --deleted-name your-deleted-database-name --name your-new-database-name --server your-existing-server --resource-group your-resource-group-name --service-objective your-service-tier --edition your-edition

    this process is time sensitive. the longer you wait, the higher the chance the soft deleted data is purged. if these commands do not work or you cannot find your server, your only option is to contact azure support immediately. they have tools that can sometimes recover data beyond the soft delete window.

    use the azure cli right now to list and restore your deleted sql server or its databases to a new resource. if that fails, contact support without delay.

    good luck,

    Alex

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.