Azure / PowerShell / Deploy Azure SQL database DR environment (PaaS) using PowerShell

Script Download:

The script with usage example is available for download from https://gallery.technet.microsoft.com/Deploy-Azure-SQL-DR-47dfa7f7

Summary:

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

 

Description:

Use PowerShell to deploy cloud service with Azure SQL Database (PaaS) with good resilience to outages (GEO Replications, Failover Groups)

PowerShell:

  • 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 created login,
  • Create failover Azure Logical SQL Server, including admin login, password and firewall rules (Optional),
  • Create Failover Group Name (Optional),
  • Add Database to the existing Failover Group (Optional),
  • Create a new login for the Failover Azure SQL Server with matching SID (Optional),
  • Send Email notification with connection string parameters.

 

Script usage example:

 

Note.
You can repeat the script multiple times. If the resource you are creating already exist script will just skip that part with a message. 

 

Note.
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 *