Edit

Share via


Add-AzLoadBalancerInboundNatRuleConfig

Adds an inbound NAT rule configuration to a load balancer.

Syntax

SetByResource (Default)

Add-AzLoadBalancerInboundNatRuleConfig
    -LoadBalancer <PSLoadBalancer>
    -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

Add-AzLoadBalancerInboundNatRuleConfig
    -LoadBalancer <PSLoadBalancer>
    -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 Add-AzLoadBalancerInboundNatRuleConfig cmdlet adds an inbound network address translation (NAT) rule configuration to an Azure load balancer.

Examples

Example 1: Add an inbound NAT rule configuration to a load balancer

$slb = Get-AzLoadBalancer -Name "MyLoadBalancer" -ResourceGroupName "MyResourceGroup"
$slb | Add-AzLoadBalancerInboundNatRuleConfig -Name "NewNatRule" -FrontendIPConfiguration $slb.FrontendIpConfigurations[0] -Protocol "Tcp" -FrontendPort 3350 -BackendPort 3350 -EnableFloatingIP
$slb | Set-AzLoadBalancer

The first command gets the load balancer named MyloadBalancer, and then stores it in the variable $slb. The second command uses the pipeline operator to pass the load balancer in $slb to Add-AzLoadBalancerInboundNatRuleConfig, which adds an inbound NAT rule configuration to the load balancer. The last command sets the configuration to the loadbalancer, if you don't perform Set-AzLoadBalancer, your changes will not be applied to the loadbalancer.

Example 2: Add an inbound NAT rule V2 configuration to a load balancer

$slb = Get-AzLoadBalancer -Name "MyLoadBalancer" -ResourceGroupName "MyResourceGroup"
$slb | Add-AzLoadBalancerInboundNatRuleConfig -Name "NewNatRuleV2" -FrontendIPConfiguration $slb.FrontendIpConfigurations[0] -Protocol "Tcp" -IdleTimeoutInMinutes 10 -FrontendPortRangeStart 3389 -FrontendPortRangeEnd 4000 -BackendAddressPool $slb.BackendAddressPools[0] -BackendPort 3389
$slb | Set-AzLoadBalancer

The first command gets the load balancer named MyloadBalancer, and then stores it in the variable $slb. The second command uses the pipeline operator to pass the load balancer in $slb to Add-AzLoadBalancerInboundNatRuleConfig, which adds an inbound NAT rule V2 configuration to the load balancer. The last command sets the configuration to the loadbalancer, if you don't perform Set-AzLoadBalancer, your changes will not be applied to the loadbalancer.

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 matched by a 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 an inbound NAT 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 an 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 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, that 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

-LoadBalancer

Specifies a LoadBalancer object. This cmdlet adds an inbound NAT rule configuration to the load balancer that this parameter specifies.

Parameter properties

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

Parameter sets

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

-Name

Specifies the name of the inbound NAT rule configuration to add.

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 the protocol that is matched by an inbound NAT rule. The acceptable values for this parameter are: Tcp or 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

PSLoadBalancer

String

Int32

PSFrontendIPConfiguration

PSBackendAddressPool

Outputs

PSLoadBalancer