We have configured a failover group for our SQL Server Managed Instance in Azure portal:
Primary Managed Instance : myprod01.asbcdef.database.windows.net
Failover Group Name : failover-myprod01.asbcdef.database.windows.net
My current connection string(uses Primary server name):
server=tcp:myprod01.asbcdef.database.windows.net,1433;
Persist Security Info=False;Initial Catalog=Mydatabase;User Id=user;
Password=pwd;MultipleActiveResultSets=False;Encrypt=True;
TrustServerCertificate=False;Connection Timeout=30;
Which server name should I have to use in connection string to make sure failover will happen in case of any issues, is it primary server or failover group name ?
We should connect to the failover group name. So that if Primary server down, it will auto migrate to the Secondary server. Our application will run uninterrupted.