Home
%3CLINGO-SUB%20id%3D%22lingo-sub-793905%22%20slang%3D%22en-US%22%3ESecure%20connectivity%20from%20On-Premise%20to%20Azure%20Database%20for%20MySQL%20using%20Point-to-Site%20Gateway%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-793905%22%20slang%3D%22en-US%22%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EEnsuring%20secure%20connectivity%20to%20database%20resource%20is%20an%20important%20requirement%20and%20consideration%20for%20customers%20running%20in%20cloud%20environment.%20Today%20customers%20want%20to%20connect%20to%20their%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Database%20for%20MySQL%3C%2FA%3Efrom%20both%20inside%2Foutside%20of%20Azure%2C%20and%20based%20on%20the%20security%20and%20compliance%20requirements%2C%20organizations%20can%20choose%20one%20of%20the%20options%20provided%20by%20Azure%20Database%20for%20MySQL.%20In%20this%20blog%20post%2C%20we%20will%20outline%20detailed%20steps%20on%20how%20to%20connect%20securely%20from%20an%20On-Premise%20VM%20to%20Azure%20Database%20for%20MySQL%20using%20Point-to-Site%20Gateway.%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%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%20(P2S)%3C%2FA%3EVPN%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%20from%20a%20remote%20location%2C%20such%20as%20from%20home%20or%20a%20conference.%20P2S%20VPN%20is%20also%20a%20useful%20solution%20to%20use%20instead%20of%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvpn-gateway%2Fvpn-gateway-howto-site-to-site-resource-manager-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3ES2S%20VPN%3C%2FA%3Eor%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fexpressroute%2Fexpressroute-about-virtual-network-gateways%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EExpressroute%3C%2FA%3Ewhen%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%3E%3CSPAN%3EHere%20is%20the%20high-level%20architecture%20diagram%20of%20how%20this%20solution%20works%20in%20practice%3C%2FSPAN%3E%3CSPAN%3E%3A%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%2F126091iEAB48145EC1791E8%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22secure_connectivity.jpg%22%20title%3D%22secure_connectivity.jpg%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%3EStep1-%20User%20connects%20from%20on-premises%20(over%20Point-to-Site%20VPN)%20by%20specifying%20Private%20IP%20address%20for%20Azure%20VM%20%26amp%3B%20port%203306.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSTRONG%3EStep%202%3C%2FSTRONG%3E-%20NGINX%20is%20running%20on%20Azure%20VM%20and%20listening%20for%20traffic%20on%20port%203306%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSTRONG%3EStep%203%3C%2FSTRONG%3E-%20Traffic%20is%20forwarded%20by%20NGINX%20to%20the%20Azure%20Database%20for%20MySQL%20as%20part%20of%20normal%20login%20flow.%3C%2FP%3E%0A%3CH4%20style%3D%22text-align%3A%20justify%3B%22%20id%3D%22toc-hId-1403109614%22%20id%3D%22toc-hId-1403109614%22%3E%26nbsp%3B%3C%2FH4%3E%0A%3CH4%20style%3D%22text-align%3A%20justify%3B%22%20id%3D%22toc-hId--1149047347%22%20id%3D%22toc-hId--1149047347%22%3EStep%20by%20step%20guide%20to%20implementing%20this%20architecture%3C%2FH4%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%20created%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2Fazure-mysql%2Ftree%2Fmaster%2Farm-templates%2FExampleWithP2S%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eone-click-deployable%20ARM%20Templates%3C%2FA%3Eto%20provision%20the%20above%20architecture%20quickly%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%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CA%20href%3D%22https%3A%2F%2Fportal.azure.com%2F%23create%2FMicrosoft.Template%2Furi%2Fhttps%253A%252F%252Fraw.githubusercontent.com%252FAzure%252Fazure-mysql%252Fmaster%252Farm-templates%252FExampleWithP2S%252Ftemplate.json%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20%3CIMG%20src%3D%22http%3A%2F%2Fazuredeploy.net%2Fdeploybutton.png%22%20border%3D%220%22%20%2F%3E%20%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%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.%26nbsp%3BInstructions%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.%26nbsp%3BYou%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%3CH4%20style%3D%22text-align%3A%20justify%3B%22%20id%3D%22toc-hId-593762988%22%20id%3D%22toc-hId-593762988%22%3EInstructions%20to%20use%20self-signed%20root%20certificate%3C%2FH4%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20style%3D%22text-align%3A%20justify%3B%22%3E%0A%3CLI%3ECreate%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%2FLI%3E%0A%3C%2FOL%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%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSTRONG%3ENOTE%3A%3C%2FSTRONG%3ERoot%20certificate%20name%20%E2%80%9CP2SRootCert%E2%80%9D%20should%20be%20provided%20as%20input%20for%20ARM%20Template%20parameter%20%E2%80%98clientRootCertName%E2%80%99%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20style%3D%22text-align%3A%20justify%3B%22%20start%3D%222%22%3E%0A%3CLI%3EExport%20the%20root%20certificate%20public%20key%20(.cer)%3C%2FLI%3E%0A%3C%2FOL%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')%3C%2FCODE%3E%3C%2FPRE%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%3EThe%20output%20of%20the%20above%20command%20should%20be%20provided%20as%20input%20for%20ARM%20Template%20parameter%20%E2%80%98clientRootCertData%E2%80%99%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20style%3D%22text-align%3A%20justify%3B%22%20start%3D%223%22%3E%0A%3CLI%3EGenerate%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%2FLI%3E%0A%3C%2FOL%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%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)%0A%0A%23%20Protect%20the%20pfx%20file%20using%20a%20password%0A%24mypwd%20%3D%20ConvertTo-SecureString%20-String%20%221234%22%20-Force%20-AsPlainText%0A%0A%23%20Export%20the%20client%20certificate%20as%20PFX%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%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%3EOnce%20the%20template%20is%20deployed%20successfully%2C%20you%20will%20see%20the%20following%20resources%20in%20your%20resource%20group%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%2F126087i88D4B551AED9D40B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22clipboard_image_12.png%22%20title%3D%22clipboard_image_12.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%3CH2%20style%3D%22text-align%3A%20justify%3B%22%20id%3D%22toc-hId--1565366963%22%20id%3D%22toc-hId--1565366963%22%3EConnectivity%20from%20On-Premise%20Client%20VM%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%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%3Eon%20the%20On-Premise%20Client%20VM%20for%20authenticating%20the%20P2S%20connections.%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%20style%3D%22text-align%3A%20justify%3B%22%3E%0A%3CLI%3EClick%20on%20the%20Virtual%20Network%20Gateway(p2sdemoGW)%20and%20click%20Point-to-Site%20Configurations.%3C%2FLI%3E%0A%3CLI%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%2FLI%3E%0A%3C%2FUL%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%2F126074iAFF929B6C722470F%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%3CUL%20style%3D%22text-align%3A%20justify%3B%22%3E%0A%3CLI%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%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3EIf%20you%20see%20a%20SmartScreen%20popup%2C%20click%20More%20info%2C%20then%20Run%20anyway.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3EClick%20Yes%20on%20the%20following%20prompt%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CDIV%20id%3D%22tinyMceEditorclipboard_image_3%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FDIV%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%2F126084i74B7705F138E1468%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%3CUL%20style%3D%22text-align%3A%20justify%3B%22%3E%0A%3CLI%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%2FLI%3E%0A%3C%2FUL%3E%0A%3CDIV%20id%3D%22tinyMceEditorclipboard_image_4%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%3C%2FDIV%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%2F126085iA12CC1C3E1711454%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%3CUL%20style%3D%22text-align%3A%20justify%3B%22%3E%0A%3CLI%3EClick%20Connect%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%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%2F126086iFE7393DA22ED60CB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22clipboard_image_11.png%22%20title%3D%22clipboard_image_11.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%3CUL%20style%3D%22text-align%3A%20justify%3B%22%3E%0A%3CLI%3ESelect%20the%20checkbox%20and%20Click%20Continue%3A%3C%2FLI%3E%0A%3C%2FUL%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%2F126080i743C032E55ACA41A%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%3CUL%20style%3D%22text-align%3A%20justify%3B%22%3E%0A%3CLI%3EIf%20connected%20successfully%2C%20you%20will%20see%20%E2%80%9CConnected%E2%80%9D%20status%3A%3C%2FLI%3E%0A%3C%2FUL%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%2F126079i1C542A488ED58383%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%3EThe%20ARM%20template%20deployment%20output%20provides%20the%20mysql%20connection%20string%20to%20connect%20to%20the%20MySQL%20Server.%20Verify%20the%20connection%20using%20the%20mysql%20connection%20string.%20Replace%20%7Byour_password%7D%20with%20the%20value%20provided%20for%20'mysqlPassword'%20in%20ARM%20Template%20deployment.%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%2F126088i9555A6F1A3A540C6%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%3EIf%20you%20have%20trouble%20deploying%20the%20ARM%20Template%2C%20please%20let%20us%20know%20by%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2Fazure-mysql%2Fissues%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eopening%20an%20issue.%3C%2FA%3E%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EFeel%20free%20to%20contribute%20any%20updates%20or%20bug%20fixes%20by%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2Fazure-mysql%2Fpulls%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ecreating%20a%20pull%20request.%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%3EThank%20you!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-793905%22%20slang%3D%22en-US%22%3E%3CP%3ESecure%20connectivity%20from%20On-Premise%20to%20Azure%20Database%20for%20MySQL%20using%20Point-to-Site%20Gateway%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%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F126090i13E856C9FE08333C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22secure_connectivity.jpg%22%20title%3D%22secure_connectivity.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Microsoft

Ensuring secure connectivity to database resource is an important requirement and consideration for customers running in cloud environment. Today customers want to connect to their Azure Database for MySQL from both inside/outside of Azure, and based on the security and compliance requirements, organizations can choose one of the options provided by Azure Database for MySQL. In this blog post, we will outline detailed steps on how to connect securely from an On-Premise VM to Azure Database for MySQL using Point-to-Site Gateway.

 

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 from 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:

 

secure_connectivity.jpg

 

Step1 - User connects from on-premises (over Point-to-Site VPN) by specifying Private IP address for Azure VM & port 3306.

Step 2 - NGINX is running on Azure VM and listening for traffic on port 3306

Step 3 - Traffic is forwarded by NGINX to the Azure Database for MySQL as part of normal login flow.

 

Step by step guide to implementing this architecture

 

We have created one-click-deployable ARM Templates to provision the above architecture quickly

 

 

 

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 ARM Template parameter ‘clientRootCertName’

 

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

 

[System.Convert]::ToBase64String($cert.RawData, 'InsertLineBreaks')

 

NOTE: The output of the above command should be provided as input for ARM Template parameter ‘clientRootCertData’

 

  1. 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.

 

Once the template is deployed successfully, you will see the following resources in your resource group:

 

clipboard_image_12.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(p2sdemoGW) and click Point-to-Site Configurations.
  • Click on Download VPN Client to download the VPN Client Configuration Files.

 

clipboard_image_2.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_9.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_10.png

 

  • Click Connect

 

clipboard_image_11.png

 

  • Select the checkbox and Click Continue:

 

clipboard_image_6.png

 

  • If connected successfully, you will see “Connected” status:

clipboard_image_7.png

The ARM template deployment output provides the mysql connection string to connect to the MySQL Server. Verify the connection using the mysql connection string. Replace {your_password} with the value provided for 'mysqlPassword' in ARM Template deployment. 

 

clipboard_image_0.png

 

If you have trouble deploying the ARM Template, please let us know by opening an issue.

Feel free to contribute any updates or bug fixes by creating a pull request.

 

Thank you!