%3CLINGO-SUB%20id%3D%22lingo-sub-1992389%22%20slang%3D%22en-US%22%3EReplication%20configuration%20between%20Managed%20Instance%20and%20On-premises%20common%20issues%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1992389%22%20slang%3D%22en-US%22%3E%3CP%3EConfiguring%20transactional%20replication%20with%20Azure%20SQL%20Managed%20Instance%20there%20are%20some%20limitations%20that%20we%20need%20to%20take%20into%20consideration.%20One%20of%20them%20is%20that%20both%20the%20publisher%20and%20distributor%20need%20to%20be%20placed%20either%20on%20Managed%20Instance%20or%20on%20the%20on-premises%20server.%20The%20other%20requirements%20can%20be%20found%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fmanaged-instance%2Freplication-transactional-overview%23requirements%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ehere.%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20docs%20there%20are%20already%20covered%20two%20types%20of%20topologies%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fmanaged-instance%2Freplication-between-two-instances-configure-tutorial%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20SQL%20Managed%20Instance%20Publisher%2C%20Distributor%20and%20Subscriber%3C%2FA%3E%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fmanaged-instance%2Freplication-two-instances-and-sql-server-configure-tutorial%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20SQL%20Managed%20Instance%20Publisher%20and%20Distributor%2C%20Azure%20SQL%20VM%20Subscriber%3C%2FA%3E%26nbsp%3B%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EIn%20this%20article%20we%20will%20focus%20more%20on%20the%20scenario%20in%20which%20instead%20of%20a%20Azure%20SQL%20VM%20Subscriber%2C%20we%20will%20have%20an%20on-premises%20Subscriber.%20Being%20similar%20to%20the%20second%20above%20topology%20type%20the%20steps%20will%20also%20be%20alike%2C%20after%20configuring%20the%20on-premises%20and%20Managed%20Instance%20servers%20we%20need%20to%20do%20the%20following%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fmanaged-instance%2Freplication-two-instances-and-sql-server-configure-tutorial%23create-an-azure-storage-account%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3ECreate%20an%20Azure%20storage%20account%3C%2FA%3E%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fmanaged-instance%2Freplication-two-instances-and-sql-server-configure-tutorial%23create-a-database%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3ECreate%20a%20database%3C%2FA%3E%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fmanaged-instance%2Freplication-two-instances-and-sql-server-configure-tutorial%23configure-distribution%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EConfigure%20distribution%3C%2FA%3E%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fmanaged-instance%2Freplication-two-instances-and-sql-server-configure-tutorial%23configure-distribution%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3ECreate%20the%20publication%3C%2FA%3E%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAfter%20that%20comes%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fmanaged-instance%2Freplication-two-instances-and-sql-server-configure-tutorial%23create-the-subscription%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ecreate%20subscription%20%3C%2FA%3E%26nbsp%3Bstep%20where%20the%20difference%20will%20be%20in%20the%26nbsp%3B%40subscriber%20parameter.%20For%20an%20on-premises%20subscriber%20we%20will%20not%20need%20a%20private%20DNS%20zone%20so%20the%20syntax%20will%20be%20similar%20to%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3Euse%20%5BReplTutorial%5D%0Aexec%20sp_addsubscription%0A%40publication%20%3D%20N'ReplTest'%2C%0A%40subscriber%20%3D%20N'OnPremServerName'%2C%0A%40destination_db%20%3D%20N'ReplSub'%2C%0A%40subscription_type%20%3D%20N'Push'%2C%0A%40sync_type%20%3D%20N'automatic'%2C%0A%40article%20%3D%20N'all'%2C%0A%40update_mode%20%3D%20N'read%20only'%2C%0A%40subscriber_type%20%3D%200%0A%0Aexec%20sp_addpushsubscription_agent%0A%40publication%20%3D%20N'ReplTest'%2C%0A%40subscriber%20%3D%20N'OnPremServerName'%2C%0A%40subscriber_db%20%3D%20N'ReplSub'%2C%0A%40job_login%20%3D%20N'azureuser'%2C%0A%40job_password%20%3D%20'%3CCOMPLEX%20password%3D%22%22%3E'%2C%0A%40subscriber_security_mode%20%3D%200%2C%0A%40subscriber_login%20%3D%20N'azureuser'%2C%0A%40subscriber_password%20%3D%20'%3CCOMPLEX%20password%3D%22%22%3E'%2C%0A%40dts_package_location%20%3D%20N'Distributor'%0AGO%3C%2FCOMPLEX%3E%3C%2FCOMPLEX%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ECommon%20issues%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EFailed%20to%20connect%20to%20Azure%20Storage%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CEM%3E2019-11-19%2002%3A21%3A05.07%20Obtained%20Azure%20Storage%20Connection%20String%20for%20replstorage%202019-11-19%2002%3A21%3A05.07%20Connecting%20to%20Azure%20Files%20Storage%20'%5Creplstorage.file.core.windows.net%5Creplshare'%202019-11-19%2002%3A21%3A31.21%20Failed%20to%20connect%20to%20Azure%20Storage%20''%20with%20OS%20error%3A%2053.%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ERecommendations%3C%2FSTRONG%3E%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E-%20Ensure%20that%20the%20port%20445%20is%20open%20in%20the%20outbound%20security%20rules%20of%20the%20Network%20Security%20Group%20(NSG)%20that%20your%20Managed%20Instance%20is%20using%3C%2FP%3E%0A%3CP%3E-%20Check%20Distributor%20properties%20as%20below%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERight-click%20on%20Local%20Publications%20and%20access%20Distributor%20properties%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202020-12-16%20102809.png%22%20style%3D%22width%3A%20200px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F240980i6EF49368A703DE9F%2Fimage-size%2Fsmall%3Fv%3D1.0%26amp%3Bpx%3D200%22%20role%3D%22button%22%20title%3D%22Screenshot%202020-12-16%20102809.png%22%20alt%3D%22Screenshot%202020-12-16%20102809.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAfter%20that%20access%20the%20Publishers%20page%20and%20press%20on%20the%20below%20highlighted%20area%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202020-12-16%20102926.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F240983iC27204692177A3FF%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Screenshot%202020-12-16%20102926.png%22%20alt%3D%22Screenshot%202020-12-16%20102926.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAfter%20that%20you%20should%20have%20a%20window%20similar%20to%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202020-12-16%20103114.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F240984i56CEFF5F9D717C3F%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Screenshot%202020-12-16%20103114.png%22%20alt%3D%22Screenshot%202020-12-16%20103114.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EIn%20here%20please%20check%20that%20the%20Default%20Snapshot%20Folder%20is%20in%20the%20correct%20format%20and%20for%20the%20Storage%20Account%20Connection%20String%20you%20can%20also%20re-enter%20it%20here%20from%20here%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202020-12-16%20103224.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F240985iE323AD24022E3184%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202020-12-16%20103224.png%22%20alt%3D%22Screenshot%202020-12-16%20103224.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMore%20details%20on%20this%20error%20are%20accessible%20here%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fmanaged-instance%2Freplication-two-instances-and-sql-server-configure-tutorial%23failed-to-connect-to-azure-storage%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EFailed%20to%20connect%20to%20Azure%20Storage.%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3ECould%20not%20connect%20to%20Subscriber%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%3CI%3EError%20messages%3A%3C%2FI%3E%3CI%3E%3CSPAN%20style%3D%22font-size%3A%2010.5pt%3B%20font-family%3A%20'Segoe%20UI'%2Csans-serif%3B%22%3E%3CBR%20%2F%3EThe%20process%20could%20not%20connect%20to%20Subscriber%20'REPLMITOVM.REPLDNS.COM'.%20(Source%3A%20MSSQL_REPL%2C%20Error%20number%3A%20MSSQL_REPL0)%3CBR%20%2F%3EGet%20help%3A%20%3C%2FSPAN%3E%3C%2FI%3E%3CA%20title%3D%22http%3A%2F%2Fhelp%2Fmssql_repl0%22%20href%3D%22http%3A%2F%2Fhelp%2FMSSQL_REPL0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CI%3Ehttp%3A%2F%2Fhelp%2FMSSQL_REPL0%3C%2FI%3E%3C%2FA%3E%3CI%3E%3CSPAN%20style%3D%22font-size%3A%2010.5pt%3B%20font-family%3A%20'Segoe%20UI'%2Csans-serif%3B%22%3E%3CBR%20%2F%3ENamed%20Pipes%20Provider%3A%20Could%20not%20open%20a%20connection%20to%20SQL%20Server%20%5B53%5D.%20(Source%3A%20MSSQLServer%2C%20Error%20number%3A%2053)%3CBR%20%2F%3EGet%20help%3A%20%3C%2FSPAN%3E%3C%2FI%3E%3CA%20title%3D%22http%3A%2F%2Fhelp%2F53%22%20href%3D%22http%3A%2F%2Fhelp%2F53%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CI%3Ehttp%3A%2F%2Fhelp%2F53%3C%2FI%3E%3C%2FA%3E%3CI%3E%3CSPAN%20style%3D%22font-size%3A%2010.5pt%3B%20font-family%3A%20'Segoe%20UI'%2Csans-serif%3B%22%3E%3CBR%20%2F%3EA%20network-related%20or%20instance-specific%20error%20has%20occurred%20while%20establishing%20a%20connection%20to%20SQL%20Server.%20Server%20is%20not%20found%20or%20not%20accessible.%20Check%20if%20instance%20name%20is%20correct%20and%20if%20SQL%20Server%20is%20configured%20to%20allow%20remote%20connections.%20For%20more%20information%20see%20SQL%20Server%20Books%20Online.%20(Source%3A%20MSSQLServer%2C%20Error%20number%3A%2053)%3CBR%20%2F%3EGet%20help%3A%20%3C%2FSPAN%3E%3C%2FI%3E%3CA%20title%3D%22http%3A%2F%2Fhelp%2F53%22%20href%3D%22http%3A%2F%2Fhelp%2F53%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CI%3Ehttp%3A%2F%2Fhelp%2F53%3C%2FI%3E%3C%2FA%3E%3CI%3E%3CSPAN%20style%3D%22font-size%3A%2010.5pt%3B%20font-family%3A%20'Segoe%20UI'%2Csans-serif%3B%22%3E%3CBR%20%2F%3EQuery%20timeout%20expired%2C%20Failed%20Command%3A%20(Source%3A%20MSSQLServer%2C%20Error%20number%3A%20HYT00)%3CBR%20%2F%3EGet%20help%3A%20%3C%2FSPAN%3E%3C%2FI%3E%3CA%20title%3D%22http%3A%2F%2Fhelp%2Fhyt00%22%20href%3D%22http%3A%2F%2Fhelp%2FHYT00%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CI%3Ehttp%3A%2F%2Fhelp%2FHYT00%3C%2FI%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%3CSTRONG%3ERecommendations%3C%2FSTRONG%3E%3A%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E-%20Ensure%20that%20the%20port%201433%20is%20open%20in%20the%20outbound%20security%20rules%20of%20the%20Managed%20Instance%20NSG%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E-%20As%20an%20alternative%20to%20T-SQL%20script%20mentioned%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fmanaged-instance%2Freplication-two-instances-and-sql-server-configure-tutorial%23create-the-subscription%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E%26nbsp%3Byou%20can%20also%20add%20the%20subscription%20directly%20from%20the%20GUI%20of%20SSMS%3A%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3ERight-click%20on%20the%20publication%20and%20click%20New%20Subscriptions%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202020-12-16%20103751.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F240987i1741BFF24DE51B20%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Screenshot%202020-12-16%20103751.png%22%20alt%3D%22Screenshot%202020-12-16%20103751.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3EClick%20Next%2C%20select%20the%20publication%20name%20and%20click%20Next%2C%20Run%20all%20agents%20at%20the%20Distributor%2C%20Add%20SQL%20Server%20Subscriber%3A%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202020-12-16%20103932.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F240988iEDC301F9F9F7F57A%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Screenshot%202020-12-16%20103932.png%22%20alt%3D%22Screenshot%202020-12-16%20103932.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3EHere%20we%20will%20need%20to%20connect%20to%20the%20on-premises%20server%20with%20SQL%20Authentication%20as%20mentioned%20in%20the%20first%20part%20of%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fmanaged-instance%2Freplication-transactional-overview%23requirements%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Erequirements.%3C%2FA%3E%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3EAfter%20the%20subscription%20was%20added%20click%20on%20the%20highlighted%20area%20below%3A%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202020-12-16%20104536.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F240991iAB7299D4FA881782%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Screenshot%202020-12-16%20104536.png%22%20alt%3D%22Screenshot%202020-12-16%20104536.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3EOn%20the%20top%20part%20use%20login%20that%20you%20are%20using%20for%20the%20distributor%20(SQL%20login%20that%20you%20are%20accessing%20the%20Azure%20SQL%20Managed%20Instance)%20and%20on%20the%20bottom%20part%20of%20the%20window%20enter%20the%20SQL%20login%20used%20previously%20to%20access%20the%20on-premises%20server.%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3EAfter%20that%20you%20can%20leave%20the%20Synchronization%20Schedule%20together%20with%20the%20Initialize%20Subscription%20steps%20as%20default%20and%20Finish%20the%20New%20Subscription%20Wizard.%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3EAs%20a%20short%20summary%20the%20recommendations%20for%20the%20Could%20not%20Connect%20to%20Subscriber%20error%20would%20be%3A%3C%2FP%3E%0A%3CP%20class%3D%22xxxxmsonormal%22%20style%3D%22margin%3A%200in%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%20class%3D%22xxxxmsonormal%22%3EEnsure%20that%20the%20port%201433%20is%20open%20and%20that%20the%20other%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fmanaged-instance%2Freplication-transactional-overview%23requirements%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Erequirements%3C%2FA%3E%26nbsp%3Bare%20met%3C%2FLI%3E%0A%3CLI%20class%3D%22xxxxmsonormal%22%3ETry%20as%20an%20alternative%20to%20add%20the%20subscription%20with%20SSMS%3C%2FLI%3E%0A%3CLI%20class%3D%22xxxxmsonormal%22%3E%3CSPAN%3EProvide%20the%20IP%20address%20of%20the%20on-premises%20server%20in%20the%20sp_addsubscription%20stored%20procedure%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20class%3D%22xxxxmsonormal%22%3E%3CSPAN%3ECheck%20if%20the%26nbsp%3B%40%40SERVERNAME%20is%20the%20same%20with%26nbsp%3BSERVERPROPERTY(N'servername')%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3ESELECT%20SERVERPROPERTY(N'servername')%0ASELECT%20%40%40SERVERNAME%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20the%20results%20are%20different%20this%20can%20be%20fixed%20by%20using%20this%20script%3A%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3EDECLARE%20%40actualname%20NVARCHAR(100)%0ADECLARE%20%40currentname%20NVARCHAR(100)%0ASELECT%20%40actualname%20%3D%20CONVERT(NVARCHAR(100)%2C%20SERVERPROPERTY(N'servername'))%0ASELECT%20%40currentname%20%3D%20%40%40SERVERNAME%0AEXEC%20sp_dropserver%20%40currentname%0AEXEC%20sp_addserver%20%40actualname%2C%20local%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EReference%20article%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fblog.sqlauthority.com%2F2015%2F09%2F18%2Fsql-server-fix-replication-error-sql-server-replication-requires-the-actual-server-name-to-make-a-connection-to-the-server%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3ESQL%20SERVER%20%E2%80%93%20FIX%20%E2%80%93%20Replication%20Error%3A%20SQL%20Server%20replication%20requires%20the%20actual%20server%20name%20to%20make%20a%20connection%20to%20the%20server%20%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMore%20details%20about%20the%20Could%20not%20connect%20to%20Subscriber%20error%20can%20also%20be%20found%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fmanaged-instance%2Freplication-two-instances-and-sql-server-configure-tutorial%23failed-to-connect-to-azure-storage%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1992389%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202020-12-16%20094336.png%22%20style%3D%22width%3A%20200px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F240976i138C264DDCD57C1E%2Fimage-size%2Fsmall%3Fv%3D1.0%26amp%3Bpx%3D200%22%20role%3D%22button%22%20title%3D%22Screenshot%202020-12-16%20094336.png%22%20alt%3D%22Screenshot%202020-12-16%20094336.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E

Configuring transactional replication with Azure SQL Managed Instance there are some limitations that we need to take into consideration. One of them is that both the publisher and distributor need to be placed either on Managed Instance or on the on-premises server. The other requirements can be found here.

 

In the docs there are already covered two types of topologies:

 

  1. Azure SQL Managed Instance Publisher, Distributor and Subscriber 
  2. Azure SQL Managed Instance Publisher and Distributor, Azure SQL VM Subscriber 

In this article we will focus more on the scenario in which instead of a Azure SQL VM Subscriber, we will have an on-premises Subscriber. Being similar to the second above topology type the steps will also be alike, after configuring the on-premises and Managed Instance servers we need to do the following:

 

 

After that comes the create subscription  step where the difference will be in the @subscriber parameter. For an on-premises subscriber we will not need a private DNS zone so the syntax will be similar to this:

 

 

 

use [ReplTutorial]
exec sp_addsubscription
@publication = N'ReplTest',
@subscriber = N'OnPremServerName',
@destination_db = N'ReplSub',
@subscription_type = N'Push',
@sync_type = N'automatic',
@article = N'all',
@update_mode = N'read only',
@subscriber_type = 0

exec sp_addpushsubscription_agent
@publication = N'ReplTest',
@subscriber = N'OnPremServerName',
@subscriber_db = N'ReplSub',
@job_login = N'azureuser',
@job_password = '<Complex Password>',
@subscriber_security_mode = 0,
@subscriber_login = N'azureuser',
@subscriber_password = '<Complex Password>',
@dts_package_location = N'Distributor'
GO

 

 

 

Common issues

 

  • Failed to connect to Azure Storage

2019-11-19 02:21:05.07 Obtained Azure Storage Connection String for replstorage 2019-11-19 02:21:05.07 Connecting to Azure Files Storage '\replstorage.file.core.windows.net\replshare' 2019-11-19 02:21:31.21 Failed to connect to Azure Storage '' with OS error: 53.

 

Recommendations:

 

- Ensure that the port 445 is open in the outbound security rules of the Network Security Group (NSG) that your Managed Instance is using

- Check Distributor properties as below:

 

Right-click on Local Publications and access Distributor properties:

 

Screenshot 2020-12-16 102809.png

After that access the Publishers page and press on the below highlighted area:

 

Screenshot 2020-12-16 102926.png

After that you should have a window similar to this:

 

Screenshot 2020-12-16 103114.png

In here please check that the Default Snapshot Folder is in the correct format and for the Storage Account Connection String you can also re-enter it here from here:

 

Screenshot 2020-12-16 103224.png

 

More details on this error are accessible here Failed to connect to Azure Storage.

 

  • Could not connect to Subscriber

Error messages:
The process could not connect to Subscriber 'REPLMITOVM.REPLDNS.COM'. (Source: MSSQL_REPL, Error number: MSSQL_REPL0)
Get help:
http://help/MSSQL_REPL0
Named Pipes Provider: Could not open a connection to SQL Server [53]. (Source: MSSQLServer, Error number: 53)
Get help:
http://help/53
A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. (Source: MSSQLServer, Error number: 53)
Get help:
http://help/53
Query timeout expired, Failed Command: (Source: MSSQLServer, Error number: HYT00)
Get help:
http://help/HYT00

 

Recommendations:

 

- Ensure that the port 1433 is open in the outbound security rules of the Managed Instance NSG

- As an alternative to T-SQL script mentioned here you can also add the subscription directly from the GUI of SSMS:

 

Right-click on the publication and click New Subscriptions

 

Screenshot 2020-12-16 103751.png

 

Click Next, select the publication name and click Next, Run all agents at the Distributor, Add SQL Server Subscriber:

 

Screenshot 2020-12-16 103932.png

 

Here we will need to connect to the on-premises server with SQL Authentication as mentioned in the first part of the requirements.

 

After the subscription was added click on the highlighted area below:

 

Screenshot 2020-12-16 104536.png

 

On the top part use login that you are using for the distributor (SQL login that you are accessing the Azure SQL Managed Instance) and on the bottom part of the window enter the SQL login used previously to access the on-premises server.

 

After that you can leave the Synchronization Schedule together with the Initialize Subscription steps as default and Finish the New Subscription Wizard.

 

As a short summary the recommendations for the Could not Connect to Subscriber error would be:

 

  1. Ensure that the port 1433 is open and that the other requirements are met
  2. Try as an alternative to add the subscription with SSMS
  3. Provide the IP address of the on-premises server in the sp_addsubscription stored procedure
  4. Check if the @@SERVERNAME is the same with SERVERPROPERTY(N'servername') 

 

 

 

SELECT SERVERPROPERTY(N'servername')
SELECT @@SERVERNAME

 

 

If the results are different this can be fixed by using this script: 

 

DECLARE @actualname NVARCHAR(100)
DECLARE @currentname NVARCHAR(100)
SELECT @actualname = CONVERT(NVARCHAR(100), SERVERPROPERTY(N'servername'))
SELECT @currentname = @@SERVERNAME
EXEC sp_dropserver @currentname
EXEC sp_addserver @actualname, local

 

Reference article: SQL SERVER – FIX – Replication Error: SQL Server replication requires the actual server name to make... 

 

More details about the Could not connect to Subscriber error can also be found here