New-AzVirtualNetworkGatewayNatRule
Creates the virtual network gateway natRule object.
Note
This is the previous version of our documentation. Please consult the most recent version for up-to-date information.
Syntax
New-AzVirtualNetworkGatewayNatRule
-Name <String>
-Type <String>
-Mode <String>
-InternalMapping <String[]>
-ExternalMapping <String[]>
[-IpConfigurationId <String>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
New-AzVirtualNetworkGatewayNatRule cmdlet creates a PSVirtualNetworkGatewayNatRule object which represents natRules property in your virtual network gateway.
Examples
Example 1
$gateway = Get-AzVirtualNetworkGateway -ResourceGroupName myRg -Name gw1
$natRule = New-AzVirtualNetworkGatewayNatRule -Name "natRule1" -Type "Static" -Mode "IngressSnat" -InternalMapping @("25.0.0.0/16") -ExternalMapping @("30.0.0.0/16")
Set-AzVirtualNetworkGateway -VirtualNetworkGateway $gateway -NatRule $natRule
The first command gets a virtual network gateway named gw1 that belongs to resource group myRg and stores it to the variable named $gateway The second command creates a new PSVirtualNetworkGatewayNatRuleirtual object. The third command updates the virtual network gateway gw1 with the with newly added natRule.
Parameters
Run cmdlet in the background
| Type: | SwitchParameter |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The credentials, account, tenant, and subscription used for communication with Azure.
| Type: | IAzureContextContainer |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The list of private IP address subnet external mappings for NAT
| Type: | String[] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The list of private IP address subnet internal mappings for NAT
| Type: | String[] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The IP Configuration ID this NAT rule applies to
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The Source NAT direction of a VPN NAT
| Type: | String |
| Accepted values: | EgressSnat, IngressSnat |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The resource name.
| Type: | String |
| Aliases: | ResourceName, VirtualNetworkGatewayNatRuleName |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The type of NAT rule for VPN NAT
| Type: | String |
| Accepted values: | Static, Dynamic |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Inputs
None
Outputs
PSVirtualNetworkGatewayNatRule