我使用 PowerShell 创建了一个 Azure 虚拟网络:
$gwpip= New-AzureRmPublicIpAddress -Name TestVNet -ResourceGroupName TestRg -Location 'West Europe' -AllocationMethod Dynamic -DomainNameLabel TestVNet
$vnet = Get-AzureRmVirtualNetwork -Name TestVNet -ResourceGroupName TestRg
$subnet = Get-AzureRmVirtualNetworkSubnetConfig -Name 'GatewaySubnet' -VirtualNetwork $vnet
$gwipconfig = New-AzureRmVirtualNetworkGatewayIpConfig -Name TestVNet -SubnetId $subnet.Id -PublicIpAddressId $gwpip.Id
New-AzureRmVirtualNetworkGateway -Name TestVNet -ResourceGroupName TestRg -Location 'West Europe' -IpConfigurations $gwipconfig -GatewayType Vpn -VpnType RouteBased
这非常有效。我现在想删除这个虚拟网络网关,但这似乎不起作用。当我使用门户中的删除按钮时,我收到一条消息:“已成功将配置更改保存到虚拟网络 TestVNet”
当我使用 PowerShell 时,它不会返回任何内容,除非我使用 -debug 和 -verbose 开关。
Remove-AzureRmVirtualNetworkGateway -Name TestVNet -ResourceGroupName TestRg -Force -Verbose -Debug
最终的 HTTP 响应说:
Body:
{
"status": "Failed",
"error": {
"code": "InternalServerError",
"message": "An error occured.",
"details": []
}
当我检查门户中的审核日志时,我看到两个 Microsoft.Network/virtualNetworkGateways/delete 事件,都是信息性的。第一个状态为已启动,第二个已接受。在那之后,什么都没有发生了。使用门户或 PowerShell 不会对审核日志产生影响。
关于如何删除网关的任何建议?