We recommend using Azure Native.
Azure v6.28.0 published on Friday, Oct 3, 2025 by Pulumi
azure.lb.getLB
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.id());
}
}
variables:
example:
fn::invoke:
function: azure:lb:getLB
arguments:
name: example-lb
resourceGroupName: example-resources
outputs:
loadbalancerId: ${example.id}
API Providers
This data source uses the following Azure API Providers:
Microsoft.Network- 2023-09-01
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.
- Resource
Group stringName - The name of the Resource Group in which the Load Balancer exists.
- Name string
- Specifies the name of the Load Balancer.
- Resource
Group stringName - The name of the Resource Group in which the Load Balancer exists.
- name String
- Specifies the name of the Load Balancer.
- resource
Group StringName - The name of the Resource Group in which the Load Balancer exists.
- name string
- Specifies the name of the Load Balancer.
- resource
Group 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.
- resource
Group StringName - The name of the Resource Group in which the Load Balancer exists.
getLB Result
The following output properties are available:
- Frontend
Ip 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.
- Private
Ip stringAddress - Private IP Address to assign to the Load Balancer.
- Private
Ip List<string>Addresses - The list of private IP address assigned to the load balancer in
frontend_ip_configurationblocks, if any. - Resource
Group stringName - Sku string
- The SKU of the Load Balancer.
- Dictionary<string, string>
- A mapping of tags assigned to the resource.
- Frontend
Ip []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.
- Private
Ip stringAddress - Private IP Address to assign to the Load Balancer.
- Private
Ip []stringAddresses - The list of private IP address assigned to the load balancer in
frontend_ip_configurationblocks, if any. - Resource
Group stringName - Sku string
- The SKU of the Load Balancer.
- map[string]string
- A mapping of tags assigned to the resource.
- frontend
Ip 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.
- private
Ip StringAddress - Private IP Address to assign to the Load Balancer.
- private
Ip List<String>Addresses - The list of private IP address assigned to the load balancer in
frontend_ip_configurationblocks, if any. - resource
Group StringName - sku String
- The SKU of the Load Balancer.
- Map<String,String>
- A mapping of tags assigned to the resource.
- frontend
Ip 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.
- private
Ip stringAddress - Private IP Address to assign to the Load Balancer.
- private
Ip string[]Addresses - The list of private IP address assigned to the load balancer in
frontend_ip_configurationblocks, if any. - resource
Group 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.
- frontend
Ip 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.
- private
Ip StringAddress - Private IP Address to assign to the Load Balancer.
- private
Ip List<String>Addresses - The list of private IP address assigned to the load balancer in
frontend_ip_configurationblocks, if any. - resource
Group 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.
- Private
Ip stringAddress - Private IP Address to assign to the Load Balancer.
- Private
Ip stringAddress Allocation - The allocation method for the Private IP Address used by this Load Balancer.
- Private
Ip stringAddress Version - The Private IP Address Version, either
IPv4orIPv6. - Public
Ip stringAddress Id - The ID of a Public IP Address which is associated with this Load Balancer.
- Subnet
Id 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.
- Private
Ip stringAddress - Private IP Address to assign to the Load Balancer.
- Private
Ip stringAddress Allocation - The allocation method for the Private IP Address used by this Load Balancer.
- Private
Ip stringAddress Version - The Private IP Address Version, either
IPv4orIPv6. - Public
Ip stringAddress Id - The ID of a Public IP Address which is associated with this Load Balancer.
- Subnet
Id 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.
- private
Ip StringAddress - Private IP Address to assign to the Load Balancer.
- private
Ip StringAddress Allocation - The allocation method for the Private IP Address used by this Load Balancer.
- private
Ip StringAddress Version - The Private IP Address Version, either
IPv4orIPv6. - public
Ip StringAddress Id - The ID of a Public IP Address which is associated with this Load Balancer.
- subnet
Id 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.
- private
Ip stringAddress - Private IP Address to assign to the Load Balancer.
- private
Ip stringAddress Allocation - The allocation method for the Private IP Address used by this Load Balancer.
- private
Ip stringAddress Version - The Private IP Address Version, either
IPv4orIPv6. - public
Ip stringAddress Id - The ID of a Public IP Address which is associated with this Load Balancer.
- subnet
Id 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.
- private
Ip StringAddress - Private IP Address to assign to the Load Balancer.
- private
Ip StringAddress Allocation - The allocation method for the Private IP Address used by this Load Balancer.
- private
Ip StringAddress Version - The Private IP Address Version, either
IPv4orIPv6. - public
Ip StringAddress Id - The ID of a Public IP Address which is associated with this Load Balancer.
- subnet
Id 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.
