Home
%3CLINGO-SUB%20id%3D%22lingo-sub-1108165%22%20slang%3D%22en-US%22%3EUsing%20Private%20Link%20and%20Point-to-Site%20Gateway%20for%20secure%20on-premise%20connectivity%20to%20PostgreSQL%20Server%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1108165%22%20slang%3D%22en-US%22%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fprivate-link%2Fprivate-link-overview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Private%20Link%3C%2FA%3E%20is%20a%20secure%20and%20scalable%20way%20for%20Azure%20customers%20to%20consume%20Azure%20database%20for%20PostgreSQL%20Single%20server%20service%20privately%20from%20their%20Azure%20Virtual%20Network%20(VNet).%20Azure%20Private%20Link%20essentially%20brings%20Azure%20services%20inside%20the%20customer%E2%80%99s%20private%20VNet.%20The%20PostgreSQL%20resources%20can%20be%20accessed%20using%20the%20private%20IP%20address%20just%20like%20any%20other%20resource%20in%20the%20VNet.%20This%20significantly%20simplifies%20the%20network%20configuration%20by%20keeping%20access%20rules%20private.%20You%20can%20read%20more%20about%20it%20here%3A%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-database-for-postgresql%2Fintroducing-private-link-for-azure-database-for-postgresql%2Fba-p%2F1088068%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EIntroducing%20Private%20Link%20for%20Azure%20Database%20for%20PostgreSQL%20Single%20server.%26nbsp%3B%3C%2FA%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EIn%20this%20blog%20post%2C%20we%20will%20outline%20detailed%20steps%20on%20how%20to%20connect%20securely%20from%20an%20On-Premise%20VM%20to%20Azure%20Database%20for%20PostgreSQL%20using%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvpn-gateway%2Fpoint-to-site-about%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPoint-to-Site%20Gateway%3C%2FA%3E%20and%20Azure%20Private%20Link.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EA%20Point-to-Site%20(P2S)VPN%20gateway%20connection%20lets%20you%20create%20a%20secure%20connection%20to%20your%20virtual%20network%20from%20an%20individual%20client%20computer.%20A%20P2S%20connection%20is%20established%20by%20starting%20it%20from%20the%20client%20computer.%20This%20solution%20is%20useful%20for%20telecommuters%20who%20want%20to%20connect%20to%20Azure%20VNets%20fr%26nbsp%3Bom%20a%20remote%20location%2C%20such%20as%20from%20home%20or%20a%20conference.%20P2S%20VPN%20is%20also%20a%20useful%20solution%20to%20use%20instead%20of%20S2S%20VPNor%20ExpressRoutewhen%20you%20have%20only%20a%20few%20clients%20that%20need%20to%20connect%20to%20a%20VNet.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EHere%20is%20the%20high-level%20architecture%20diagram%20of%20how%20this%20solution%20works%20in%20practice%3A%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F165352iDCE248D08A2AF463%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22pip1.jpg%22%20title%3D%22pip1.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EUser%20connects%20from%20on-premises%20(over%20Point-to-Site%20VPN)%20by%20specifying%20Private%20IP%20address%20for%20Azure%20Database%20for%20PostgreSQL%20%26amp%3B%20port%205432.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20style%3D%22text-align%3A%20justify%3B%22%20id%3D%22toc-hId--1416226904%22%20id%3D%22toc-hId--1416226900%22%3EStep%20by%20step%20guide%20to%20implementing%20this%20architecture%3C%2FH2%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EYou%20can%20create%20Private%20Endpoints%20using%20either%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fpostgresql%2Fhowto-configure-privatelink-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPortal%3C%2FA%3E%20or%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fpostgresql%2Fhowto-configure-privatelink-cli%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3ECLI%3C%2FA%3E.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EWe%20have%20also%20created%20one-click-deployable%20ARM%20Templates%20to%20provision%20the%20Private%20Endpoints%20quickly%3A%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2Fazure-postgresql%2Ftree%2Fmaster%2Farm-templates%2FExampleWithPrivateLink%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FAzure%2Fazure-postgresql%2Ftree%2Fmaster%2Farm-templates%2FExampleWithPrivateLink%3C%2FA%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3ECreate%20Azure%20Virtual%20Network%20Gateway%20for%20the%20VNET%20in%20which%20private%20endpoints%20exist%20%3A%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CA%20href%3D%22https%3A%2F%2Fms.portal.azure.com%2F%23create%2FMicrosoft.VirtualNetworkGateway-ARM%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fms.portal.azure.com%2F%23create%2FMicrosoft.VirtualNetworkGateway-ARM%3C%2FA%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F165369iE670086DFA9E250B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22clipboard_image_0.png%22%20title%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F165354i36F16D2F71B6C9F2%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22clipboard_image_1.png%22%20title%3D%22clipboard_image_1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EOnce%20the%20Virtual%20Network%20Gateway%20is%20created%20successfully%2C%20we%20will%20add%20Point-to-Site%20configuration%3A%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F165355i55B31AB198ED5EE0%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22clipboard_image_2.png%22%20title%3D%22clipboard_image_2.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EP2S%20VPN%20clients%20are%20authenticated%20using%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvpn-gateway%2Fpoint-to-site-about%23authenticate-using-native-azure-certificate-authentication%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Enative%20Azure%20Certificate%20Authentication%3C%2FA%3E.%20Instructions%20to%20generate%20and%20export%20certificates%20for%20Point-to-Site%20using%20Powershell%20are%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvpn-gateway%2Fvpn-gateway-certificates-point-to-site%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%20You%20can%20either%20generate%20a%20self-signed%20root%20certificate%20or%20use%20Enterprise%20CA%20solution.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20style%3D%22text-align%3A%20justify%3B%22%20id%3D%22toc-hId--725665430%22%20id%3D%22toc-hId--725665426%22%3EInstructions%20to%20use%20self-signed%20root%20certificate%26nbsp%3B%3C%2FH3%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E1.%20Create%20a%20self-signed%20root%20certificate%3A%20From%20a%20computer%20running%20Windows%2010%20or%20Windows%20Server%202016%2C%20open%20a%20Windows%20PowerShell%20console%20with%20elevated%20privileges%20and%20run%20the%20following%20command%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-markup%22%3E%3CCODE%3E%24cert%20%3D%20New-SelfSignedCertificate%20-Type%20Custom%20-KeySpec%20Signature%20-Subject%20%22CN%3DP2SRootCert%22%20-KeyExportPolicy%20Exportable%20-HashAlgorithm%20sha256%20-KeyLength%202048%20-CertStoreLocation%20%22Cert%3A%5CCurrentUser%5CMy%22%20-KeyUsageProperty%20Sign%20-KeyUsage%20CertSign%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%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSTRONG%3ENOTE%3A%3C%2FSTRONG%3E%20Root%20certificate%20name%20%E2%80%9CP2SRootCert%E2%80%9D%20should%20be%20provided%20as%20input%20for%20Root%20Certificate%20Name%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E2.%20Export%20the%20root%20certificate%20public%20key%20(.cer)%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-markup%22%3E%3CCODE%3E%5BSystem.Convert%5D%3A%3AToBase64String(%24cert.RawData%2C%20'InsertLineBreaks')%20-replace%20%22%60n%22%2C%22%22%20-replace%20%22%60r%22%2C%22%22%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%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSTRONG%3ENOTE%3A%3C%2FSTRONG%3E%20The%20output%20of%20the%20above%20command%20should%20be%20provided%20as%20input%20for%20Public%20Certificate%20Data.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E3.%20Generate%20a%20client%20certificate%3A%20Each%20client%20computer%20that%20connects%20to%20a%20VNet%20using%20Point-to-Site%20must%20have%20a%20client%20certificate%20installed.%20You%20generate%20a%20client%20certificate%20from%20the%20self-signed%20root%20certificate%2C%20and%20then%20export%20and%20install%20the%20client%20certificate.%20If%20the%20client%20certificate%20is%20not%20installed%2C%20authentication%20fails.%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-markup%22%3E%3CCODE%3E%23%20Generate%20a%20client%20certificate%20from%20the%20self-signed%20root%20certificate%20%0A%24clientCert%20%3D%20New-SelfSignedCertificate%20-Type%20Custom%20-DnsName%20P2SChildCert%20-KeySpec%20Signature%20-Subject%20%22CN%3DP2SChildCert%22%20-KeyExportPolicy%20Exportable%20-HashAlgorithm%20sha256%20-KeyLength%202048%20-CertStoreLocation%20%22Cert%3A%5CCurrentUser%5CMy%22%20-Signer%20%24cert%20-TextExtension%20%40(%222.5.29.37%3D%7Btext%7D1.3.6.1.5.5.7.3.2%22)%20%0A%0A%23%20Protect%20the%20pfx%20file%20using%20a%20password%20%0A%24mypwd%20%3D%20ConvertTo-SecureString%20-String%20%221234%22%20-Force%20-AsPlainText%20%0A%0A%23%20Export%20the%20client%20certificate%20as%20PFX%20%0A%24clientCert%20%7C%20Export-PfxCertificate%20-FilePath%20C%3A%5Cclientcertificate.pfx%20-Password%20%24mypwd%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%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSTRONG%3ENOTE%3A%3C%2FSTRONG%3EIf%20you%20wish%20to%20connect%20to%20VNET%20using%20P2S%20from%20another%20client%20VM%2C%20copy%20paste%20clientceritifcate.pfx%20and%20install%20it%20using%20the%20password.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3ECreate%20Point-to-site%20configuration%20with%20the%20above%20generated%20certificate%20%3A%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F165358iCBE53FFBD94BCBE2%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22clipboard_image_3.png%22%20title%3D%22clipboard_image_3.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20style%3D%22text-align%3A%20justify%3B%22%20id%3D%22toc-hId-1761847403%22%20id%3D%22toc-hId-1761847407%22%3EConnectivity%20from%20On-Premise%20Client%20VM%3C%2FH3%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EYou%20will%20need%20to%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvpn-gateway%2Fpoint-to-site-how-to-vpn-client-install-azure-cert%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Einstall%20the%20client%20certificates%3C%2FA%3E%20on%20the%20On-Premise%20Client%20VM%20for%20authenticating%20the%20P2S%20connections%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EClick%20on%20the%20Virtual%20Network%20Gateway%20and%20click%20Point-to-Site%20Configurations.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EClick%20on%20Download%20VPN%20Client%20to%20download%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvpn-gateway%2Fpoint-to-site-vpn-client-configuration-azure-cert%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EVPN%20Client%20Configuration%20Files%3C%2FA%3E.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F165359iABF0FF01A8627119%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22clipboard_image_4.png%22%20title%3D%22clipboard_image_4.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EOnce%20the%20VPN%20Client%20is%20downloaded%2C%20extract%20the%20folder%20and%20run%20the%20following%20program%20as%20Administrator%3A%20WindowsAmd64%5CVpnClientSetupAmd64.exe.%20(For%20a%2064-bit%20processor%20architecture%2C%20choose%20the%20'VpnClientSetupAmd64'%20installer%20package.%20For%20a%2032-bit%20processor%20architecture%2C%20choose%20the%20'VpnClientSetupX86'%20installer%20package.)%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EIf%20you%20see%20a%20SmartScreen%20popup%2C%20click%20More%20info%2C%20then%20Run%20anyway.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EClick%20Yes%20on%20the%20following%20prompt%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F165360i6A51A543CE05B73C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22clipboard_image_5.png%22%20title%3D%22clipboard_image_5.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EOn%20the%20client%20computer%2C%20navigate%20to%20Network%20Settings%20and%20click%20VPN.%20The%20VPN%20connection%20shows%20the%20name%20of%20the%20virtual%20network%20that%20it%20connects%20to.%20Click%20Connect.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F165361iEBC52E0E48E9E60F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22clipboard_image_6.png%22%20title%3D%22clipboard_image_6.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EClick%20Connect%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F165362i7BFF1CA8B37FF665%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22clipboard_image_7.png%22%20title%3D%22clipboard_image_7.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3ESelect%20the%20checkbox%20and%20Click%20Continue%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F165363i86CBDE580090F73B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22clipboard_image_8.png%22%20title%3D%22clipboard_image_8.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EIf%20connected%20successfully%2C%20you%20will%20see%20%E2%80%9CConnected%E2%80%9D%20status%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F165366iAE9FC42D53F023DE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22clipboard_image_9.png%22%20title%3D%22clipboard_image_9.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EVerify%20connection%20is%20successful%20using%20psql%20command%20line%3A%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F165367iD4825CC8C373C3AE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22clipboard_image_10.png%22%20title%3D%22clipboard_image_10.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20style%3D%22text-align%3A%20justify%3B%22%20id%3D%22toc-hId--45607060%22%20id%3D%22toc-hId--45607056%22%3ELearn%20More%3C%2FH3%3E%0A%3CP%20style%3D%22text-align%3A%20left%3B%22%3EYou%20can%20find%20more%20details%20in%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fpostgresql%2Fconcepts-data-access-and-security-private-link%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eofficial%20documentation%3C%2FA%3E.%20You%20can%20give%20the%20Azure%20Private%20Link%20a%20try%20today.%20If%20you%20have%20questions%2C%20please%20reach%20out%20to%20the%20AskAzureDBforPostgreSQL%40service.microsoft.com%20alias.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1108165%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F165351iA247FEF0551CF476%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22pip1.jpg%22%20title%3D%22pip1.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EIn%20this%20blog%20post%2C%20we%20will%20outline%20detailed%20steps%20on%20how%20to%20connect%20securely%20from%20an%20On-Premise%20VM%20to%20Azure%20Database%20for%20PostgreSQL%20using%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvpn-gateway%2Fpoint-to-site-about%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%20target%3D%22_blank%22%3E%26nbsp%3B%3C%2FA%3E%20and%20Azure%20Private%20Link.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1108165%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Econnectivity%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Eendpoint%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Epostgresql%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Eprivate%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Eprivatelink%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Esecure%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

Azure Private Link is a secure and scalable way for Azure customers to consume Azure database for PostgreSQL Single server service privately from their Azure Virtual Network (VNet). Azure Private Link essentially brings Azure services inside the customer’s private VNet. The PostgreSQL resources can be accessed using the private IP address just like any other resource in the VNet. This significantly simplifies the network configuration by keeping access rules private. You can read more about it here: Introducing Private Link for Azure Database for PostgreSQL Single server. 

 

In this blog post, we will outline detailed steps on how to connect securely from an On-Premise VM to Azure Database for PostgreSQL using Point-to-Site Gateway and Azure Private Link.

 

A Point-to-Site (P2S) VPN gateway connection lets you create a secure connection to your virtual network from an individual client computer. A P2S connection is established by starting it from the client computer. This solution is useful for telecommuters who want to connect to Azure VNets fr om a remote location, such as from home or a conference. P2S VPN is also a useful solution to use instead of S2S VPN or ExpressRoute when you have only a few clients that need to connect to a VNet.

 

Here is the high-level architecture diagram of how this solution works in practice:

 

pip1.jpg

User connects from on-premises (over Point-to-Site VPN) by specifying Private IP address for Azure Database for PostgreSQL & port 5432.

 

Step by step guide to implementing this architecture

 

You can create Private Endpoints using either Portal or CLI.

 

We have also created one-click-deployable ARM Templates to provision the Private Endpoints quickly:

https://github.com/Azure/azure-postgresql/tree/master/arm-templates/ExampleWithPrivateLink

 

Create Azure Virtual Network Gateway for the VNET in which private endpoints exist :

https://ms.portal.azure.com/#create/Microsoft.VirtualNetworkGateway-ARM

 

clipboard_image_0.png

 

clipboard_image_1.png

 

Once the Virtual Network Gateway is created successfully, we will add Point-to-Site configuration:

 

clipboard_image_2.png

 

P2S VPN clients are authenticated using native Azure Certificate Authentication. Instructions to generate and export certificates for Point-to-Site using Powershell are here. You can either generate a self-signed root certificate or use Enterprise CA solution.

 

Instructions to use self-signed root certificate 

 

1. Create a self-signed root certificate: From a computer running Windows 10 or Windows Server 2016, open a Windows PowerShell console with elevated privileges and run the following command

 

 

 

$cert = New-SelfSignedCertificate -Type Custom -KeySpec Signature -Subject "CN=P2SRootCert" -KeyExportPolicy Exportable -HashAlgorithm sha256 -KeyLength 2048 -CertStoreLocation "Cert:\CurrentUser\My" -KeyUsageProperty Sign -KeyUsage CertSign

 

 

 

NOTE: Root certificate name “P2SRootCert” should be provided as input for Root Certificate Name

 

2. Export the root certificate public key (.cer)

 

 

 

[System.Convert]::ToBase64String($cert.RawData, 'InsertLineBreaks') -replace "`n","" -replace "`r",""

 

 

 

NOTE: The output of the above command should be provided as input for Public Certificate Data.

 

3. Generate a client certificate: Each client computer that connects to a VNet using Point-to-Site must have a client certificate installed. You generate a client certificate from the self-signed root certificate, and then export and install the client certificate. If the client certificate is not installed, authentication fails.

 

 

 

# Generate a client certificate from the self-signed root certificate 
$clientCert = New-SelfSignedCertificate -Type Custom -DnsName P2SChildCert -KeySpec Signature -Subject "CN=P2SChildCert" -KeyExportPolicy Exportable -HashAlgorithm sha256 -KeyLength 2048 -CertStoreLocation "Cert:\CurrentUser\My" -Signer $cert -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.2") 

# Protect the pfx file using a password 
$mypwd = ConvertTo-SecureString -String "1234" -Force -AsPlainText 

# Export the client certificate as PFX 
$clientCert | Export-PfxCertificate -FilePath C:\clientcertificate.pfx -Password $mypwd

 

 

 

NOTE: If you wish to connect to VNET using P2S from another client VM, copy paste clientceritifcate.pfx and install it using the password.

 

Create Point-to-site configuration with the above generated certificate : 

 

clipboard_image_3.png

 

Connectivity from On-Premise Client VM

 

You will need to install the client certificates on the On-Premise Client VM for authenticating the P2S connections

Click on the Virtual Network Gateway and click Point-to-Site Configurations.

Click on Download VPN Client to download the VPN Client Configuration Files.

 

clipboard_image_4.png

 

Once the VPN Client is downloaded, extract the folder and run the following program as Administrator: WindowsAmd64\VpnClientSetupAmd64.exe. (For a 64-bit processor architecture, choose the 'VpnClientSetupAmd64' installer package. For a 32-bit processor architecture, choose the 'VpnClientSetupX86' installer package.)

 

If you see a SmartScreen popup, click More info, then Run anyway.

 

Click Yes on the following prompt

 

clipboard_image_5.png

 

On the client computer, navigate to Network Settings and click VPN. The VPN connection shows the name of the virtual network that it connects to. Click Connect.

 

clipboard_image_6.png

 

Click Connect

 

clipboard_image_7.png

 

Select the checkbox and Click Continue

 

clipboard_image_8.png

 

If connected successfully, you will see “Connected” status

 

clipboard_image_9.png

 

Verify connection is successful using psql command line:

 

clipboard_image_10.png

 

Learn More

You can find more details in the official documentation. You can give the Azure Private Link a try today. If you have questions, please reach out to the AskAzureDBforPostgreSQL@service.microsoft.com alias.