We recommend using Azure Native.
Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi
azure.lb.getLB
Explore with Pulumi AI
Use this data source to access information about an existing Load Balancer
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.lb.getLB({
    name: "example-lb",
    resourceGroupName: "example-resources",
});
export const loadbalancerId = example.then(example => example.id);
import pulumi
import pulumi_azure as azure
example = azure.lb.get_lb(name="example-lb",
    resource_group_name="example-resources")
pulumi.export("loadbalancerId", example.id)
package main
import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/lb"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := lb.GetLB(ctx, &lb.GetLBArgs{
			Name:              "example-lb",
			ResourceGroupName: "example-resources",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("loadbalancerId", example.Id)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() => 
{
    var example = Azure.Lb.GetLB.Invoke(new()
    {
        Name = "example-lb",
        ResourceGroupName = "example-resources",
    });
    return new Dictionary<string, object?>
    {
        ["loadbalancerId"] = example.Apply(getLBResult => getLBResult.Id),
    };
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.lb.LbFunctions;
import com.pulumi.azure.lb.inputs.GetLBArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var example = LbFunctions.getLB(GetLBArgs.builder()
            .name("example-lb")
            .resourceGroupName("example-resources")
            .build());
        ctx.export("loadbalancerId", example.applyValue(getLBResult -> getLBResult.id()));
    }
}
variables:
  example:
    fn::invoke:
      function: azure:lb:getLB
      arguments:
        name: example-lb
        resourceGroupName: example-resources
outputs:
  loadbalancerId: ${example.id}
Using getLB
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getLB(args: GetLBArgs, opts?: InvokeOptions): Promise<GetLBResult>
function getLBOutput(args: GetLBOutputArgs, opts?: InvokeOptions): Output<GetLBResult>def get_lb(name: Optional[str] = None,
           resource_group_name: Optional[str] = None,
           opts: Optional[InvokeOptions] = None) -> GetLBResult
def get_lb_output(name: Optional[pulumi.Input[str]] = None,
           resource_group_name: Optional[pulumi.Input[str]] = None,
           opts: Optional[InvokeOptions] = None) -> Output[GetLBResult]func GetLB(ctx *Context, args *GetLBArgs, opts ...InvokeOption) (*GetLBResult, error)
func GetLBOutput(ctx *Context, args *GetLBOutputArgs, opts ...InvokeOption) GetLBResultOutput> Note: This function is named GetLB in the Go SDK.
public static class GetLB 
{
    public static Task<GetLBResult> InvokeAsync(GetLBArgs args, InvokeOptions? opts = null)
    public static Output<GetLBResult> Invoke(GetLBInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetLBResult> getLB(GetLBArgs args, InvokeOptions options)
public static Output<GetLBResult> getLB(GetLBArgs args, InvokeOptions options)
fn::invoke:
  function: azure:lb/getLB:getLB
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Name string
- Specifies the name of the Load Balancer.
- ResourceGroup stringName 
- The name of the Resource Group in which the Load Balancer exists.
- Name string
- Specifies the name of the Load Balancer.
- ResourceGroup stringName 
- The name of the Resource Group in which the Load Balancer exists.
- name String
- Specifies the name of the Load Balancer.
- resourceGroup StringName 
- The name of the Resource Group in which the Load Balancer exists.
- name string
- Specifies the name of the Load Balancer.
- resourceGroup stringName 
- The name of the Resource Group in which the Load Balancer exists.
- name str
- Specifies the name of the Load Balancer.
- resource_group_ strname 
- The name of the Resource Group in which the Load Balancer exists.
- name String
- Specifies the name of the Load Balancer.
- resourceGroup StringName 
- The name of the Resource Group in which the Load Balancer exists.
getLB Result
The following output properties are available:
- FrontendIp List<GetConfigurations LBFrontend Ip Configuration> 
- A frontend_ip_configurationblock as documented below.
- Id string
- The provider-assigned unique ID for this managed resource.
- Location string
- The Azure location where the Load Balancer exists.
- Name string
- The name of the Frontend IP Configuration.
- PrivateIp stringAddress 
- Private IP Address to assign to the Load Balancer.
- PrivateIp List<string>Addresses 
- The list of private IP address assigned to the load balancer in frontend_ip_configurationblocks, if any.
- ResourceGroup stringName 
- Sku string
- The SKU of the Load Balancer.
- Dictionary<string, string>
- A mapping of tags assigned to the resource.
- FrontendIp []GetConfigurations LBFrontend Ip Configuration 
- A frontend_ip_configurationblock as documented below.
- Id string
- The provider-assigned unique ID for this managed resource.
- Location string
- The Azure location where the Load Balancer exists.
- Name string
- The name of the Frontend IP Configuration.
- PrivateIp stringAddress 
- Private IP Address to assign to the Load Balancer.
- PrivateIp []stringAddresses 
- The list of private IP address assigned to the load balancer in frontend_ip_configurationblocks, if any.
- ResourceGroup stringName 
- Sku string
- The SKU of the Load Balancer.
- map[string]string
- A mapping of tags assigned to the resource.
- frontendIp List<GetConfigurations LBFrontend Ip Configuration> 
- A frontend_ip_configurationblock as documented below.
- id String
- The provider-assigned unique ID for this managed resource.
- location String
- The Azure location where the Load Balancer exists.
- name String
- The name of the Frontend IP Configuration.
- privateIp StringAddress 
- Private IP Address to assign to the Load Balancer.
- privateIp List<String>Addresses 
- The list of private IP address assigned to the load balancer in frontend_ip_configurationblocks, if any.
- resourceGroup StringName 
- sku String
- The SKU of the Load Balancer.
- Map<String,String>
- A mapping of tags assigned to the resource.
- frontendIp GetConfigurations LBFrontend Ip Configuration[] 
- A frontend_ip_configurationblock as documented below.
- id string
- The provider-assigned unique ID for this managed resource.
- location string
- The Azure location where the Load Balancer exists.
- name string
- The name of the Frontend IP Configuration.
- privateIp stringAddress 
- Private IP Address to assign to the Load Balancer.
- privateIp string[]Addresses 
- The list of private IP address assigned to the load balancer in frontend_ip_configurationblocks, if any.
- resourceGroup stringName 
- sku string
- The SKU of the Load Balancer.
- {[key: string]: string}
- A mapping of tags assigned to the resource.
- frontend_ip_ Sequence[Getconfigurations LBFrontend Ip Configuration] 
- A frontend_ip_configurationblock as documented below.
- id str
- The provider-assigned unique ID for this managed resource.
- location str
- The Azure location where the Load Balancer exists.
- name str
- The name of the Frontend IP Configuration.
- private_ip_ straddress 
- Private IP Address to assign to the Load Balancer.
- private_ip_ Sequence[str]addresses 
- The list of private IP address assigned to the load balancer in frontend_ip_configurationblocks, if any.
- resource_group_ strname 
- sku str
- The SKU of the Load Balancer.
- Mapping[str, str]
- A mapping of tags assigned to the resource.
- frontendIp List<Property Map>Configurations 
- A frontend_ip_configurationblock as documented below.
- id String
- The provider-assigned unique ID for this managed resource.
- location String
- The Azure location where the Load Balancer exists.
- name String
- The name of the Frontend IP Configuration.
- privateIp StringAddress 
- Private IP Address to assign to the Load Balancer.
- privateIp List<String>Addresses 
- The list of private IP address assigned to the load balancer in frontend_ip_configurationblocks, if any.
- resourceGroup StringName 
- sku String
- The SKU of the Load Balancer.
- Map<String>
- A mapping of tags assigned to the resource.
Supporting Types
GetLBFrontendIpConfiguration   
- Id string
- The id of the Frontend IP Configuration.
- Name string
- Specifies the name of the Load Balancer.
- PrivateIp stringAddress 
- Private IP Address to assign to the Load Balancer.
- PrivateIp stringAddress Allocation 
- The allocation method for the Private IP Address used by this Load Balancer.
- PrivateIp stringAddress Version 
- The Private IP Address Version, either IPv4orIPv6.
- PublicIp stringAddress Id 
- The ID of a Public IP Address which is associated with this Load Balancer.
- SubnetId string
- The ID of the Subnet which is associated with the IP Configuration.
- Zones List<string>
- A list of Availability Zones which the Load Balancer's IP Addresses should be created in.
- Id string
- The id of the Frontend IP Configuration.
- Name string
- Specifies the name of the Load Balancer.
- PrivateIp stringAddress 
- Private IP Address to assign to the Load Balancer.
- PrivateIp stringAddress Allocation 
- The allocation method for the Private IP Address used by this Load Balancer.
- PrivateIp stringAddress Version 
- The Private IP Address Version, either IPv4orIPv6.
- PublicIp stringAddress Id 
- The ID of a Public IP Address which is associated with this Load Balancer.
- SubnetId string
- The ID of the Subnet which is associated with the IP Configuration.
- Zones []string
- A list of Availability Zones which the Load Balancer's IP Addresses should be created in.
- id String
- The id of the Frontend IP Configuration.
- name String
- Specifies the name of the Load Balancer.
- privateIp StringAddress 
- Private IP Address to assign to the Load Balancer.
- privateIp StringAddress Allocation 
- The allocation method for the Private IP Address used by this Load Balancer.
- privateIp StringAddress Version 
- The Private IP Address Version, either IPv4orIPv6.
- publicIp StringAddress Id 
- The ID of a Public IP Address which is associated with this Load Balancer.
- subnetId String
- The ID of the Subnet which is associated with the IP Configuration.
- zones List<String>
- A list of Availability Zones which the Load Balancer's IP Addresses should be created in.
- id string
- The id of the Frontend IP Configuration.
- name string
- Specifies the name of the Load Balancer.
- privateIp stringAddress 
- Private IP Address to assign to the Load Balancer.
- privateIp stringAddress Allocation 
- The allocation method for the Private IP Address used by this Load Balancer.
- privateIp stringAddress Version 
- The Private IP Address Version, either IPv4orIPv6.
- publicIp stringAddress Id 
- The ID of a Public IP Address which is associated with this Load Balancer.
- subnetId string
- The ID of the Subnet which is associated with the IP Configuration.
- zones string[]
- A list of Availability Zones which the Load Balancer's IP Addresses should be created in.
- id str
- The id of the Frontend IP Configuration.
- name str
- Specifies the name of the Load Balancer.
- private_ip_ straddress 
- Private IP Address to assign to the Load Balancer.
- private_ip_ straddress_ allocation 
- The allocation method for the Private IP Address used by this Load Balancer.
- private_ip_ straddress_ version 
- The Private IP Address Version, either IPv4orIPv6.
- public_ip_ straddress_ id 
- The ID of a Public IP Address which is associated with this Load Balancer.
- subnet_id str
- The ID of the Subnet which is associated with the IP Configuration.
- zones Sequence[str]
- A list of Availability Zones which the Load Balancer's IP Addresses should be created in.
- id String
- The id of the Frontend IP Configuration.
- name String
- Specifies the name of the Load Balancer.
- privateIp StringAddress 
- Private IP Address to assign to the Load Balancer.
- privateIp StringAddress Allocation 
- The allocation method for the Private IP Address used by this Load Balancer.
- privateIp StringAddress Version 
- The Private IP Address Version, either IPv4orIPv6.
- publicIp StringAddress Id 
- The ID of a Public IP Address which is associated with this Load Balancer.
- subnetId String
- The ID of the Subnet which is associated with the IP Configuration.
- zones List<String>
- A list of Availability Zones which the Load Balancer's IP Addresses should be created in.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azurermTerraform Provider.