New-AzVirtualNetworkGatewayNatRule
Creates the virtual network gateway natRule object.
New-AzVirtualNetworkGatewayNatRule
-Name <String>
-Type <String>
-Mode <String>
-InternalMapping <String[]>
-ExternalMapping <String[]>
[-InternalPortRange <String[]>]
[-ExternalPortRange <String[]>]
[-IpConfigurationId <String>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzVirtualNetworkGatewayNatRule cmdlet creates a PSVirtualNetworkGatewayNatRule object which represents natRules property in your virtual network gateway.
$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") -InternalPortRange @("100-100") -ExternalPortRange @("200-200")
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.
Run cmdlet in the background
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
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 |
Required: | False |
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 |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The list of external port range mappings for NAT subnets
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
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 |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The list of internal port range mappings for NAT subnets
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The IP Configuration ID this NAT rule applies to
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
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 |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The resource name.
Type: | String |
Aliases: | ResourceName, VirtualNetworkGatewayNatRuleName |
Position: | Named |
Default value: | None |
Required: | True |
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 |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
None
Azure PowerShell feedback
Azure PowerShell is an open source project. Select a link to provide feedback: