title: Not able to connect through Rasdial in azure ARM VPN connection
body: <p>I am not able connect to VPN using powershell cmdlet. I use 'rasdial' from a build agent to connect to vpn, so that we can trigger automated tests. The whole process is automated. </p>
  
  <p>Earlier same rasdial command - <code>Rasdial "VPNName"</code> was working perfectly fine with classic model (ASM) of vpn. But, after I migrated to ARM, I am facing this issue. However through UI i.e. clicking on buttons to connect to vpn is working fine but our need is to connect through script.</p>
  
  <p>I am getting a message-</p>
  
  <blockquote>
    <p>This function is not supported on this system.</p>
  </blockquote>
  
  <p>NB: I am following this post- <a href="https://dzone.com/articles/deconstructing-azure-point" rel="nofollow">https://dzone.com/articles/deconstructing-azure-point</a></p>
  
  <p>The same workaround worked in ASM but not woking in ARM. What can be another workaround or fix for this ?</p>
  
  <p>I am using below script to create and download the VPN package. I am not sure I am missing something in my script which is causing this issue-</p>
  
  <pre><code>$VNetName  = "MYVPN"
  $SubName = "Subnet-1"
  $GWSubName = "GatewaySubnet"
  $VNetPrefix1 = "15.3.0.0/16"
  $SubPrefix = "15.3.1.0/24"
  $GWSubPrefix = "15.3.200.0/26"
  $VPNClientAddressPool = "158.17.201.0/24"
  $RG = "VMsRG"
  $Location = "West Europe"
  $DNS = "15.3.0.0"
  $GWName = "GateWay"
  $GWIPName = "GateWayIP"
  $GWIPconfName = "GateWayIPConfig"
  $P2SRootCertName = "XXXXX.cer"
  $DeployUserName = "atf@hotmail.com"
  $DeployUserPassword = "XXXXX" 
  
  $Azurepwd = ConvertTo-SecureString $DeployUserPassword -AsPlainText -Force
  $AzureCredential = new-object -typename System.Management.Automation.PSCredential -argumentlist $DeployUserName, $Azurepwd 
  Add-AzureRmAccount -credential $AzureCredential -SubscriptionName Development
  
  New-AzureRmResourceGroup -Name $RG -Location $Location
  $fesub = New-AzureRmVirtualNetworkSubnetConfig -Name $SubName -AddressPrefix $SubPrefix
  $gwsub = New-AzureRmVirtualNetworkSubnetConfig -Name $GWSubName -AddressPrefix $GWSubPrefix
  New-AzureRmVirtualNetwork -Name $VNetName -ResourceGroupName $RG -Location $Location -AddressPrefix $VNetPrefix1 -Subnet $fesub, $gwsub -DnsServer $DNS
  
  $vnet = Get-AzureRmVirtualNetwork -Name $VNetName -ResourceGroupName $RG
  $subnet = Get-AzureRmVirtualNetworkSubnetConfig -Name "GatewaySubnet" -VirtualNetwork $vnet
  
  $pip = New-AzureRmPublicIpAddress -Name $GWIPName -ResourceGroupName $RG -Location $Location -AllocationMethod dynamic
  
  $ipconf = New-AzureRmVirtualNetworkGatewayIpConfig -Name $GWIPconfName -Subnet $subnet -PublicIpAddress $pip
  
  $MyP2SRootCertPubKeyBase64 = "XXXXX"
  $p2srootcert = New-AzureRmVpnClientRootCertificate -Name "P2SVNETRootCertName" -PublicCertData $MyP2SRootCertPubKeyBase64
  New-AzureRmVirtualNetworkGateway -Name $GWName -ResourceGroupName $RG -Location $Location -IpConfigurations $ipconf -GatewayType Vpn -VpnType RouteBased -EnableBgp $false -GatewaySku Standard -VpnClientAddressPool $VPNClientAddressPool -VpnClientRootCertificates $p2srootcert
  Get-AzureRmVpnClientPackage -ResourceGroupName $RG -VirtualNetworkGatewayName $GWName -ProcessorArchitecture Amd64
  </code></pre>
  
  <p>As I am able to connect using GUI. I hope script is doing it's job.</p>