Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

PART 5.1: VIRTUAL NETWORK GATEWAY DEPLOYMENT USING MICROSOFT AZURE POWERSHELL

I found it little bit tricky while configuring virtual network gateway using Microsoft Azure Powershell, As while configuring it I had to associate VNG (Virtual Network Gateway) with already create virtual network and other Azure network services. I will try make it easy to understand.

First command is storing existing virtual network information in powershell variable so I can use it later, Check earlier article PART 3.1, I have already created one.
$VirtualNetwork = Get-AzureRmVirtualNetwork -Name 'vnet-poc-10.100.2.0' -ResourceGroupName 'POC-VPN'

Below command creates Gateway Subnet in virtual network as discussed in PART 3. Subnet must be GatewaySubnet
Add-AzureRmVirtualNetworkSubnetConfig -Name 'GatewaySubnet' -AddressPrefix '10.100.2.224/27' -VirtualNetwork $VirtualNetwork 1. Microsoft Azure Get-AzureRmVirtualNetwork creating new virtual network gateway vpn

Now I have created new gateway subnet under existing Virtual Network its time to commit the changes by using command.
Set-AzureRmVirtualNetwork -VirtualNetwork $VirtualNetwork 2. Microsoft Azure Set-AzureRmVirtualNetwork Add-AzureRmvirtualNetworksubnetconfig creating new virtual network gateway vpn

I need to use just created Gateway Subnet information in powershell variable for later use in other cmdlets. Basically I need Id of GatewayNetwork.
$GatewaySubnet = Get-AzureRmVirtualNetworkSubnetConfig -Name 'GatewaySubnet' -VirtualNetwork $VirtualNetwork

Virtual Network Gateway requires one Public IP, I will be creating one component. Even though IP Allocation Method is Dynamic , Gateway IP will never change.
$GatewayPublciIP = New-AzureRmPublicIpAddress -Name POC-VPN-VirtualNetworkGatewayPublicIP -ResourceGroupName POC-VPN -Location "East US 2" -AllocationMethod Dynamic 

3. Microsoft azure powershell get-azurermvirtualnetworksubnetconfig new-azurermpublicipaddress virtual network gateway vpn

I am creating azure Gateway IP address configuration storing in variable, Where all the related IP addresses and networks I will be using in last command.
$GatewayIPConfig = New-AzureRmVirtualNetworkGatewayIpConfig -Name GatewayIPconfiguration -SubnetId $GatewaySubnet.id -PublicIpAddressId $GatewayPublciIP.Id 

Just to add I was facing issue getting $GatewaySubnet.id value, It was empty, I had waited 1-2 hours to get value. If you want to expedite it, Copy API value from $VirtualNetwork variable manually and use it.

4. New-AzureRmVirtualNetworkGatewayIpConfig publicipaddress id virtual network gateway ip vpn connection subnet

I have configured/created all the network related items to Virtual Network Gateway, Now i just need to fire below cmdlet to initiate new VNG. It might take 10 to 45 mins to deploy new VNG in Azure.
New-AzureRmVirtualNetworkGateway -Name 'POC-VPN_VirtualNetworkGateway' -ResourceGroupName 'POC-VPN' -Location 'East US 2' -IpConfigurations $GatewayIPConfig -GatewayType Vpn -VpnType RouteBased -GatewaySku Standard

Just to recap from my earlier article. 

  • The -GatewayType for a Site-to-Site configuration is Vpn, Another option is ExpressRoute. 

  • The -VpnType can be RouteBased or PolicyBased. 

  • The -GatewaySku can be BasicStandard, or HighPerformance., It is about the performances. 

5, New-azurermvirtualnetworkgateway virtual network gateway vpn subnet microsoft azure powershell ip configuration, vpntype, gatewaytype gatewaysku

PART 1 : MICROSOFT AZURE CREATION AND CONFIGURATION OF VPN TUNNEL SERIES
PART 2 : MICROSOFT AZURE CREATING RESOURCE GROUP 
PART 3 : MICROSOFT AZURE CREATING AND ADMINISTERING VIRTUAL NETWORK (VNET)
PART 3.1 : MICROSOFT AZURE POWERSHELL CREATING AND ADMINISTERING VIRTUAL NETWORK (VNET)
PART 4 : MICROSOFT AZURE CREATING AND ADMINISTRATING LOCAL NETWORK GATEWAY VPN
PART 4.1 : MICROSOFT AZURE POWERSHELL CREATING AND ADMINISTRATING LOCAL NETWORK GATEWAY 
PART 5: VIRTUAL NETWORK GATEWAY DEPLOYMENT ON MICROSOFT AZURE
PART 5.1: VIRTUAL NETWORK GATEWAY DEPLOYMENT USING MICROSOFT AZURE POWERSHELL
PART 6: INSTALLING ROUTING AND REMOTE ACCESS SERVER ROLE (MICROSOFT RRAS)
PART 6.1: CONFIGURING ROUTING AND REMOTE ACCESS SERVER DEMAND-DIAL (MICROSOFT RRAS AZURE VPN)
PART 6.2: CONFIGURING ROUTING AND REMOTE ACCESS SERVER ROUTER (MICROSOFT RRAS AZURE VPN)
PART 7: MICROSOFT AZURE CREATE CONNECTION IN VIRTUAL NETWORK GATEWAY
PART 7.1: MICROSOFT AZURE POWERSHELL VPN CONNECTION IN VIRTUAL NETWORK GATEWAY
PART 8: MICROSOFT AZURE ARM AND POWERSHELL CREATING AND MANAGING STORAGE ACCOUNT
PART 9: CREATING AND MANAGING VIRTUAL MACHINE (VM) USING MICROSOFT AZURE RESOURCE MANAGER PORTAL

Next is the screenshot of verifying and checking on the Microsoft Azure portal, all the details and provided configuration are correct.

Microsoft azure powershell created virtual network gateway overview route-based gateway type vpn, virtual network, public IP address

Some Useful Links
MICROSOFT AZURE ERROR REGISTERING RESOURCE PROVIDERS CODE AUTHORIZATION FAILED 
INSTALLING MICROSOFT AZURE POWERSHELL

Go Back

Comment

Blog Search

Page Views

11241153

Follow me on Blogarama