%3CLINGO-SUB%20id%3D%22lingo-sub-369038%22%20slang%3D%22en-US%22%3ELesson%20Learned%20%2342%3A%20Creating%20an%20alias%20for%20my%20Azure%20SQL%20Database%20Server%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-369038%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3EFirst%20published%20on%20MSDN%20on%20Apr%2023%2C%202018%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20Today%2C%20I've%20been%20working%20on%20a%20service%20request%20very%20interesting.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20If%20you%20need%20to%20create%20an%20alias%20for%20your%20Azure%20SQL%20Server%2C%20you%20have%20the%20PowerShell%20cmdlet%20called%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fazurerm.sql%2Fnew-azurermsqlserverdnsalias%3Fview%3Dazurermps-5.7.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20New-AzureRmSqlServerDnsAlias.%20%3C%2FA%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20The%20syntax%20to%20use%20is%3A%20%3CBR%20%2F%3E%3CBLOCKQUOTE%3E%3CBR%20%2F%3E%3CP%3ELogin-AzureRmAccount%20%3CBR%20%2F%3E%20%5Bstring%5D%24SubscriptionId%20%3D%20%22xxxxxxxxxxxxxxxxxxxxx%22%20%3CBR%20%2F%3E%20%24azureCtx%20%3D%20Set-AzureRMConteXt%20-SubscriptionId%20%24SubscriptionId%20%3CBR%20%2F%3E%20New-AzureRmSqlServerDnsAlias%20-ResourceGroupname%20'Resource%20group'%20-ServerName%20myserver1%20-DnsAliasName%26nbsp%3Bmyserver12%3C%2FP%3E%3CBR%20%2F%3E%3C%2FBLOCKQUOTE%3E%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Remember%20that%20there%20is%20not%20needed%20in%20the%20servername%20and%20dnsaliasname%20parameters%20use%26nbsp%3Bthe%20domain%20.database.windows.net%20just%20only%20you%20need%20to%20specify%20the%20servername.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Enjoy!%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-369038%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Apr%2023%2C%202018%20Today%2C%20I've%20been%20working%20on%20a%20service%20request%20very%20interesting.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-369038%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAlias%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20SQL%20Database%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Enew%20azurermsqlserverdnsalias%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
First published on MSDN on Apr 23, 2018
Today, I've been working on a service request very interesting.

If you need to create an alias for your Azure SQL Server, you have the PowerShell cmdlet called: New-AzureRmSqlServerDnsAlias.

The syntax to use is:

Login-AzureRmAccount
[string]$SubscriptionId = "xxxxxxxxxxxxxxxxxxxxx"
$azureCtx = Set-AzureRMConteXt -SubscriptionId $SubscriptionId
New-AzureRmSqlServerDnsAlias -ResourceGroupname 'Resource group' -ServerName myserver1 -DnsAliasName myserver12





Remember that there is not needed in the servername and dnsaliasname parameters use the domain .database.windows.net just only you need to specify the servername.

Enjoy!