Editar

Compartilhar via


Set-AzLoadBalancerInboundNatRuleConfig

Sets an inbound NAT rule configuration for a load balancer.

Syntax

Set-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>]
Set-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 Set-AzLoadBalancerInboundNatRuleConfig cmdlet sets an inbound network address translation (NAT) rule configuration for an Azure load balancer.

Examples

Example 1: Modify the inbound NAT rule configuration on 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-AzLoadBalancerInboundNatRuleConfig -Name "NewNatRule" -FrontendIPConfiguration $slb.FrontendIpConfigurations[0] -Protocol "Tcp" -FrontendPort 3350 -BackendPort 3350

The first command gets the load balancer named MyLoadBalancer, and then stores it in the $slb variable. 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 it. The third command passes the load balancer to Set-AzLoadBalancerInboundNatRuleConfig, which saves and updates the inbound NAT rule configuration. Note that the rule configuration was set without enabling floating IP, which had been enabled by the previous command.

Example 2

Sets an inbound NAT rule configuration for a load balancer. (autogenerated)

Set-AzLoadBalancerInboundNatRuleConfig -BackendPort 3350 -FrontendIpConfigurationId <String> -FrontendPort 3350 -LoadBalancer <PSLoadBalancer> -Name 'NewNatRule' -Protocol 'Tcp'

Example 3: Modify the inbound NAT rule V2 configuration on 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-AzLoadBalancerInboundNatRuleConfig -Name "NewNatRuleV2" -FrontendIPConfiguration $slb.FrontendIpConfigurations[0] -Protocol "Tcp" -IdleTimeoutInMinutes 10 -FrontendPortRangeStart 3370 -FrontendPortRangeEnd 3389 -BackendAddressPool $slb.BackendAddressPools[0] -BackendPort 3380

The first command gets the load balancer named MyLoadBalancer, and then stores it in the $slb variable. 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 it. The third command passes the load balancer to Set-AzLoadBalancerInboundNatRuleConfig, which saves and updates the inbound NAT rule V2 configuration. Note that FrontendPortRangeStart, FrontendPortRangeEnd and BackendPort are changed in rule configuration.

Parameters

-BackendAddressPool

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

Type:PSBackendAddressPool
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-BackendAddressPoolId

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-BackendPort

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

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Confirm

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

-DefaultProfile

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

-EnableFloatingIP

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

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FrontendIpConfiguration

Specifies a list of front-end IP addresses to associate with an inbound NAT rule configuration.

Type:PSFrontendIPConfiguration
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-FrontendIpConfigurationId

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-FrontendPort

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

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters: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.

Type:Nullable<T>[Int32]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters: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.

Type:Nullable<T>[Int32]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-IdleTimeoutInMinutes

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

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-LoadBalancer

Specifies a load balancer. This cmdlet sets an inbound NAT rule configuration for the load balancer that this parameter specifies.

Type:PSLoadBalancer
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specifies the name of an inbound NAT rule configuration.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Protocol

Specifies the protocol that is matched by an inbound NAT rule configuration. The acceptable values for this parameter are: Tcp or Udp.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

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

Inputs

PSLoadBalancer

String

Int32

PSFrontendIPConfiguration

PSBackendAddressPool

Outputs

PSLoadBalancer