%3CLINGO-SUB%20id%3D%22lingo-sub-1477995%22%20slang%3D%22en-US%22%3ELesson%20Learned%20%23131%3A%20ReadScale%20Out%20and%20Failover%20Group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1477995%22%20slang%3D%22en-US%22%3E%3CP%3EToday%2C%20I%20worked%20on%20a%20service%20request%20that%20our%20customer%20wants%20to%20use%20the%20parameter%20of%20%3CSTRONG%3EApplicationIntent%3DReadyOnly%3C%2FSTRONG%3E%20to%20connect%20to%20the%20secondary%20replica%20of%20Transparent%20Failover%20Group.%20Unfortunately%2C%20it%20doesn't%20work%20because%20ApplicationIntent%20has%20other%20purpose%20for%20Azure%20SQL%20DB%20and%20Managed%20Instance%2C%20I%20would%20like%20to%20explain%20it%20below.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1)%20Remember%20that%20every%20time%20that%20you%20create%20a%20Premium%20or%20Business%20Critical%20database%20in%20Azure%20SQL%20Database%20or%20Business%20Critical%20for%20Azure%20SQL%20Managed%20Instance%26nbsp%3B%20%3CSTRONG%3Ewill%20be%20created%20two%20additional%20replicas%20that%20will%20be%20synced%20using%20AlwaysOn%20environment%3C%2FSTRONG%3E.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2)%20If%20you%20want%20to%20connect%20to%20any%20of%20these%20replicas%2C%20basically%2C%20you%20need%20to%20add%20in%20the%20connection%20string%20the%20parameter%20ApplicationIntent%3DReadonly%20-%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fdatabase%2Fread-scale-out%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fdatabase%2Fread-scale-out%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E3)%20If%20you%20have%20a%20%3CSTRONG%3ETransparent%20Failover%20Group%20defined%20and%20you%20specify%26nbsp%3BApplicationIntent%3DReadonly%3C%2FSTRONG%3E%20in%20the%20connection%20string%2C%20the%20result%20will%20be%20that%20you%20are%20going%20to%20connect%20to%20any%20replica%20of%20the%20server%20that%20is%20the%20primary%20(ReadScale%20Out)%20and%20will%20not%20routed%20to%20the%20secondary%20server.%20Let%20me%20share%20with%20you%20an%20example%3A%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EWe%20have%20two%20servers%3A%20jmserver100%20(Primary)%20and%20jmserver200%20(Secondary).%3C%2FLI%3E%0A%3CLI%3EThese%20servers%20are%20part%20of%20a%20Transparent%20failover%20group%20under%20this%20listerner%20-%20jmserver300.%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3EUsing%20SQL%20Server%20Management%20Studio%2C%20I'm%20going%20to%20connect%20to%20listener%20jmserver300%20that%20points%20to%20the%20primary%20server%20jmserver100.%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Jose_Manuel_Jurado_0-1592604325340.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F199806i135DC4E700750694%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Jose_Manuel_Jurado_0-1592604325340.png%22%20alt%3D%22Jose_Manuel_Jurado_0-1592604325340.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EUsing%20SQL%20Server%20Management%20Studio%2C%20I'm%20going%20to%20connect%20to%20listener%20jmserver300%20that%20points%20to%20the%20primary%20server%20jmserver100%20but%20I'm%20going%20to%20add%20the%20parameter%20ApplicationIntent%3DReadonly.%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Capture.PNG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F199807iE7ED0C2CC932E08B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Capture.PNG%22%20alt%3D%22Capture.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EIf%20you%20need%20to%20connect%20to%20the%20secondary%20server%20of%20this%20T%3CSTRONG%3Eransparent%20Failover%20Group%20my%20suggestion%20is%20to%20use%20the%20secondary%20FQDN%3C%2FSTRONG%3E%2C%20for%20example%2C%26nbsp%3B%20jmserver300.secondary.database.windows.net%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEnjoy!!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1477995%22%20slang%3D%22en-US%22%3E%3CP%3EToday%2C%20I%20worked%20on%20a%20service%20request%20that%20our%20customer%20wants%20to%20use%20the%20parameter%20of%20ApplicationIntent%3DReadyOnly%20to%20connect%20to%20the%20secondary%20replica%20of%20Transparent%20Failover%20Group.%20Unfortunately%2C%20it%20doesn't%20work%20because%20ApplicationIntent%20has%20other%20purpose%20for%20Azure%20SQL%20DB%20and%20Managed%20Instance.%3C%2FP%3E%3C%2FLINGO-TEASER%3E

Today, I worked on a service request that our customer wants to use the parameter of ApplicationIntent=ReadyOnly to connect to the secondary replica of Transparent Failover Group. Unfortunately, it doesn't work because ApplicationIntent has other purpose for Azure SQL DB and Managed Instance, I would like to explain it below. 

 

1) Remember that every time that you create a Premium or Business Critical database in Azure SQL Database or Business Critical for Azure SQL Managed Instance  will be created two additional replicas that will be synced using AlwaysOn environment

 

2) If you want to connect to any of these replicas, basically, you need to add in the connection string the parameter ApplicationIntent=Readonly - https://docs.microsoft.com/en-us/azure/azure-sql/database/read-scale-out

 

3) If you have a Transparent Failover Group defined and you specify ApplicationIntent=Readonly in the connection string, the result will be that you are going to connect to any replica of the server that is the primary (ReadScale Out) and will not routed to the secondary server. Let me share with you an example: 

 

  • We have two servers: jmserver100 (Primary) and jmserver200 (Secondary).
  • These servers are part of a Transparent failover group under this listerner - jmserver300. 
  • Using SQL Server Management Studio, I'm going to connect to listener jmserver300 that points to the primary server jmserver100. 

Jose_Manuel_Jurado_0-1592604325340.png

 

  • Using SQL Server Management Studio, I'm going to connect to listener jmserver300 that points to the primary server jmserver100 but I'm going to add the parameter ApplicationIntent=Readonly. 

 

Capture.PNG

  • If you need to connect to the secondary server of this Transparent Failover Group my suggestion is to use the secondary FQDN, for example,  jmserver300.secondary.database.windows.net

 

Enjoy!!