> For the complete documentation index, see [llms.txt](https://docs.mechcloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mechcloud.io/cloud-computing/stateless-iac/azure/examples-resources-with-cost/microsoft.network/load-balancer.md).

# Load Balancer

{% hint style="info" %}
**Updated**: February 13, 2026
{% endhint %}

{% hint style="info" %}
These examples assume that linked resources (VNet, Subnet, Public IP) already exist in the same resource group.
{% endhint %}

## Creating a Standard private Load Balancer

```yaml
defaults:
  resource_group: rg1

resources:
  - type: "Microsoft.Network/loadBalancers"
    name: "private-lb-microservice"
    api_version: "2025-05-01"
    sku:
      name: "Standard"
    props:
      frontend_ip_configurations:
        - name: "internal-fe"
          props:
            subnet:
              id: "/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"
            private_ip_allocation_method: "Dynamic"
      backend_address_pools:
        - name: "microservice-backend-pool"
      probes:
        - name: "microservice-probe"
          props:
            protocol: "Tcp"
            port: 5000
            interval_in_seconds: 5
            number_of_probes: 2
      load_balancing_rules:
        - name: "http-rule"
          props:
            protocol: "Tcp"
            frontend_port: 80
            backend_port: 5000
            frontend_ip_configuration:
              id: "ref:private-lb-microservice/frontend_ip_configurations/internal-fe"
            backend_address_pool:
              id: "ref:private-lb-microservice/backend_address_pools/microservice-backend-pool"
            probe:
              id: "ref:private-lb-microservice/probes/microservice-probe"
            enable_floating_ip: false
            idle_timeout_in_minutes: 4
```

### Example plan output

```
private-lb-microservice (action: create, monthly: $18.25, change: +100%)
  => Base Price (Includes 5 rules) (price: $0.025/Hrs, monthly: $18.25)
  => Additional Rules (price: $0.010/rule/Hrs, quantity: 0, monthly: $0.00)
  => Data transfer (price: $0.005/GB)
```

## Creating a Standard public Load Balancer

```yaml
defaults:
  resource_group: rg1

resources:
  - type: "Microsoft.Network/loadBalancers"
    name: "public-lb-microservice"
    api_version: "2025-05-01"
    sku:
      name: "Standard"
    props:
      frontend_ip_configurations:
        - name: "public-fe"
          props:
            public_ip_address:
              id: "/providers/Microsoft.Network/publicIPAddresses/lb-public-ip"

      backend_address_pools:
        - name: "microservice-backend-pool"

      probes:
        - name: "microservice-probe"
          props:
            protocol: "Tcp"
            port: 5000
            interval_in_seconds: 5
            number_of_probes: 2

      load_balancing_rules:
        - name: "http-rule"
          props:
            protocol: "Tcp"
            frontend_port: 80
            backend_port: 5000
            frontend_ip_configuration:
              id: "ref:public-lb-microservice/frontend_ip_configurations/public-fe"
            backend_address_pool:
              id: "ref:public-lb-microservice/backend_address_pools/microservice-backend-pool"
            probe:
              id: "ref:public-lb-microservice/probes/microservice-probe"
            enable_floating_ip: false
            idle_timeout_in_minutes: 4
```

### Example plan output

```
public-lb-microservice (action: create, monthly: $18.25, change: +100%)
  => Base Price (Includes 5 rules) (price: $0.025/Hr, monthly: $18.25)
  => Additional Rules (price: $0.01/rule/Hr, quantity: 0, monthly: $0.00)
  => Data transfer (price: $0.005/GB)
```
