az network lb rule

Manage load balancing rules.

Commands

az network lb rule create Create a load balancing rule.
az network lb rule delete Delete a load balancing rule.
az network lb rule list List load balancing rules.
az network lb rule show Get the details of a load balancing rule.
az network lb rule update Update a load balancing rule.

az network lb rule create

Create a load balancing rule.

az network lb rule create --backend-port
--frontend-port
--lb-name
--name
--protocol {All, Tcp, Udp}
--resource-group
[--backend-pool-name]
[--disable-outbound-snat {false, true}]
[--enable-tcp-reset {false, true}]
[--floating-ip {false, true}]
[--frontend-ip-name]
[--idle-timeout]
[--load-distribution {Default, SourceIP, SourceIPProtocol}]
[--probe-name]
[--subscription]

Examples

Create a load balancing rule that assigns a front-facing IP configuration and port to an address pool and port.

az network lb rule create -g MyResourceGroup --lb-name MyLb -n MyLbRule --protocol Tcp \
    --frontend-ip-name MyFrontEndIp --frontend-port 80 \
    --backend-pool-name MyAddressPool --backend-port 80

Create a load balancing rule that assigns a front-facing IP configuration and port to an address pool and port with the floating ip feature.

az network lb rule create -g MyResourceGroup --lb-name MyLb -n MyLbRule --protocol Tcp \
    --frontend-ip-name MyFrontEndIp --backend-pool-name MyAddressPool  \
    --floating-ip true --frontend-port 80 --backend-port 80

Create an HA ports load balancing rule that assigns a frontend IP and port to use all available backend IPs in a pool on the same port.

az network lb rule create -g MyResourceGroup --lb-name MyLb -n MyHAPortsRule \
    --protocol All --frontend-port 0 --backend-port 0 --frontend-ip-name MyFrontendIp \
    --backend-pool-name MyAddressPool

Required Parameters

--backend-port

Port number.

--frontend-port

Port number.

--lb-name

The load balancer name.

--name -n

The name of the load balancing rule.

--protocol

Network transport protocol.

accepted values: All, Tcp, Udp
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--backend-pool-name

The name of the backend address pool. If only one exists, omit to use as default.

--disable-outbound-snat

Configures SNAT for the VMs in the backend pool to use the publicIP address specified in the frontend of the load balancing rule.

accepted values: false, true
--enable-tcp-reset

Receive bidirectional TCP reset on TCP flow idle timeout or unexpected connection termination. Only used when protocol is set to TCP.

accepted values: false, true
--floating-ip

Enable floating IP.

accepted values: false, true
--frontend-ip-name

The name of the frontend IP configuration. If only one exists, omit to use as default.

--idle-timeout

Idle timeout in minutes.

--load-distribution

Affinity rule settings.

accepted values: Default, SourceIP, SourceIPProtocol
default value: default
--probe-name

Name of an existing probe to associate with this rule.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az network lb rule delete

Delete a load balancing rule.

az network lb rule delete --lb-name
--name
--resource-group
[--subscription]

Examples

Delete a load balancing rule.

az network lb rule delete -g MyResourceGroup --lb-name MyLb -n MyLbRule

Required Parameters

--lb-name

The name of the load balancer.

--name -n

The name of the load balancing rule.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az network lb rule list

List load balancing rules.

az network lb rule list --lb-name
--resource-group
[--subscription]

Examples

List load balancing rules.

az network lb rule list -g MyResourceGroup --lb-name MyLb -o table

Required Parameters

--lb-name

The name of the load balancer.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az network lb rule show

Get the details of a load balancing rule.

az network lb rule show --lb-name
--name
--resource-group
[--subscription]

Examples

Get the details of a load balancing rule.

az network lb rule show -g MyResourceGroup --lb-name MyLb -n MyLbRule

Required Parameters

--lb-name

The name of the load balancer.

--name -n

The name of the load balancing rule.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az network lb rule update

Update a load balancing rule.

az network lb rule update [--add]
[--backend-pool-name]
[--backend-port]
[--disable-outbound-snat {false, true}]
[--enable-tcp-reset {false, true}]
[--floating-ip {false, true}]
[--force-string]
[--frontend-ip-name]
[--frontend-port]
[--idle-timeout]
[--ids]
[--lb-name]
[--load-distribution {Default, SourceIP, SourceIPProtocol}]
[--name]
[--probe-name]
[--protocol {All, Tcp, Udp}]
[--remove]
[--resource-group]
[--set]
[--subscription]

Examples

Update a load balancing rule to change the protocol to UDP.

az network lb rule update -g MyResourceGroup --lb-name MyLb -n MyLbRule --protocol Udp

Update a load balancing rule to support HA ports.

az network lb rule update -g MyResourceGroup --lb-name MyLb -n MyLbRule \ --protocol All --frontend-port 0 --backend-port 0

Update a load balancing rule. (autogenerated)

az network lb rule update --disable-outbound-snat true --lb-name MyLb --name MyLbRule --resource-group MyResourceGroup

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

--backend-pool-name

The name of the backend address pool.

--backend-port

Port number.

--disable-outbound-snat

Configures SNAT for the VMs in the backend pool to use the publicIP address specified in the frontend of the load balancing rule.

accepted values: false, true
--enable-tcp-reset

Receive bidirectional TCP reset on TCP flow idle timeout or unexpected connection termination. Only used when protocol is set to TCP.

accepted values: false, true
--floating-ip

Enable floating IP.

accepted values: false, true
--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

--frontend-ip-name

The name of the frontend IP configuration.

--frontend-port

Port number.

--idle-timeout

Idle timeout in minutes.

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--lb-name

The load balancer name.

--load-distribution

Affinity rule settings.

accepted values: Default, SourceIP, SourceIPProtocol
default value: default
--name -n

The name of the load balancing rule.

--probe-name

Name of an existing probe to associate with this rule.

--protocol

Network transport protocol.

accepted values: All, Tcp, Udp
--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.