Azure SQL Databases Maintenance Using Azure Automation and PowerShell



Author: Eric Rouach, Madeira Data Solutions

Date: March 2022


The following guide describes how to execute and schedule any T-SQL command for Each Azure SQL database inside a given Azure SQL Server.


Pre-requisites:

· an existing Azure subscription

· an existing Azure SQL Server and Azure SQL Database(s)


Let’s begin!


In your Microsoft Azure subscription, create a new Automation Account:



Select your subscription, an existing Resource group (or create a new one if needed), Automation account name and Region. Then, click Review + Create:




You should be directed to the resource’s deployment screen. Once completed, click Go to resource: