A few notes on top of the great article:
- On 64-bit OS, you have 64-bit CliConfg (C:\windows\system32\cliconfg.exe) and 32-bit CliConfg (C:\windows\syswow64\cliconfg.exe). Both persist aliases in the registry so can use Group Policy Preferences or scripting to add aliases at scale to "HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo" and "HKLM\SOFTWARE\WOW6432Node\Microsoft\MSSQLServer\Client\ConnectTo" respectively. Depending on "bitness" of the client application, it will use one registry location or the other, so it is always good to define aliases in both registry locations.
- The use of @servername in the login is not needed if the alias matches the Azure SQL DB server name. In the example above, using "yg43q8cjy" as alias instead of "MyDB" removes the need to use @yg43q8cjy in the login dialog.
- Using CNAME record in DNS pointing, following the example, "yg43q8cjy" to "yg43q8cjy.database.windows.net" also makes the trick, again without @yg43q8cjy in the login, only required if CNAME uses a different hostname.
- When using Azure AD logins, the custom alias and @servername does not work, so name has to match, and if using CNAME alias, also need TrustServerCertificate=TRUE.
2cts.