Edit

Share via


New-AzLoadBalancerInboundNatRuleConfig

Creates an inbound NAT rule configuration for a load balancer.

Syntax

SetByResource (Default)

New-AzLoadBalancerInboundNatRuleConfig
    -Name <String>
    [-Protocol <String>]
    [-FrontendPort <Int32>]
    [-BackendPort <Int32>]
    [-IdleTimeoutInMinutes <Int32>]
    [-EnableFloatingIP]
    [-EnableTcpReset]
    [-FrontendIpConfiguration <PSFrontendIPConfiguration>]
    [-FrontendPortRangeStart <Int32>]
    [-FrontendPortRangeEnd <Int32>]
    [-BackendAddressPool <PSBackendAddressPool>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

SetByResourceId

New-AzLoadBalancerInboundNatRuleConfig
    -Name <String>
    [-Protocol <String>]
    [-FrontendPort <Int32>]
    [-BackendPort <Int32>]
    [-IdleTimeoutInMinutes <Int32>]
    [-EnableFloatingIP]
    [-EnableTcpReset]
    [-FrontendIpConfigurationId <String>]
    [-FrontendPortRangeStart <Int32>]
    [-FrontendPortRangeEnd <Int32>]
    [-BackendAddressPoolId <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The New-AzLoadBalancerInboundNatRuleConfig cmdlet creates an inbound network address translation (NAT) rule configuration for an Azure load balancer.

Examples

Example 1: Create an inbound NAT rule configuration for a load balancer

$publicip = New-AzPublicIpAddress -ResourceGroupName "MyResourceGroup" -Name "MyPublicIP" -Location "West US" -AllocationMethod "Dynamic"
$frontend = New-AzLoadBalancerFrontendIpConfig -Name "FrontendIpConfig01" -PublicIpAddress $publicip
New-AzLoadBalancerInboundNatRuleConfig -Name "MyInboundNatRule" -FrontendIPConfiguration $frontend -Protocol "Tcp" -FrontendPort 3389 -BackendPort 3389

The first command creates a public IP address named MyPublicIP in the resource group named MyResourceGroup, and then stores it in the $publicip variable. The second command creates a front-end IP configuration named FrontendIpConfig01 using the public IP address in $publicip, and then stores it in the $frontend variable. The third command creates an inbound NAT rule configuration named MyInboundNatRule using the front-end object in $frontend. The TCP protocol is specified and the front-end port is 3389, the same as the backend port in this case. The FrontendIpConfiguration, Protocol, FrontendPort, and BackendPort parameters are all required to create an inbound NAT rule configuration.

Example 2: Create an inbound NAT rule V2 configuration for a load balancer

$slb = Get-AzLoadBalancer -Name "MyLoadBalancer" -ResourceGroupName "MyResourceGroup"
$natRuleV2 = New-AzLoadBalancerInboundNatRuleConfig -Name natRuleV2 -Protocol "Tcp" -FrontendIpConfiguration $slb.FrontendIpConfigurations[0] -FrontendPortRangeStart 3390 -FrontendPortRangeEnd 4001 -BackendAddressPool $slb.BackendAddressPools[0] -IdleTimeoutInMinutes 4 -BackendPort 3389

The first command gets the load balancer named MyloadBalancer, and then stores it in the variable $slb. The second command creates an inbound NAT rule configuration named natRuleV2.The FrontendIpConfiguration, BackendAddressPool, Protocol, FrontendPortRangeStart, FrontendPortRangeEnd and BackendPort parameters are all required to create an inbound NAT rule V2 configuration.

Parameters

-BackendAddressPool

Specifies the backend address pool to associate with an inbound NAT rule configuration.

Parameter properties

Type:PSBackendAddressPool
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-BackendAddressPoolId

Specifies the ID of a BackendAddressPool object to associate with an inbound NAT rule configuration.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-BackendPort

Specifies the backend port for traffic that is matched by this rule configuration.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnableFloatingIP

Indicates that this cmdlet enables a floating IP address for a rule configuration.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnableTcpReset

Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-FrontendIpConfiguration

Specifies a list of front-end IP addresses to associate with a load balancer rule configuration.

Parameter properties

Type:PSFrontendIPConfiguration
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-FrontendIpConfigurationId

Specifies the ID for a front-end IP address configuration.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-FrontendPort

Specifies the front-end port that is matched by a load balancer rule configuration.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-FrontendPortRangeEnd

Specifies the last port number in the range of external ports that is used by a rule configuration. Acceptable values range between 1 and 65535.

Parameter properties

Type:

Nullable<T>[Int32]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-FrontendPortRangeStart

Specifies the first port number in the range of external ports that is used by a rule configuration. Acceptable values range between 1 and 65534.

Parameter properties

Type:

Nullable<T>[Int32]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-IdleTimeoutInMinutes

Specifies the length of time, in minutes, for which the state of conversations is maintained in a load balancer.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Name

Specifies the name of the rule configuration that this cmdlet creates.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Protocol

Specifies a protocol. The acceptable values for this parameter are:

  • Tcp
  • Udp

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

Int32

PSLoadBalancer

PSFrontendIPConfiguration

PSBackendAddressPool

Outputs

PSInboundNatRule