0
votes

I am using the new Resource Manager interface to create my Virtual Network. And I can't figure out how to configure a Point-To-Site VPN and get the VPN client thru the Powershell API.

My Script:

$accountName = "[email protected]"
$subscriptionId = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
$vnetname = "VNet1"
$rgname = "MyRG"
$sharedKey = -join(97..122|%{[char]$_}|Get-Random -C 20)

Get-AzureAccount -Name $accountName
Set-AzureSubscription -SubscriptionId $subscriptionId
New-AzureResourceGroup -Name "MyRG" -Location "Central US" -Force

$subnet  = New-AzureVirtualNetworkSubnetConfig -Name 'GatewaySubnet' -AddressPrefix '10.192.0.0/24'

New-AzureVirtualNetwork -Name $vnetname -ResourceGroupName $rgname -Location "Central US" -AddressPrefix '10.0.0.0/8' -Subnet $subnet -Force

I go into the new Portal and only have DNS options to create, no ability to create a VPN gateway. I tried scripting it, but couldn't figure out the point to site piece. Any suggestions?

Gateway script:

$gwip = New-AzurePublicIpAddress -Name ($vnetname + "gwip") -ResourceGroupName $rgname -Location $location -AllocationMethod Dynamic
$vnet = Get-AzureVirtualNetwork -Name $vnetname -ResourceGroupName $rgname
$subnet = Get-AzureVirtualNetworkSubnetConfig -Name 'GatewaySubnet' -VirtualNetwork $vnet
$gwipconfig = New-AzureVirtualNetworkGatewayIpConfig -Name ($vnetname + "gwipconfig") -SubnetId $subnet.Id -PublicIpAddressId $gwip.Id
$gw = New-AzureVirtualNetworkGateway -Name ($vnetname + "gw1") -ResourceGroupName $rgname -Location "Central US" -IpConfigurations $gwipconfig -GatewayType Vpn -VpnType RouteBased
$localGw = New-AzureLocalNetworkGateway -Name ($vnetname + "gw1-local") -ResourceGroupName $rgname -Location "Central US" -GatewayIpAddress $gwipconfig -AddressPrefix '172.16.0.0/24'

New-AzureVirtualNetworkGatewayConnection -Name ($vnetname + "gw1-conn") -ResourceGroupName $rgname -Location "Central US" -VirtualNetworkGateway1 $gw -LocalNetworkGateway2 $localGw -ConnectionType IPsec -RoutingWeight 10 -SharedKey $sharedKey 
2
It is now possible. You can recheck on what you need to do. - activatedgeek
@activatedgeek do you have any guide for creating a point-to-site virtual network using PowerShell? you said that its now possible, but I had unsuccessful trials trying to run it. - Ahmed IG
If you are familiar with the Azure Resource Templates, check here. Simply execute this template with appropriate parameters using PowerShell. (Sorry, can't help you more, not a Windows user.) - activatedgeek

2 Answers

1
votes

This was added 1/19/2016, the Powershell on how to create a Point to Site VPN in a Resource manager Network

https://azure.microsoft.com/en-us/documentation/articles/vpn-gateway-howto-point-to-site-rm-ps/

-1
votes

There is a one week old Document in the MS Azure documentation saying that it is not possible (yet) under the Resource Manager model.

This article applies to point-to-site connections for virtual networks created using the classic deployment model (Service Management). At this time, point-to-site connections to a virtual network created using the Azure Resource Manager deployment model are not supported.