Jump to content













Photo
- - - - -

Azure App Service, get data from on-premises databases securely

  Posted by Pantelis Apostolidis , in Azure 14 March 2018 · 21 views

<h1 style="text-align: justify;">Azure App Service, get data from on-premises databases securely</h1>
<p style="text-align: justify;">There are many scenarios where we want to have the Web Application on the Cloud but on the other hand, due to various limitations, the database stays on-premises. Azure has a service, called Azure Hybrid Connections, that allows the Web App to connect to on-premises databases, using internal IP address or the database server host name, without a complex VPN setup.</p>
<p>The Connection diagram</p>
<p><img class="alignnone wp-image-1839 size-full" src="https://www.e-aposto...iondiagram.png"alt="hybrid connections" width="806" height="272" srcset="https://www.e-apostolidis.gr/wp-content/uploads/2018/03/hybridconn-connectiondiagram.png 806w, https://www.e-aposto...ram-300x101.png 300w, https://www.e-aposto...ram-768x259.png 768w, https://www.e-aposto...ram-600x202.png 600w" sizes="(max-width: 806px) 100vw, 806px" /></p>
<p style="text-align: justify;">I have tested the connection with Microsoft SQL, PostgreSQL, MySQL, mongodb and Oracle. The databse requirements is to have a static port. So the first step in case of a Microsoft SQL instance is to assign a static port. In my test environment I have a Microsoft SQL 2016 and I assigned the default port 1433, using the Sql Server Configuration Manager / SQL Server Network Configuration / Protocols for INSTANCENAME (MSSQLSERVER)</p>
<p id="pXsKaMQ" style="text-align: justify;"><img class="alignnone wp-image-1819 size-full" src="https://www.e-aposto...6ff237b5c6.png"alt="hybrid connections" width="913" height="499" srcset="https://www.e-apostolidis.gr/wp-content/uploads/2018/03/img_5aa6ff237b5c6.png 913w, https://www.e-aposto...5c6-300x164.png 300w, https://www.e-aposto...5c6-768x420.png 768w, https://www.e-aposto...5c6-600x328.png 600w" sizes="(max-width: 913px) 100vw, 913px" /></p>
<p style="text-align: justify;">All paid service plans supports hybrid connections. The limits are on how many hybrid connections can be used per plan, as the below table shows.</p>
<table style="width: 830px;">
<thead>
<tr>
<th style="width: 298.5px;">Pricing plan</th>
<th style="width: 523.5px;">Number of Hybrid Connections usable in the plan</th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 298.5px;">Basic</td>
<td style="width: 523.5px;">5</td>
</tr>
<tr>
<td style="width: 298.5px;">Standard</td>
<td style="width: 523.5px;">25</td>
</tr>
<tr>
<td style="width: 298.5px;">Premium</td>
<td style="width: 523.5px;">200</td>
</tr>
<tr>
<td style="width: 298.5px;">Isolated</td>
<td style="width: 523.5px;">200</td>
</tr>
</tbody>
</table>
<p style="text-align: justify;">To start creating the Hybrid Connections, go to the App Service / Networking / Hybrid Connections and press the “Configure your hybrid connection endpoints”</p>
<p id="BqjHLyQ" style="text-align: justify;"><img class="alignnone wp-image-1821 size-full" src="https://www.e-aposto...6ffd20fd5d.png"alt="hybrid connections" width="739" height="824" srcset="https://www.e-apostolidis.gr/wp-content/uploads/2018/03/img_5aa6ffd20fd5d.png 739w, https://www.e-aposto...d5d-269x300.png 269w, https://www.e-aposto...d5d-600x669.png 600w" sizes="(max-width: 739px) 100vw, 739px" /></p>
<p style="text-align: justify;">At the Hybrid connections blade there are two steps, the first is to “Add hybrid connection” and the second is to “Download the connection manager”.</p>
<p id="dDBGreG" style="text-align: justify;"><img class="alignnone wp-image-1824 size-full" src="https://www.e-aposto...70131c0565.png"alt="hybrid connections" width="969" height="591" srcset="https://www.e-apostolidis.gr/wp-content/uploads/2018/03/img_5aa70131c0565.png 969w, https://www.e-aposto...565-300x183.png 300w, https://www.e-aposto...565-768x468.png 768w, https://www.e-aposto...565-600x366.png 600w" sizes="(max-width: 969px) 100vw, 969px" /></p>
<p style="text-align: justify;">First click the “Add hybrid connection” and then press “Create new hybrid connection”</p>
<p id="fiuAhHs" style="text-align: justify;"><img class="alignnone wp-image-1826 size-full" src="https://www.e-aposto...7a2c511da8.png"alt="hybrid connections" width="622" height="297" srcset="https://www.e-apostolidis.gr/wp-content/uploads/2018/03/img_5aa7a2c511da8.png 622w, https://www.e-aposto...da8-300x143.png 300w, https://www.e-aposto...da8-600x286.png 600w" sizes="(max-width: 622px) 100vw, 622px" /></p>
<p style="text-align: justify;">The “Create new hybrid connection” blade will open. Add a Hybrid connection name, this must be at least 6 characters and it is the display name of the connection. <span style="font-size: 1.0625rem;">At the Endpoint host add the hostname of the database server and at the Endpoint port, the port of the database. At my case I added 1433, as this is the port I assign to my SQL instance before.</span></p>
<p style="text-align: justify;">Finally you will need to specify a name for a Servicebus namespace. As you realize, the hybrid connection uses Azure Servicebus for the communication, and press OK.</p>
<p id="LrXEohg" style="text-align: justify;"><img class="alignnone wp-image-1827 size-full" src="https://www.e-aposto...7a33b06f77.png"alt="hybrid connections" width="316" height="420" srcset="https://www.e-apostolidis.gr/wp-content/uploads/2018/03/img_5aa7a33b06f77.png 316w, https://www.e-aposto...f77-226x300.png 226w" sizes="(max-width: 316px) 100vw, 316px" /></p>
<p style="text-align: justify;">Once the connection is created it will be shown at the portal as “Not connected”</p>
<p id="WrEXGqg" style="text-align: justify;"><img class="alignnone wp-image-1829 size-full" src="https://www.e-aposto...7a5bdeb037.png"alt="hybrid connections" width="774" height="139" srcset="https://www.e-apostolidis.gr/wp-content/uploads/2018/03/img_5aa7a5bdeb037.png 774w, https://www.e-aposto...b037-300x54.png 300w, https://www.e-aposto...037-768x138.png 768w, https://www.e-aposto...037-600x108.png 600w" sizes="(max-width: 774px) 100vw, 774px" /></p>
<p style="text-align: justify;">Now we need to download and install the hybrid connection manager by clicking the “Download connection manager”. For this test I will install the hybrid connection manager at the same server as the SQL database, but for a production environment it is recommended to install the hybrid connection manager to a different server that will have access to the database servers only to the required ports. For the best security install it to a DMZ server and open only the required ports to the database servers.</p>
<p style="text-align: justify;">Run the downloaded msi and just click Install.</p>
<p id="KlflRxB" style="text-align: justify;"><img class="alignnone wp-image-1830 size-full" src="https://www.e-aposto...8371299074.png"alt="hybrid connections" width="488" height="384" srcset="https://www.e-apostolidis.gr/wp-content/uploads/2018/03/img_5aa8371299074.png 488w, https://www.e-aposto...074-300x236.png 300w" sizes="(max-width: 488px) 100vw, 488px" /></p>
<p style="text-align: justify;">Open the “Hybrid connection manager” UI and press “Add a new Hybrid Connection.</p>
<p id="jYIruxv" style="text-align: justify;"><img class="alignnone wp-image-1831 size-full" src="https://www.e-aposto...8379f58529.png"alt="hybrid connections" width="831" height="519" srcset="https://www.e-apostolidis.gr/wp-content/uploads/2018/03/img_5aa8379f58529.png 831w, https://www.e-aposto...529-300x187.png 300w, https://www.e-aposto...529-768x480.png 768w, https://www.e-aposto...529-600x375.png 600w" sizes="(max-width: 831px) 100vw, 831px" /></p>
<p style="text-align: justify;">Sign in to your Azure account</p>
<p id="IUEouKJ" style="text-align: justify;"><img class="alignnone wp-image-1832 size-full" src="https://www.e-aposto...837f4d0eb1.png"alt="hybrid connections" width="573" height="482" srcset="https://www.e-apostolidis.gr/wp-content/uploads/2018/03/img_5aa837f4d0eb1.png 573w, https://www.e-aposto...eb1-300x252.png 300w" sizes="(max-width: 573px) 100vw, 573px" /></p>
<p style="text-align: justify;">Once logged in, choose your Subscription and the hybrid connection configured previously will appear. Select it and press Save.</p>
<p id="fgXYGFF" style="text-align: justify;"><img class="alignnone wp-image-1833 size-full" src="https://www.e-aposto...838431ab4c.png"alt="hybrid connections" width="759" height="415" srcset="https://www.e-apostolidis.gr/wp-content/uploads/2018/03/img_5aa838431ab4c.png 759w, https://www.e-aposto...b4c-300x164.png 300w, https://www.e-aposto...b4c-600x328.png 600w" sizes="(max-width: 759px) 100vw, 759px" /></p>
<p style="text-align: justify;">Now at the connection manager status it will show “Connnected”</p>
<p id="DUTZxLd" style="text-align: justify;"><img class="alignnone wp-image-1834 size-full" src="https://www.e-aposto...83898e0f74.png"alt="hybrid connections" width="815" height="211" srcset="https://www.e-apostolidis.gr/wp-content/uploads/2018/03/img_5aa83898e0f74.png 815w, https://www.e-aposto...0f74-300x78.png 300w, https://www.e-aposto...f74-768x199.png 768w, https://www.e-aposto...f74-600x155.png 600w" sizes="(max-width: 815px) 100vw, 815px" /></p>
<p style="text-align: justify;">The same at the Azure Portal and your Hybrid connection is ready.</p>
<p id="COwOoqD" style="text-align: justify;"><img class="alignnone wp-image-1835 size-full" src="https://www.e-aposto...8393ba0032.png"alt="hybrid connections" width="786" height="499" srcset="https://www.e-apostolidis.gr/wp-content/uploads/2018/03/img_5aa8393ba0032.png 786w, https://www.e-aposto...032-300x190.png 300w, https://www.e-aposto...032-768x488.png 768w, https://www.e-aposto...032-600x381.png 600w" sizes="(max-width: 786px) 100vw, 786px" /></p>
<p style="text-align: justify;">Test, test, test and proof of concept. Open the Console, form the Wep App Blade, and tcpping the SQL server’s hostname atthe port 1433</p>
<p id="fGldsBK" style="text-align: justify;"><img class="alignnone wp-image-1836 size-full" src="https://www.e-aposto...83e8b94c55.png"alt="hybrid connections" width="495" height="155" srcset="https://www.e-apostolidis.gr/wp-content/uploads/2018/03/img_5aa83e8b94c55.png 495w, https://www.e-aposto...4c55-300x94.png 300w" sizes="(max-width: 495px) 100vw, 495px" /></p>
<p style="text-align: justify;">and also sqlcmd</p>
<p id="QkUalzG" style="text-align: justify;"><img class="alignnone wp-image-1838 size-full" src="https://www.e-aposto...83fdd583e6.png"alt="hybrid connections" width="756" height="315" srcset="https://www.e-apostolidis.gr/wp-content/uploads/2018/03/img_5aa83fdd583e6.png 756w, https://www.e-aposto...3e6-300x125.png 300w, https://www.e-aposto...3e6-600x250.png 600w" sizes="(max-width: 756px) 100vw, 756px" /></p>
<p style="text-align: justify;">
<p><a class="a2a_button_email" href="https://www.addtoany...bases securely"title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_print" href="https://www.addtoany.com/add_to/print?linkurl=https%3A%2F%2Fwww.e-apostolidis.gr%2Fmicrosoft%2Fazure%2Fazure-app-service-get-data-from-on-premises-databases-securely%2F&amp;linkname=Azure%20App%20Service%2C%20get%20data%20from%20on-premises%20databases%20securely" title="Print" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.e-apostolidis.gr%2Fmicrosoft%2Fazure%2Fazure-app-service-get-data-from-on-premises-databases-securely%2F&amp;title=Azure%20App%20Service%2C%20get%20data%20from%20on-premises%20databases%20securely" data-a2a-url="https://www.e-apostolidis.gr/microsoft/azure/azure-app-service-get-data-from-on-premises-databases-securely/" data-a2a-title="Azure App Service, get data from on-premises databases securely"><img src="https://static.addtoany.com/buttons/share_save_171_16.png" alt="Share"></a></p><p>The post <a rel="nofollow" href="https://www.e-apostolidis.gr/microsoft/azure/azure-app-service-get-data-from-on-premises-databases-securely/">Azure App Service, get data from on-premises databases securely</a> appeared first on <a rel="nofollow" href="https://www.e-apostolidis.gr">Apostolidis IT Corner</a>.</p>


<a href="https://www.e-aposto...ases-securely/"class='bbc_url' rel='nofollow external'>Source</a>