无法通过azure ARM VPN连接中的Rasdail进行连接
我无法使用powershell cmdlet连接到VPN。我使用构建代理的“rasdial”连接到vpn,这样我们就可以触发自动测试。整个过程是自动化的 早些时候,同样的rasdial命令--无法通过azure ARM VPN连接中的Rasdail进行连接,azure,azure-virtual-network,azure-vpn,Azure,Azure Virtual Network,Azure Vpn,我无法使用powershell cmdlet连接到VPN。我使用构建代理的“rasdial”连接到vpn,这样我们就可以触发自动测试。整个过程是自动化的 早些时候,同样的rasdial命令--rasdial“VPNName”在vpn的经典模型(ASM)上运行得非常好。但是,在我迁移到ARM之后,我面临着这个问题。然而,通过用户界面,即点击按钮连接到vpn工作正常,但我们需要通过脚本连接 我收到一条消息- 此系统不支持此功能 注:我正在关注这篇帖子- 同样的解决方法在ASM中有效,但在ARM中不起
rasdial“VPNName”
在vpn的经典模型(ASM)上运行得非常好。但是,在我迁移到ARM之后,我面临着这个问题。然而,通过用户界面,即点击按钮连接到vpn工作正常,但我们需要通过脚本连接
我收到一条消息-
此系统不支持此功能
注:我正在关注这篇帖子-
同样的解决方法在ASM中有效,但在ARM中不起作用。还有什么其他解决方法或修复方法
我正在使用下面的脚本创建和下载VPN包。我不确定我的脚本中是否缺少导致此问题的内容-
$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
因为我能够使用GUI进行连接。我希望脚本能完成它的工作。您的PowerShell脚本看起来很好(我没有尝试登录和资源组,但从$fesub开始,其他一切都可以运行。)除了底部的第三行。当前作为“P2SVNETRootCertName”的-Name标记需要与$P2SRootCertName相同。有关更多信息,请参阅Azure文档: 至于Rasdail,另一个StackOverflow帖子回答了这个问题:
-Bridget[MSFT]四个月后,我收到了MS的回复(我为此提出了一张罚单)。 他们告诉Rasdail到目前为止不受Azure VPN客户端包的支持。此外,即使在解构azure点到点vpn之后,也没有添加路由,应该通过显式添加路由来注意这一点 因此,作为一种解决方法,我执行了博客中提供的步骤- 然而,添加路由的最后一部分有点复杂。因此,为了添加路由,我创建了自己的PS脚本-
$Subnet = @("10.0.1.0", "10.0.2.0","10.0.3.0")
$VPNClientAddressPool = "x.x.x"
$Mask = "255.255.0.0"
$azureIpAddress = ""
$VPNCmd = "MYVPNName"
这里x.x.x是3个八位组,可以在VPN的“网关-点到站点配置”中找到-
这就解决了我的问题。基本上,您只需要处理路由添加部分。P2SVNETRootCertName与$P2SRootCertName相同。在发布我的问题之前,已通过自动连接问答链接。就我而言,这也不起作用。无论如何谢谢你
$routeExists = route print | findstr $VPNClientAddressPool
if($routeExists)
{
route delete $Subnet
}
rasdial $VPNCmd > $null
$azureIPAddress = ipconfig | findstr $VPNClientAddressPool
if($azureIPAddress -ne $null)
{
$azureIpAddress = $azureIpAddress.Split(": ")
$azureIpAddress = $azureIpAddress[$azureIpAddress.Length-1]
$azureIpAddress = $azureIpAddress.Trim()
route add $Subnet MASK $Mask $azureIPAddress
}