Should we have to use Failover Group server name or Primary server name in SQL Server managed instance connection string

366 views Asked by At

We have configured a failover group for our SQL Server Managed Instance in Azure portal:

enter image description here

  • 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 ?

1

There are 1 answers

1
Joseph  Xu On BEST ANSWER

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.