This post has been republished via RSS; it originally appeared at: Azure Database Support Blog articles.
There are couple of options available in Azure SQL Server if customer wants to connect with different name. Following option may also apply when customer uses private endpoint. This article applies to SQL DB and not all options works for MI.
1. DNS Alias
Azure SQL DB supports DNS alias as you can see in above doc. However, the created alias will not be the domain format. It can only be made up of lowercase letters 'a'-'z', the numbers 0-9 and the hyphen. For example, you can only create DNS alias with eeoc instead of eeoc.gov.
When connecting, the alias replaces the first dot-delimited node in the four node server string. For example, we can connect using eeoe.database.windows.net for my original server yxgri1g2pa.database.windows.net
Private endpoint works in this method. I tested with user as username and username@servername and both works for me.
This option will not work for MI.
2. Host file
C:\Windows\System32\drivers\etc. Edit Host file using notepad
- Connection through private endpoint
Update the host file and let it points to the privatelink IP.
- Connect through public network
Update the host file and let it points to the SQL Server gateway IP. You can also get the gateway Ip by pinging the server name.
I tested with user as username and username@servername and both works for me.
“C:\windows\syswow64\cliconfg.exe” (It has to be the 64bit version if running on 64 bit system. If you are using 32 bit system, you may try with 32 bit version of cliconfg.)
It works in both private connection or public connections.
In this method, I will have to use username@servername to connect
If I only put the username without the servername, I will get error "Cannot open server "ece.com" requested by the login. The login failed. (Microsoft SQL Server, Error: 40532)"
Update CNAME record in the DNS server.
- Connect through private endpoint
Use a private DNS zone. You can use private DNS zones to override the DNS resolution for a given private endpoint. A private DNS zone can be linked to your virtual network to resolve specific domains.
Use your custom DNS server. You can use your own DNS server to override the DNS resolution for a given private link resource. If your DNS server is hosted on a virtual network, you can create a DNS forwarding rule to use a private DNS zone to simplify the configuration for all private link resources.
With private DNS zone, steps are:
1. Create new private DNS zone.
2. Link VNET that the private endpoint belongs to.
3. Add CNAME record to yxgri1g2pa.privatelink.database.windows.net or yxgri1g2pa.database.windows.net
4. Once this is done, I am able to connect to sql (I have to use username@servername to login. Failed to connect without using @servername)
Customer should also be able to use their own DNS server to update the CNAME NAME. But I have not tested this solution.
Using DNS server to update CNAME should work for public connections too.