{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-load-balancer/json-schema/microsoft-azure-load-balancer-load-balancing-rule-schema.json",
  "title": "LoadBalancingRule",
  "description": "A load balancing rule for a load balancer.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-load-balancer-load-balancers-api-openapi.yml#/components/schemas/LoadBalancingRule",
  "type": "object",
  "properties": {
    "properties": {
      "$ref": "#/$defs/LoadBalancingRulePropertiesFormat",
      "description": "Properties of load balancer load balancing rule.",
      "x-ms-client-flatten": true
    },
    "etag": {
      "type": "string",
      "description": "A unique read-only string that changes whenever the resource is updated.",
      "readOnly": true
    }
  },
  "allOf": [
    {
      "$ref": "#/$defs/SubResourceModel"
    }
  ],
  "$defs": {
    "LoadBalancingRulePropertiesFormat": {
      "type": "object",
      "description": "Properties of the load balancer.",
      "properties": {
        "frontendIPConfiguration": {
          "$ref": "#/$defs/SubResource",
          "description": "A reference to frontend IP addresses."
        },
        "backendAddressPool": {
          "$ref": "#/$defs/SubResource",
          "description": "A reference to a pool of DIPs. Inbound traffic is randomly load balanced across IPs in the backend IPs."
        },
        "backendAddressPools": {
          "type": "array",
          "description": "An array of references to pool of DIPs.",
          "items": {
            "$ref": "#/$defs/SubResource"
          }
        },
        "probe": {
          "$ref": "#/$defs/SubResource",
          "description": "The reference to the load balancer probe used by the load balancing rule."
        },
        "protocol": {
          "$ref": "#/$defs/TransportProtocol",
          "description": "The reference to the transport protocol used by the load balancing rule."
        },
        "loadDistribution": {
          "$ref": "#/$defs/LoadDistribution",
          "description": "The load distribution policy for this rule."
        },
        "frontendPort": {
          "type": "integer",
          "format": "int32",
          "description": "The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer. Acceptable values are between 0 and 65534. Note that value 0 enables \"Any Port\"."
        },
        "backendPort": {
          "type": "integer",
          "format": "int32",
          "description": "The port used for internal connections on the endpoint. Acceptable values are between 0 and 65535. Note that value 0 enables \"Any Port\"."
        },
        "idleTimeoutInMinutes": {
          "type": "integer",
          "format": "int32",
          "description": "The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP."
        },
        "enableFloatingIP": {
          "type": "boolean",
          "description": "Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed after you create the endpoint."
        },
        "enableTcpReset": {
          "type": "boolean",
          "description": "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."
        },
        "disableOutboundSnat": {
          "type": "boolean",
          "description": "Configures SNAT for the VMs in the backend pool to use the publicIP address specified in the frontend of the load balancing rule."
        },
        "enableConnectionTracking": {
          "type": "boolean",
          "description": "Enables UDP flow tracking for the load balancing rule. This property is retained for rule-level configuration compatibility. When enableConnectionTracking is specified on the associated frontend IP configuration, the frontend setting takes precedence."
        },
        "provisioningState": {
          "$ref": "#/$defs/ProvisioningState",
          "description": "The provisioning state of the load balancing rule resource.",
          "readOnly": true
        }
      },
      "required": [
        "protocol",
        "frontendPort"
      ]
    },
    "LoadDistribution": {
      "type": "string",
      "description": "The load distribution policy for this rule.",
      "enum": [
        "Default",
        "SourceIP",
        "SourceIPProtocol"
      ],
      "x-ms-enum": {
        "name": "LoadDistribution",
        "modelAsString": true,
        "values": [
          {
            "name": "Default",
            "value": "Default",
            "description": "Default"
          },
          {
            "name": "SourceIP",
            "value": "SourceIP",
            "description": "SourceIP"
          },
          {
            "name": "SourceIPProtocol",
            "value": "SourceIPProtocol",
            "description": "SourceIPProtocol"
          }
        ]
      }
    },
    "ProvisioningState": {
      "type": "string",
      "description": "Provisioning states of a resource.",
      "enum": [
        "Failed",
        "Succeeded",
        "Canceled",
        "Creating",
        "Updating",
        "Deleting"
      ],
      "x-ms-enum": {
        "name": "ProvisioningState",
        "modelAsString": true,
        "values": [
          {
            "name": "Failed",
            "value": "Failed",
            "description": "Failed"
          },
          {
            "name": "Succeeded",
            "value": "Succeeded",
            "description": "Succeeded"
          },
          {
            "name": "Canceled",
            "value": "Canceled",
            "description": "Canceled"
          },
          {
            "name": "Creating",
            "value": "Creating",
            "description": "Creating"
          },
          {
            "name": "Updating",
            "value": "Updating",
            "description": "Updating"
          },
          {
            "name": "Deleting",
            "value": "Deleting",
            "description": "Deleting"
          }
        ]
      }
    },
    "SubResource": {
      "type": "object",
      "description": "Reference to another subresource.",
      "properties": {
        "id": {
          "type": "string",
          "description": "Resource ID."
        }
      }
    },
    "SubResourceModel": {
      "type": "object",
      "description": "Reference to another subresource.",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the resource."
        },
        "type": {
          "type": "string",
          "description": "Resource type.",
          "readOnly": true
        }
      },
      "allOf": [
        {
          "$ref": "#/$defs/SubResource"
        }
      ],
      "x-ms-azure-resource": true
    },
    "TransportProtocol": {
      "type": "string",
      "description": "The transport protocol for the endpoint.",
      "enum": [
        "Udp",
        "Tcp",
        "All",
        "Quic"
      ],
      "x-ms-enum": {
        "name": "TransportProtocol",
        "modelAsString": true,
        "values": [
          {
            "name": "Udp",
            "value": "Udp",
            "description": "Udp"
          },
          {
            "name": "Tcp",
            "value": "Tcp",
            "description": "Tcp"
          },
          {
            "name": "All",
            "value": "All",
            "description": "All"
          },
          {
            "name": "Quic",
            "value": "Quic",
            "description": "Quic"
          }
        ]
      }
    }
  }
}