Azure / PowerShell / Deploy Azure SQL database DR environment with integrated azure SQL Analytics Solution using PowerShell

Script Download:


Use PowerShell to create cloud DR environment using Azure SQL Databases (PaaS) with integrated azure SQL Analytics Solution and send Email Report with the connection string details.


Use PowerShell to deploy cloud service with Azure SQL Database (PaaS) with good resilience to outages (GEO Replications, Failover Groups) and with integrated azure SQL Analytics Solution.


The script will include the following:

  • Connect to Azure Account;
  • Use existing or create new Resource Group;
  • Create primary Azure Logical SQL Server;
  • Set an admin login and password for your server;
  • Set Firewall Settings (IP address range);
  • Create Azure SQL Database;
  • Create a new login for the Azure SQL Server;
  • Create a new DB user for the existing login;
  • Create Failover Azure Logical SQL Server, including admin login, password and firewall rules (Optional);
  • Create Failover Group Name (Optional);
  • Add Database to the exiting Failover Group (Optional);
  • Create a new login for the Failover Azure SQL Server with matching SID (Optional);
  • Create a Workspace in the existing Resource Group;
  • Enable Azure SQL Analytics Intelligence Pack;
  • Enable Azure Diagnostics for Azure SQL database;
  • Configure Azure SQL Databases to stream diagnostics telemetry;
  • Send Email notification with connection string parameters.

Powershell script:

Script usage example:

You can repeat the script multiple times. If the resource you are creating already exist script will just skip that part with a message. 
You should use read/write listener endpoint within the connection string.

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *