共用方式為


Remove-AzVpnGatewayNatRule

移除與 VpnGateway 相關聯的 NAT 規則。

語法

ByVpnGatewayNatRuleName (預設值)

Remove-AzVpnGatewayNatRule
    -ResourceGroupName <String>
    -ParentResourceName <String>
    -Name <String>
    [-Force]
    [-PassThru]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByVpnGatewayNatRuleResourceId

Remove-AzVpnGatewayNatRule
    -ResourceId <String>
    [-Force]
    [-PassThru]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByVpnGatewayNatRuleObject

Remove-AzVpnGatewayNatRule
    -InputObject <PSVpnGatewayNatRule>
    [-Force]
    [-PassThru]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

移除與 VpnGateway 相關聯的 NAT 規則。

範例

範例1

New-AzResourceGroup -Location "West US" -Name "testRG"
$virtualWan = New-AzVirtualWan -ResourceGroupName testRG -Name myVirtualWAN -Location "West US"
$virtualHub = New-AzVirtualHub -VirtualWan $virtualWan -ResourceGroupName "testRG" -Name "westushub" -AddressPrefix "10.0.0.1/24"
New-AzVpnGateway -ResourceGroupName "testRG" -Name "testvpngw" -VirtualHubId $virtualHub.Id -VpnGatewayScaleUnit 2
$vpnGateway = Get-AzVpnGateway -ResourceGroupName "testRG" -Name "testvpngw"
New-AzVpnGatewayNatRule -ResourceGroupName $vpnGateway.ResourceGroupName -ParentResourceName $vpnGateway.Name -Name "testNatRule" -Type Static -Mode EgressSnat -InternalMapping "10.0.0.1/26" -ExternalMapping "192.168.0.0/26"
Remove-AzVpnGatewayNatRule -ResourceGroupName $vpnGateway.ResourceGroupName -ParentResourceName $vpnGateway.Name -Name "testNatRule"

上述內容會建立與該 VpnGateway 相關聯的資源群組、虛擬 WAN、虛擬網路、虛擬中樞、VpnGateway 和 NAT 規則。 然後,它會使用 NAT 規則名稱移除 NAT 規則。

參數

-Confirm

在執行 Cmdlet 之前,提示您進行確認。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False
別名:參閱

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-DefaultProfile

用於與 Azure 通訊的認證、帳戶、租用戶和訂用帳戶。

參數屬性

類型:IAzureContextContainer
預設值:None
支援萬用字元:False
不要顯示:False
別名:AzContext, AzureRmContext, AzureCredential

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Force

如果您想刪除資源,請勿要求確認

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-InputObject

要更新的 VpnGatewayNatRule 物件。

參數屬性

類型:PSVpnGatewayNatRule
預設值:None
支援萬用字元:False
不要顯示:False
別名:VpnGatewayNatRule

參數集

ByVpnGatewayNatRuleObject
Position:Named
必要:True
來自管線的值:True
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Name

資源名稱。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False
別名:資源名稱, VpnGatewayNatRuleName

參數集

ByVpnGatewayNatRuleName
Position:Named
必要:True
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-ParentResourceName

父資源名稱。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False
別名:ParentVpnGatewayName, VpnGatewayName

參數集

ByVpnGatewayNatRuleName
Position:Named
必要:True
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-PassThru

傳回一個物件,代表正在執行此作業的專案。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-ResourceGroupName

資源組名。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

ByVpnGatewayNatRuleName
Position:Named
必要:True
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-ResourceId

要刪除的 VpnGatewayNatRule 物件的資源識別碼。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False
別名:VpnGatewayNatRuleId

參數集

ByVpnGatewayNatRuleResourceId
Position:Named
必要:True
來自管線的值:False
來自管線按屬性名稱的值:True
來自剩餘引數的值:False

-WhatIf

顯示 Cmdlet 執行時會發生什麼事。 指令未執行。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False
別名:威斯康星州

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

CommonParameters

此 Cmdlet 支援常見參數:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 如需詳細資訊,請參閱 about_CommonParameters

輸入

String

PSVpnGatewayNatRule

輸出

Boolean