<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Showkat's Address Space</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/showkat/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/showkat/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:41:38 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>How to access resource in Express Route VNET from Azure Web App</title>
      <link>https://docs.microsoft.com/archive/blogs/showkat/how-to-access-resource-in-express-route-vnet-from-azure-web-app</link>
      <pubDate>Fri, 17 Mar 2017 10:41:19 GMT</pubDate>
      <dc:creator><![CDATA[Showkat Hassan Lone]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/showkat/?p=675</guid>
      <description><![CDATA[Scenario
Azure Web App is connected to a VNET (VNET1) using Point-To-Site and then there is another...]]></description>
      <content:encoded><![CDATA[<h3>Scenario</h3>
Azure Web App is connected to a VNET (<strong>VNET1</strong>) using Point-To-Site and then there is another VNET (<strong>VNET2</strong>) with Express route Gateway. Both VNET are in Azure.

<em>Note: This blog is only if requirement is to access resource in Azure VNET having ER gateway. If your requirement is to access On-Prem resources from App Service through ER gateway then only solution will be use App Service Environment.</em>
<h3>Requirement</h3>
Azure Web App should be able to connect resource in VNET with Express route Gateway.

Web App &lt;---P2S ---&gt; VNET1 with Route Base GW&lt;--- s2s---&gt; VNET2 with Coexisting Gateway &amp; (Express Route)
<h3>Limitation</h3>
In Azure, we can connect two VNET’s using <a href="https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-create-vnetpeering-arm-portal">VNET Peering</a> &amp; <a href="https://azure.microsoft.com/en-us/blog/vnet-to-vnet-connecting-virtual-networks-in-azure-across-different-regions/">VNET to VNET</a> connectivity. But since we have a Web App connected using Point-To-Site, we need to add transit route which both these options will not allow. So, only way to get this working is having Site-to-Site IPsec tunnel.

We can create Site-to-Site but both gateways should be identical i.e. both gateways can either be Route based (Dynamic) or Policy based (Static). In my case VNET1 is Route based Gateway and VNET2 is Express Route.
<h3>Solution</h3>
So, can this be achieved?

Yes, we can either setup <a href="https://docs.microsoft.com/en-us/azure/app-service/app-service-app-service-environments-readme">App Service Environment</a> or if the requirement is to stay with multi-tenant App service then we can create <a href="https://docs.microsoft.com/en-us/azure/expressroute/expressroute-howto-coexist-resource-manager">Coexisting Gateway</a> in VNET2 and then establish Site-to-Site IPsec connectivity between VNET1 and VNET2.

Here is how we do that!

Existing setup

Web App &lt;---P2S ---&gt; VNET1 with Route Base GW

VNET2 with Express Route

First thing we need to do is create Coexisting gateway on VNET2. This can be done using PowerShell. Here is sample
<table border="2" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top">##Create coexistence IPsec Gateway##

$location = "<b><span style="background-color: #ffff00">DCLocation</span></b>"

<span style="font-family: Courier New">$vnet = Get-AzureRmVirtualNetwork -Name <b><span style="background-color: #ffff00">ExpressrouteVNET</span></b> -ResourceGroupName <b><span style="background-color: #ffff00">RGNAME</span></b>
$gwSubnet = Get-AzureRmVirtualNetworkSubnetConfig -Name "GatewaySubnet" -VirtualNetwork $vnet
$gwIP = New-AzureRmPublicIpAddress -Name "VPNGatewayIP" -ResourceGroupName <b><span style="background-color: #ffff00">RGNAME</span></b> -Location $location -AllocationMethod Dynamic
$gwConfig = New-AzureRmVirtualNetworkGatewayIpConfig -Name "VPNGatewayIpConfig" -SubnetId $gwSubnet.Id -PublicIpAddressId $gwIP.Id
New-AzureRmVirtualNetworkGateway -Name "<b><span style="background-color: #ffff00">NAMEFORNEWGW</span></b>" -ResourceGroupName <b><span style="background-color: #ffff00">RGNAME</span></b> -Location $location -IpConfigurations $gwConfig -GatewayType Vpn -VpnType RouteBased -GatewaySku Standard </span>

<span style="font-family: Courier New">##Create Local Network Gateway## </span>

<span style="font-family: Courier New">$MyLocalNetworkAddress = <span style="background-color: #ffff00">@("10.0.0.0/21",” 172.16.0.0/16”) &lt;- Address space of VNET1 &amp; Point-to-Site</span>
$localVpn = New-AzureRmLocalNetworkGateway -Name "<b><span style="background-color: #ffff00">LOCALNETWORKGATEWAY</span></b>" -ResourceGroupName Blogs -Location $location -GatewayIpAddress <b><span style="background-color: #ffff00">IPOFVNET1GW</span></b> -AddressPrefix $MyLocalNetworkAddress </span>

<span style="font-family: Courier New">##Connection## </span>

<span style="font-family: Courier New">$azureVpn = Get-AzureRmVirtualNetworkGateway -Name "VPNGateway" -ResourceGroupName <b><span style="background-color: #ffff00">RGNAME</span></b>
New-AzureRmVirtualNetworkGatewayConnection -Name "VPNConnection" -ResourceGroupName <b><span style="background-color: #ffff00">RGNAME</span></b> -Location $location -VirtualNetworkGateway1 $azureVpn -LocalNetworkGateway2 $localVpn -ConnectionType IPsec -SharedKey "enteryourpresharedkey"</span></td>
</tr>
</tbody>
</table>
&nbsp;

Once this is done then we can create Site-to-Site IPsec connection between VNET1 Gateway and VNET2 Coexisting Gateway.

For testing connectivity i have documented in my previous <a href="https://blogs.msdn.microsoft.com/showkat/2017/02/20/access-on-premises-resource-from-azure-app-services/">blog</a>

HTH]]></content:encoded>
    </item>
    <item>
      <title>Access On-Premises resource from Azure App Services</title>
      <link>https://docs.microsoft.com/archive/blogs/showkat/access-on-premises-resource-from-azure-app-services</link>
      <pubDate>Mon, 20 Feb 2017 14:38:00 GMT</pubDate>
      <dc:creator><![CDATA[Showkat Hassan Lone]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/showkat/?p=365</guid>
      <description><![CDATA[In this post, I am going to discuss how we can connect Azure Web App to a resource across 2 VNET’s...]]></description>
      <content:encoded><![CDATA[<p><a name="_Hlk475291386"></a>In this post, I am going to discuss how we can connect Azure Web App to a resource across 2 VNET’s (Azure or On-Premises ) connected via Site-to-Site, .  <p>A typical scenario could be you have Site-to-Site VPN from Azure to On-Premises or between 2 Azure VNET’s and want to connect Azure Web App to a resources in both VNET’s.  <p>Azure Web App is a multi-tenant architecture which prevents&nbsp; provisioning of App’s directly in a VNET. But with Point-to-Site connectivity we can enable App’s to access resources inside VNET.  <p>Prerequisites:  <ol> <li>App Service plan should be Standard or Premium  <li>VNET Gateway should be Route based  <li>Address space of any VNET should not overlap. </li></ol> <p>Steps needed to connect:  <ol> <li>Assuming you already have Site-to-Site VPN established between 2 VNET’s (VNET1 &amp; VNET2)  <li>Create an Azure Web App  <li>Enable Point-to-Site gateway on existing Gateway of VNET1  <li>Integrate Web App with VNET1 using Point-to-Site  <li>Update routes on web app by adding Address Space of VNET2 on Web App Networking blade  <li>Update routs on VNET2 by adding Point-to-Site Address space on VNET2 gateway.</li></ol> <p>Let’s get started  <p>I have a Site-to-Site connection established between two Azure ARM VNETs.  <p>Setup for Demo  <p><b>1. </b><b>VNET1 </b> <ul> <li>Gateway VNET1GW  <li>Local Network Gateway as LNG1  <li>Address Space 10.2.0.0/16  <li>VM with IP 10.2.0.4  <li>Point to Site Address space 172.16.0.0/24</li></ul> <p><b>2. </b><b>VNET2 </b> <ul> <li>Gateway VNET2GW  <li>Local Network gateway as LNG2  <li>Address space 192.168.0.0/16  <li>VM with IP 192.168.0.4 </li></ul> <p>3. Web app I need to integrate to VNET is VNETAPP  <p>To start with we need to enable Point-to-Site on VNET1GW, this can be done on portal as well now,  <p>Virtual network gateways Microsoft -&gt; VNET1GW -&gt; Point-to-Site Configuration  <p>Add Address Pool 172.16.0.0/24 &amp; Click on Save  <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/PTSAdd.jpg"><img title="PTSAdd" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="PTSAdd" src="https://msdnshared.blob.core.windows.net/media/2017/02/PTSAdd_thumb.jpg" width="579" height="258"></a>  <p>Once this is done we now go to Web App to integrate it with VNET.  <p><b>Note: VNET Integration needs your App Service plan on Standard or Premium </b> <p>App Services -&gt; VNETAPP –&gt; Networking  <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/vnetint.jpg"><img title="vnetint" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="vnetint" src="https://msdnshared.blob.core.windows.net/media/2017/02/vnetint_thumb.jpg" width="579" height="394"></a>  <p>&nbsp; <p>Click on Setup you will get list of VNET available in your subscription. One with Point-to-Site will be available for integration  <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/vnet1.jpg"><img title="vnet1" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="vnet1" src="https://msdnshared.blob.core.windows.net/media/2017/02/vnet1_thumb.jpg" width="290" height="289"></a>  <p>&nbsp; <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220155431.jpg"><img title="snip_20170220155431" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="snip_20170220155431" src="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220155431_thumb.jpg" width="385" height="133"></a>  <p>Connection done. Click on “Click here to configure” to see Site to Site Address space, Point-to-site address space and routes added.  <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/PTSAdd1.jpg"><img title="PTSAdd" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="PTSAdd" src="https://msdnshared.blob.core.windows.net/media/2017/02/PTSAdd_thumb1.jpg" width="464" height="1231"></a>  <p>&nbsp; <p>Connectivity done, now time to test  <p>For test we can try to tcpping from Console/ kudu (SCM) of the web app or use CURL to access web page from VM  <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220155638.jpg"><img title="snip_20170220155638" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="snip_20170220155638" src="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220155638_thumb.jpg" width="591" height="364"></a>  <p>CURL <a href="https://10.2.0.4">https://10.2.0.4</a>  <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220155925.jpg"><img title="snip_20170220155925" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="snip_20170220155925" src="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220155925_thumb.jpg" width="633" height="125"></a>  <p>&nbsp; <p>So our Point-to-Site connectivity is established from WebApp to VNET1 and we can access resources.  <p>Next we need to connect to VM on VNET2  <p>Let first check connectivity between VNET1 &amp; VNET2 over Site-to-Site  <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220160114.jpg"><img title="snip_20170220160114" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="snip_20170220160114" src="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220160114_thumb.jpg" width="690" height="227"></a>  <p>&nbsp; <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220160350.jpg"><img title="snip_20170220160350" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="snip_20170220160350" src="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220160350_thumb.jpg" width="676" height="236"></a>  <p>&nbsp; <p>VM on VNET1 has IP 10.2.0.4  <p>VM on VNET2 has IP 192.168.0.4  <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0182.png"><img title="clip_image018" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image018" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image018_thumb2.png" width="492" height="331"></a>  <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0202.png"><img title="clip_image020" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image020" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image020_thumb2.png" width="505" height="336"></a>  <p>Site-to-Site working fine. Now time to test from Web app  <p>For that to work we need to check Routes on Web App VNET integration blade and then also route on LNG2 for Point-to-site address space.  <p>App Service Plan -&gt; NameofAppServicePlan -&gt; Networking –&gt; “Click here to manage”&nbsp; -&gt;Select VNET  <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220161109.jpg"><img title="snip_20170220161109" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="snip_20170220161109" src="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220161109_thumb.jpg" width="644" height="613"></a>  <p>&nbsp; <p>So we have route for VNET2 added on App Service VNET integration. At this point we can try to tcpping to VM on VNET2 from SCM  <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220161447.jpg"><img title="snip_20170220161447" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="snip_20170220161447" src="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220161447_thumb.jpg" width="523" height="522"></a>  <p>Connection time out.  <p>Web App has route to reach to VNET2 but VNET2 does not have route back to Point-to-Site Address Space.  <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220161707.jpg"><img title="snip_20170220161707" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="snip_20170220161707" src="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220161707_thumb.jpg" width="714" height="397"></a>  <p>LNG2 which is VNET2 Local Network gateway has only route added to Site-to-Site Address space of VNET1.  <p>Now let’s add route for Point-to-Site Address space on LNG2  <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220162012.jpg"><img title="snip_20170220162012" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="snip_20170220162012" src="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220162012_thumb.jpg" width="712" height="396"></a>  <p>Time to test again from Web App  <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220161932.jpg"><img title="snip_20170220161932" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="snip_20170220161932" src="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220161932_thumb.jpg" width="556" height="521"></a>  <p>Curl <a href="https://192.168.0.4">https://192.168.0.4</a>  <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220162205.jpg"><img title="snip_20170220162205" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="snip_20170220162205" src="https://msdnshared.blob.core.windows.net/media/2017/02/snip_20170220162205_thumb.jpg" width="723" height="100"></a>  <p>Now Web App is able to connect to VM on VNET1 as well as to VM on VNET2 on private VNET IP.&nbsp; <p>In this demo I have used 2 Azure VNET. Same steps needs to followed for Site-to-Site between Azure VNET and On-Premises VNET.  <p>That’s it!]]></content:encoded>
    </item>
  </channel>
</rss>