Mark Redman
Mark Redman

Reputation: 24515

How do I delete an sql database in Azure?

I have used the following powershell script to delete a database:

Remove-AzureRmSqlDatabase -ServerName $server -ResourceGroupName $rgname -DatabaseName $dbname

(first setting the variables)

and have tried using the Azure Portal

The port indicates a success in deletion, as does the activity logs, however

the resource is not being deleted?

Screenshot of activity log:

Activity Log

The deletes (on a number of occasions after the db comes back) show successful, however there is an audit policy that seems to be doing something. There are no Locks on the resrouce group.

UPDATE:

I have deleted from SSMS, and is not showing there or in the portal anymore.. (will wait to see if it comes back, as it did when deleting via portal and powershell)

UPDATE 2: Database is now back, so this is the database having been deleted 3 ways, portal, powershell and via SSMS.

Upvotes: 2

Views: 1203

Answers (2)

Mark Redman
Mark Redman

Reputation: 24515

It turns out the web application uses EF migrations which is recreating the database.

Note: The bigger issue is that the database is created on a much higher, and much more expensive tier.

Upvotes: 1

Peter Kay
Peter Kay

Reputation: 996

Do you happen to have a rogue policy somewhere? It seems something is running a Policy Effect: deployIfNotExist on the resource. Without access to your environment, there's not much I could recommend.

Check the documentation here: https://learn.microsoft.com/en-us/azure/governance/policy/concepts/effects#audit

Upvotes: 0

Related Questions