SQL Server – Setting Up CNAME Alias for AlwaysOn Listener

availability-groupslistenersql server

We are currently experiencing an issue with SQL Server migration. There is a legacy product and we don't want to change connection strings due to various reasons.
Thus, we would like to keep existing Listener name.

My question is, Is it possible to create one or more CNAME aliases for AG Listener Name? Is there any danger in doing this?

Best Answer

Yes you can create CNAME pointing to listener name. I have been using the same for over 100 Availability group. SQL Server version 2012, 2014, 2016 and 2017. I have been using this for close to 3 years without any issue.

Two suggestions for better manageability if you go to that route enterprise wide.

  • Write a collection of all CNAME pointing to listeners, save it in your DBA database and update periodically. That way during any migration you are not in doubt what CNAME's are pointing to a particular listener name.
  • I prefer for DBA team to have privilege to update CNAME. That way during a migration you are not dependent on someone else to make the cut over.