Actionable Data Analytics
Join Our Email List for Data News Sent to Your Inbox

Azure SQL Database & Synapse SQL Pool DNS Aliases

Posted on

Let’s create an Azure SQL Database and dedicated SQL Pool DNS (Domain Name System) alias together. This will help you minimize configuration changes anytime you migrate an application or execute a disaster recovery scenario. 

Why create Azure SQL Database and dedicated SQL Pool DNS aliases? 

To begin, there are a few reasons why I recommend creating a DNS alias for your Azure SQL Database and dedicated SQL Pool: 

  • In the unlikely scenario of an Azure region outage, having a DNS alias makes it easy to point to a server in another region. It also decreases complexity in your Disaster Recovery scenario (DR).  
  • In terms of migration: how many times you have been involved in the migration of an application database and had to change connection strings manually? With a DNS alias, you can minimize effort when migration applications. 
  • In any case where you want to point your application to a different server with minimal changes in configuration. 

Surprisingly, most companies (from small to large organizations) don’t create DNS aliases for their servers. 

Example Disaster Recovery: 

Example disaster recovery

A few things to take into account: 

  • DNS alias is not available in dedicated SQL Pools created in Synapse Analytics 
  • DNS alias names are global, same as the Azure SQL logical server. 

Create an Azure SQL Database and Dedicated SQL Pool DNS Alias 

Next, to create an Azure SQL Database and Synapse SQL Pool DNS alias, you can use PowerShell which takes advantage of Rest APIs. The option to create them in the Azure portal isn’t available. You need to do it programmatically.  

The following PowerShell commands are available: 

  • Get-AzSqlServerDnsAlias 
  • New-AzSqlServerDnsAlias 
  • Remove-AzSqlServerDnsAlias 
  • Set-AzSqlServerDnsAlias 

Script to Create Azure SQL Database and Dedicated SQL Pool DNS Alias 

I have created the following PowerShell script that allows you to manage your Azure SQL Database and Dedicated SQL pool DNS. With the script you can: 

  • Create a new DNS alias 
  • Move an existing DNS alias between servers 
  • Remove an existing DNS alias 

Download the configure AzSql Dns Alias script

Example Create DNS Alias: 

Configure-AzSql-DnsAlias -DnsOperation "Create" -ResourceGroupName "" -ServerName "" -DnsName ""  
Create DNS Alias

Example Move DNS Alias: 

Configure-AzSql-DnsAlias -DnsOperation "Move"  -ResourceGroupName "" -ServerName "" -DnsName "" -SubscriptionName "" -TargetResourceGroupName "" -TargetServerName ""  

Example Remove DNS Alias: 

Configure-AzSql-DnsAlias -DnsOperation "Remove" -ResourceGroupName "" -ServerName "" -DnsName ""  


In summary, I highly recommend creating DNS aliases for your Azure SQL databases and dedicated SQL pools. This provides a lot of great benefits, and the effort is minimal. 

You can use the script provided above and prepare your environment for different future scenarios, from database migrations to disaster recovery. 


In upcoming blog posts, we’ll continue to explore some of the features within Azure Services.     

Please follow Tech Talk Corner on Twitter for blog updates, virtual presentations, and more!         

As always, please leave any comments or questions below.         

comments [ 3 ]
No tags 0
3 Responses
  • Bertus
    23 . 06 . 2021

    Thanks David, thanks for providing the script as well. Would you go even further and create a alias for every app that connects to your server? For instance if a server gets busy and you want separate databases you could just restore the DB on another server and change the alias?

    Are there security implications with DNS aliases to consider?


  • Gopal Sanodiya
    10 . 08 . 2022

    Hi David,
    thanks a lot it really help.

    My question is can i create DNS alias for dedicated SQL pool as well – as i see input parameter only server name.

    My scenarios is two setup DR server at other location and i am loading backup to BCP server in some interval. though loading backup always create new SQL pool name – so i want to alias this sql pool so that application connect from latest sql pool

Do you want to leave a comment?

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

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

I agree to these terms.