%3CLINGO-SUB%20id%3D%22lingo-sub-1792399%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Failover%20Groups%20with%20Private%20Link%20for%20Azure%20SQL%20Database%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1792399%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F179056%22%20target%3D%22_blank%22%3E%40Rohit%20Nayak%3C%2FA%3E%26nbsp%3BThank%20you%20for%20this%20blog.%20Can%20you%20please%20help%20shed%20some%20light%20on%20how%20the%20connection%20string%20will%20look%20like%20in%20this%20scenario%20where%20we%20have%20private%20endpoints%20and%20Azure%20Failover%20Group%3A-%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20have%20an%20ASP.Net%20Web%20app%20hosted%20as%20Azure%20App%20serivce%20connecting%20to%20Azure%20SQL%20Server.%20We%20have%202%20Azure%20SQL%20Server%20one%20in%20North%20and%20other%20in%20South%20region%20(For%20Failover).%20We%20have%20created%20Private%20endpoints%20for%20both%20the%20sql%20servers%3A-%3C%2FP%3E%3CPRE%3ENorthRegion-devxxxs-sql-server.database.windows.net%0ASouthRegion-devxxxs-sql-server.database.windows.net%3C%2FPRE%3E%3CP%3EFollowing%20is%20the%20Read%2FWrite%20listener%20endpoint%20from%20Failover%20group%3A-%3C%2FP%3E%3CPRE%3EXXXXX-devxxxxs-failovergroup.database.windows.net%3C%2FPRE%3E%3CP%3ENorth%20is%20Primary%20and%20South%20is%20secondary%20and%20they%20are%20added%20to%20Failover%20group.%20AsP.Net%20Web%20app%20connection%20string%20uses%20private%20endpoint%20to%20North%20Region%20SQL%20Server%20as%20follows%3A-%3C%2FP%3E%3CPRE%3E%20%20%26lt%3Badd%20name%3D%22xxxxxxxx%22%20connectionString%3D%22Data%20Source%3Dtcp%3ANorthRegion-devxxxs-sql-server.database.windows.net%2C1433%3BInitial%20Catalog%3Ddtasbasename%3BPersist%20Security%20Info%3DFalse%3BUser%20ID%3DAdmin%3BPassword%3DYYYYYY%3BMultipleActiveResultSets%3DFalse%3BEncrypt%3DTrue%3BTrustServerCertificate%3DFalse%3BConnection%20Timeout%3D30%3B%22%20providerName%3D%22System.Data.SqlClient%22%20%2F%26gt%3B%3C%2FPRE%3E%3CP%3EWe%20did%20a%20Failover%20test%20and%20SQL%20Server%20were%20switched%20as%20South%20primary%20and%20North%20secondary%20but%20our%20suspicion%20was%20its%20still%20connecting%20to%20North%20region%20database%20due%20to%20pvt%20endpoint%20so%20for%20testing%20we%20delted%20north%20region%20database%20and%20we%20got%20runtime%20exception.%3C%2FP%3E%3CP%3EThen%20I%20changed%20my%20connection%20string%20to%20use%20the%20READ%2FWRITE%20Listner%20and%20this%20is%20how%20my%20connection%20string%20looked%20(same%20user%20id%20and%20password)%20and%20still%20we%20got%20runtime%20exception%20%3A%20Cannot%20connect%20to%20the%20database.%20following%20was%20the%20modified%20connection%20string%20using%20the%20listener%20endpoint%20from%20failover%20group%3A-%3C%2FP%3E%3CPRE%3E%26lt%3Badd%20name%3D%22xxxxxxxx%22%20connectionString%3D%22Data%20Source%3Dtcp%3AXXXXX-devxxxxs-failovergroup.database.windows.net%2C1433%3BInitial%20Catalog%3Ddtasbasename%3BPersist%20Security%20Info%3DFalse%3BUser%20ID%3DAdmin%3BPassword%3DYYYYYY%3BMultipleActiveResultSets%3DFalse%3BEncrypt%3DTrue%3BTrustServerCertificate%3DFalse%3BConnection%20Timeout%3D30%3B%22%20providerName%3D%22System.Data.SqlClient%22%20%2F%26gt%3B%3C%2FPRE%3E%3CP%3EMy%20question%20here%20is%20what%20should%20the%20connection%20string%20look%20like%20in%20this%20scenario%20where%20I%20have%202%20SQL%20Servers%20in%202%20different%20regions%20with%20Private%20EndPoints%20and%20in%20the%20Failover%20group.%20I%20am%20not%20sure%20about%20what%20should%20be%20the%20Database%20Server%20name%20that%20goes%20in%20web.config%20connection%20string%20so%20that%20it%20can%20automatically%20connect%20to%20the%20Secondary%20Server%20if%20Primary%20Server%20goes%20down.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1796087%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Failover%20Groups%20with%20Private%20Link%20for%20Azure%20SQL%20Database%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1796087%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F836245%22%20target%3D%22_blank%22%3E%40KMS2222%3C%2FA%3E%26nbsp%3BThe%20connection%20string%20remains%20unchanged.%20All%20we%20are%20doing%20is%20ensure%20that%20failover%20groups%20rely%20on%20the%20Private%20DNS%20Zone%20to%20resolve%20to%20primary%20or%20secondary.%20In%20your%20case%2C%20is%20the%20App%20Service%20deployed%20inside%20the%20same%20(%20or%20peered%20)%20VNET%20using%20ASE%3F%20Secondly%20all%20the%20VNETs%20involved%20should%20be%20covered%20in%20a%20single%20DNS%20Zone%20so%20that%20the%20DNS%20resolution%20to%20private%20endpoints%20works%20as%20expected.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1796132%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Failover%20Groups%20with%20Private%20Link%20for%20Azure%20SQL%20Database%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1796132%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F836245%22%20target%3D%22_blank%22%3E%40KMS2222%3C%2FA%3E%26nbsp%3B%20Adding%20private%20endpoint%20in%20the%20mix%20does%20nothing%20to%20change%20the%20connection%20string.%20You%20setup%20connection%20string%20exactly%20as%20mentioned%20in%20our%20failover%20group%20docs%20-%20which%20if%20I%20remember%20correctly%20tell%20you%20to%20use%20the%20failover%20group%20listener%20(%20but%20please%20double%20check%20).%20I'd%20suggest%20opening%20a%20support%20case%20to%20narrow%20this%20down%20further%20and%20get%20to%20the%20root%20cause.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1796090%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Failover%20Groups%20with%20Private%20Link%20for%20Azure%20SQL%20Database%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1796090%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F179056%22%20target%3D%22_blank%22%3E%40Rohit%20Nayak%3C%2FA%3E%26nbsp%3BThank%20you%2C%20so%20in%20the%20connection%20string%20should%20we%20be%20using%20the%20Failovergroup%20Listener%20or%20the%20Private%20End%20point%20of%20the%20SQL%3F%3C%2FP%3E%3CP%3EIn%20my%20case%20SQL1%2C%20App%20Service%20both%20are%20in%20the%20same%20region%20VNet%20(NC)%20and%20the%20SQ2%20failover%20is%20in%20the%20SC%20(Different%20Vnet%2FSubnet)%20but%20all%20of%20them%20in%20the%20same%20Private%20DNS%20Zone.%20Right%20now%20even%20after%20keeping%20the%20NC%20as%20primary%20and%20connection%20string%20using%20the%20Failover%20Listener%20its%20not%20working%20so%20I%20am%20confused%20as%20to%20what%20is%20missing%20here.%20NSlookup%20resolves%20the%20failovergroup%20link%20to%20the%20primary%20SQL%20from%20the%20App%20Service%20Kudu%20but%20when%20I%20try%20to%20open%20the%20app%20it%20complains%20with%20cant%20connect%20to%20the%20database%20(%20I%20am%20using%20the%20failover%20Read%2FWriter%20Listener%20endpoint%20in%20the%20connection%20string)%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22KMS2222_0-1603123066270.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F227734i1661CCCD1FAEDEBC%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22KMS2222_0-1603123066270.png%22%20alt%3D%22KMS2222_0-1603123066270.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1272902%22%20slang%3D%22en-US%22%3EUsing%20Failover%20Groups%20with%20Private%20Link%20for%20Azure%20SQL%20Database%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1272902%22%20slang%3D%22en-US%22%3E%3CP%3E%3CEM%3EReviewers%3A-%20Abdul%20Sathar%20Sait%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3EAzure%20SQL%20Database%20offers%20the%20ability%20to%20manage%20geo%20replication%20and%20failover%20of%20a%20group%20of%20databases%20by%20adding%20them%20into%20failover%20group.%26nbsp%3B%20A%20failover%20group%20spans%20two%20servers%20%E2%80%93%20a%20primary%20server%20where%20the%20databases%20are%20accessed%20by%20the%20end%20user%20or%20application%20%26amp%3B%20a%20secondary%20server%20in%20a%20different%20region%20where%20a%20copy%20of%20each%20database%20is%20kept%20in%20sync%20using%20active%20geo-replication.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWith%20Private%20Link%2C%20we%20are%20offering%20the%20ability%20to%20associate%20a%20logical%20server%20to%20a%20specific%20private%20IP%20address%20(called%20a%20private%20endpoint)%20within%20the%20Vnet(%26amp%3B%20subnet).%20This%20blog%20outlines%20how%20Failover%20Groups%20can%20be%20implemented%20using%20private%20endpoint%20for%20SQL%20Database%20instead%20of%20the%20public%20endpoint%20thus%20ensuring%20that%20customers%20can%20get%20security%20benefits%20that%20it%20offers%20as%20outlined%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsql-database%2Fsql-database-private-endpoint-overview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAt%20a%20very%20high%20level%20you%20need%20to%20do%20the%20following%20steps%20to%20accomplish%20this%3C%2FP%3E%0A%3CP%3E1.%20Start%20by%20picking%20a%20list%20of%20DR%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fbest-practices-availability-paired-regions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Epaired%20regions%3C%2FA%3E%20where%20you%20will%20host%20the%20primary%20and%20secondary%20servers%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2.%20Create%20Vnets%2Fsubnets%20to%20host%20private%20endpoints%20for%20primary%20and%20secondary%20servers%20and%20make%20sure%20that%20they%20do%20not%20have%20overlapping%20IP%20address%20spaces.%20I.e.%20if%20the%20primary%20Vnet%20is%2010.0.0.0%2F16%20and%20the%20secondary%20is%2010.0.0.1%2F16%20these%20are%20overlapping.%20To%20understand%20more%20about%20how%20Vnet%20ranges%20are%20specified%20in%20Azure%20refer%20to%20%3CA%20href%3D%22https%3A%2F%2Fdevblogs.microsoft.com%2Fpremier-developer%2Funderstanding-cidr-notation-when-designing-azure-virtual-networks-and-subnets%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ethis%20blog%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E3.%20Create%20private%20endpoints%20for%20primary%20and%20secondary%20servers%20so%20that%20they%20can%20communicate%20with%20each%20other%20via%20a%20shared%20Azure%20Private%20DNS%20Zone.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ea)%20Create%20a%20private%20endpoint(PE)%20%2B%20Azure%20Private%20DNS%20Zone%20for%20the%20primary%20from%20the%20Portal%20per%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fprivate-link%2Fcreate-private-endpoint-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fprivate-link%2Fcreate-private-endpoint-portal%3C%2FA%3E.%20At%20the%20end%20of%20this%20process%20you%20should%20see%20a%20single%20entry%20in%20the%20DNS%20zone%20that%20refers%20to%20the%20primary%20SQL%20Database%20(as%20shown%20in%20the%20screenshot%20below)%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22fog1.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F182438i09D706DE158D6B76%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22fog1.jpg%22%20alt%3D%22fog1.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eb)%20Create%20a%20PE%20for%20the%20secondary%20via%20the%20Portal%20but%20choose%20to%20reuse%20the%20same%20Private%20DNS%20Zone%20that%20was%20created%20for%20the%20primary.%26nbsp%3B%20At%20the%20end%20of%20this%20process%20you%20will%20have%20two%20entries%20in%20the%20DNS%20Zone%20%E2%80%93%20one%20for%20primary%20and%20another%20for%20secondary%20SQL%20Database%20(as%20shown%20in%20the%20screenshot%20below)%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22fog2.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F182439i0BC32814F9CFCCC6%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22fog2.jpg%22%20alt%3D%22fog2.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E4.%20After%20both%20Private%20endpoints%20are%20setup%20(as%20shown%20above)%2C%20you%20can%20create%20a%20new%20Failover%20Group%20just%20like%20before%2C%20using%20the%20Azure%20portal%20as%20described%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsql-database%2Fsql-database-configure-failover-group%3Ftabs%3Dazure-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%20or%20using%20PowerShell%20script%20as%20described%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsql-database%2Fscripts%2Fsql-database-add-single-db-to-failover-group-powershell%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20summary%2C%20this%20quick%20blog%20post%20shows%20you%20how%20to%20get%20started%20with%20using%20failover%20groups%20and%20Private%20link%20for%20Azure%20SQL%20Database.%20We%20hope%20you%20find%20this%20useful%20and%20look%20forward%20to%20your%20feedback.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1272902%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20blog%20outlines%20how%20Failover%20Groups%20can%20be%20implemented%20using%20private%20endpoint%20for%20SQL%20Database%20instead%20of%20the%20public%20endpoint.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1272902%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20SQL%20Security%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1988320%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Failover%20Groups%20with%20Private%20Link%20for%20Azure%20SQL%20Database%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1988320%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F179056%22%20target%3D%22_blank%22%3E%40Rohit%20Nayak%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F836245%22%20target%3D%22_blank%22%3E%40KMS2222%3C%2FA%3E%26nbsp%3BHello%20is%20there%20any%20documentation%20or%20tutorials%20you%20can%20share.%20We%20are%20planning%20to%20do%20the%20azure%20fail%20over%20group%20for%20sql%20server%20database.%20Initially%20we%20have%20been%20using%20the%20failover%20group%20with%20the%20public%20addrees%20whichh%20has%20been%20shared%20on%20the%20read-write%20listener%20endpoint.%20We%20have%20been%20asked%20to%20use%20the%20private%20endpoints%20for%20the%20sql%20server.%20In%20this%20case%20we%20are%20not%20able%20to%20find%20any%20documentation%20or%20tutorials%20how%20to%20implement%20the%20failover%20group.%20i%20can%20see%20only%20this%20forum.%20Please%20help%20us%20in%20sharing%20any%20useful%20docs.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

Reviewers:- Abdul Sathar Sait

Azure SQL Database offers the ability to manage geo replication and failover of a group of databases by adding them into failover group.  A failover group spans two servers – a primary server where the databases are accessed by the end user or application & a secondary server in a different region where a copy of each database is kept in sync using active geo-replication.

 

With Private Link, we are offering the ability to associate a logical server to a specific private IP address (called a private endpoint) within the Vnet(& subnet). This blog outlines how Failover Groups can be implemented using private endpoint for SQL Database instead of the public endpoint thus ensuring that customers can get security benefits that it offers as outlined here.  

 

At a very high level you need to do the following steps to accomplish this

1. Start by picking a list of DR paired regions where you will host the primary and secondary servers

 

2. Create Vnets/subnets to host private endpoints for primary and secondary servers and make sure that they do not have overlapping IP address spaces. I.e. if the primary Vnet is 10.0.0.0/16 and the secondary is 10.0.0.1/16 these are overlapping. To understand more about how Vnet ranges are specified in Azure refer to this blog

 

3. Create private endpoints for primary and secondary servers so that they can communicate with each other via a shared Azure Private DNS Zone.

 

a) Create a private endpoint(PE) + Azure Private DNS Zone for the primary from the Portal per https://docs.microsoft.com/azure/private-link/create-private-endpoint-portal. At the end of this process you should see a single entry in the DNS zone that refers to the primary SQL Database (as shown in the screenshot below)

fog1.jpg

 

b) Create a PE for the secondary via the Portal but choose to reuse the same Private DNS Zone that was created for the primary.  At the end of this process you will have two entries in the DNS Zone – one for primary and another for secondary SQL Database (as shown in the screenshot below)

fog2.jpg

 

4. After both Private endpoints are setup (as shown above), you can create a new Failover Group just like before, using the Azure portal as described here or using PowerShell script as described here

 

In summary, this quick blog post shows you how to get started with using failover groups and Private link for Azure SQL Database. We hope you find this useful and look forward to your feedback.

5 Comments
Visitor

@Rohit Nayak Thank you for this blog. Can you please help shed some light on how the connection string will look like in this scenario where we have private endpoints and Azure Failover Group:-

 

We have an ASP.Net Web app hosted as Azure App serivce connecting to Azure SQL Server. We have 2 Azure SQL Server one in North and other in South region (For Failover). We have created Private endpoints for both the sql servers:-

NorthRegion-devxxxs-sql-server.database.windows.net
SouthRegion-devxxxs-sql-server.database.windows.net

Following is the Read/Write listener endpoint from Failover group:-

XXXXX-devxxxxs-failovergroup.database.windows.net

North is Primary and South is secondary and they are added to Failover group. AsP.Net Web app connection string uses private endpoint to North Region SQL Server as follows:-

  <add name="xxxxxxxx" connectionString="Data Source=tcp:NorthRegion-devxxxs-sql-server.database.windows.net,1433;Initial Catalog=dtasbasename;Persist Security Info=False;User ID=Admin;Password=YYYYYY;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" providerName="System.Data.SqlClient" />

We did a Failover test and SQL Server were switched as South primary and North secondary but our suspicion was its still connecting to North region database due to pvt endpoint so for testing we delted north region database and we got runtime exception.

Then I changed my connection string to use the READ/WRITE Listner and this is how my connection string looked (same user id and password) and still we got runtime exception : Cannot connect to the database. following was the modified connection string using the listener endpoint from failover group:-

<add name="xxxxxxxx" connectionString="Data Source=tcp:XXXXX-devxxxxs-failovergroup.database.windows.net,1433;Initial Catalog=dtasbasename;Persist Security Info=False;User ID=Admin;Password=YYYYYY;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" providerName="System.Data.SqlClient" />

My question here is what should the connection string look like in this scenario where I have 2 SQL Servers in 2 different regions with Private EndPoints and in the Failover group. I am not sure about what should be the Database Server name that goes in web.config connection string so that it can automatically connect to the Secondary Server if Primary Server goes down.

Microsoft

@KMS2222 The connection string remains unchanged. All we are doing is ensure that failover groups rely on the Private DNS Zone to resolve to primary or secondary. In your case, is the App Service deployed inside the same ( or peered ) VNET using ASE? Secondly all the VNETs involved should be covered in a single DNS Zone so that the DNS resolution to private endpoints works as expected.

Visitor

@Rohit Nayak Thank you, so in the connection string should we be using the Failovergroup Listener or the Private End point of the SQL?

In my case SQL1, App Service both are in the same region VNet (NC) and the SQ2 failover is in the SC (Different Vnet/Subnet) but all of them in the same Private DNS Zone. Right now even after keeping the NC as primary and connection string using the Failover Listener its not working so I am confused as to what is missing here. NSlookup resolves the failovergroup link to the primary SQL from the App Service Kudu but when I try to open the app it complains with cant connect to the database ( I am using the failover Read/Writer Listener endpoint in the connection string)

KMS2222_0-1603123066270.png

 

Microsoft

@KMS2222  Adding private endpoint in the mix does nothing to change the connection string. You setup connection string exactly as mentioned in our failover group docs - which if I remember correctly tell you to use the failover group listener ( but please double check ). I'd suggest opening a support case to narrow this down further and get to the root cause.

Occasional Visitor

@Rohit Nayak @KMS2222 Hello is there any documentation or tutorials you can share. We are planning to do the azure fail over group for sql server database. Initially we have been using the failover group with the public addrees whichh has been shared on the read-write listener endpoint. We have been asked to use the private endpoints for the sql server. In this case we are not able to find any documentation or tutorials how to implement the failover group. i can see only this forum. Please help us in sharing any useful docs.