Delete Azure SQL Databases


The Delete Azure SQL Databases action provides a straightforward solution for removing SQL databases on demand. This action is particularly useful when paired with the Export Azure SQL Databases action, allowing for a seamless backup-and-delete workflow.

By targeting specific databases, you can create a rule that can efficiently manage Azure SQL resources. In scenarios like test environments or fixture setups, deleting unused databases can free up resources, leading to an improved performance. It also proves valuable for releasing costs associated to save money on your Azure bill, and reduces the chance of unauthorized access on redundant databases containing sensitive data.

Use of this action in a rule

As this is a destructive action, in most situations it should be used in a sequence with the Export Azure SQL Databases action. For this use case, a specific database can be targeted by name.

Delete SQL Databases: name targeted

In some niche cases, e.g. a test environment that populates the database with fixture data on startup, this action can be useful on its own. For these use cases, multiple databases can be targeted by Tag Groups.

Delete SQL Databases: tag targeted


When you link GorillaStack to your Azure account, GorillaStack creates a service principal that provides access to the following permissions that are used by this action:

  • Microsoft.Sql/servers/databases/delete
  • Microsoft.Sql/servers/databases/read

Getting Started

  1. Link your Azure account to your GorillaStack account if you have not done so already
  2. Create a new rule in GorillaStack
  3. In the rule’s context settings, select Azure as the platform, and then select one or more linked Azure Subscriptions to target
  4. In the rule’s trigger settings, select any available trigger — Schedule and Manual Execution are the most popular
  5. In the rule’s actions settings, select Delete SQL Databases as the action
  6. In the Delete SQL Databases action, specify database targeting by Tag or by Name
  7. You might want to insert an Export Azure SQL Databases action before the Delete action to ensure a backup exists to restore from in the future