Editar

Partilhar via


Add-AzLoadBalancerFrontendIpConfig

Adds a front-end IP configuration to a load balancer.

Syntax

Add-AzLoadBalancerFrontendIpConfig
   -LoadBalancer <PSLoadBalancer>
   -Name <String>
   [-PrivateIpAddress <String>]
   [-PrivateIpAddressVersion <String>]
   [-Zone <String[]>]
   -Subnet <PSSubnet>
   [-GatewayLoadBalancerId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzLoadBalancerFrontendIpConfig
   -LoadBalancer <PSLoadBalancer>
   -Name <String>
   [-PrivateIpAddress <String>]
   [-PrivateIpAddressVersion <String>]
   [-Zone <String[]>]
   -SubnetId <String>
   [-GatewayLoadBalancerId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzLoadBalancerFrontendIpConfig
   -LoadBalancer <PSLoadBalancer>
   -Name <String>
   [-Zone <String[]>]
   -PublicIpAddressId <String>
   [-GatewayLoadBalancerId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzLoadBalancerFrontendIpConfig
   -LoadBalancer <PSLoadBalancer>
   -Name <String>
   [-Zone <String[]>]
   -PublicIpAddress <PSPublicIpAddress>
   [-GatewayLoadBalancerId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzLoadBalancerFrontendIpConfig
   -LoadBalancer <PSLoadBalancer>
   -Name <String>
   [-Zone <String[]>]
   -PublicIpAddressPrefixId <String>
   [-GatewayLoadBalancerId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzLoadBalancerFrontendIpConfig
   -LoadBalancer <PSLoadBalancer>
   -Name <String>
   [-Zone <String[]>]
   -PublicIpAddressPrefix <PSPublicIpPrefix>
   [-GatewayLoadBalancerId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Add-AzLoadBalancerFrontendIpConfig cmdlet adds a front-end IP configuration to an Azure load balancer.

Examples

Example 1 Add a front-end IP configuration with a dynamic IP address

$Subnet = Get-AzVirtualNetwork -Name "MyVnet" -ResourceGroupName "MyRg" | Get-AzVirtualNetworkSubnetConfig -Name "MySubnet"
Get-AzLoadBalancer -Name "MyLB" -ResourceGroupName "NrpTest" | Add-AzLoadBalancerFrontendIpConfig -Name "FrontendName" -Subnet $Subnet | Set-AzLoadBalancer

The first command gets the Azure virtual network named MyVnet and passes the result using the pipeline to the Get-AzVirtualNetworkSubnetConfig cmdlet to get the subnet named MySubnet. The command then stores the result in the variable named $Subnet. The second command gets the load balancer named MyLB and passes the result to the Add-AzLoadBalancerFrontendIpConfig cmdlet that adds a front-end IP configuration to the load balancer with a dynamic private IP address from the subnet stored in the variable named $MySubnet.

Example 2 Add a front-end IP configuration with a static IP address

$Subnet = Get-AzVirtualNetwork -Name "MyVnet" -ResourceGroupName "RG001" | Get-AzVirtualNetworkSubnetConfig -Name "MySubnet"
Get-AzLoadBalancer -Name "MyLB" -ResourceGroupName "NrpTest" | Add-AzLoadBalancerFrontendIpConfig -Name "FrontendName" -Subnet $Subnet -PrivateIpAddress "10.0.1.6" | Set-AzLoadBalancer

The first command gets the Azure virtual network named MyVnet and passes the result using the pipeline to the Get-AzVirtualNetworkSubnetConfig cmdlet to get the subnet named MySubnet. The command then stores the result in the variable named $Subnet. The second command gets the load balancer named MyLB and passes the result to the Add-AzLoadBalancerFrontendIpConfig cmdlet that adds a front-end IP configuration to the load balancer with a static private IP address from the subnet stored in the variable named $Subnet.

Example 3 Add a front-end IP configuration with a public IP address

$PublicIp = Get-AzPublicIpAddress -ResourceGroupName "myRG" -Name "MyPub"
Get-AzLoadBalancer -Name "MyLB" -ResourceGroupName "NrpTest" | Add-AzLoadBalancerFrontendIpConfig -Name "FrontendName" -PublicIpAddress $PublicIp | Set-AzLoadBalancer

The first command gets the Azure public IP address named MyPub and stores the result in the variable named $PublicIp. The second command gets the load balancer named MyLB and passes the result to the Add-AzLoadBalancerFrontendIpConfig cmdlet that adds a front-end IP configuration to the load balancer with public IP address stored in the variable named $PublicIp.

Example 4 Add a front-end IP configuration with a public IP prefix

$PublicIpPrefix = Get-AzPublicIpPrefix -ResourceGroupName "myRG" -Name "MyPubPrefix"
Get-AzLoadBalancer -Name "MyLB" -ResourceGroupName "NrpTest" | Add-AzLoadBalancerFrontendIpConfig -Name "FrontendName" -PublicIpAddressPrefix $PublicIpPrefix | Set-AzLoadBalancer

The first command gets the Azure public IP prefix named MyPubPrefix and stores the result in the variable named $PublicIpPrefix. The second command gets the load balancer named MyLB and passes the result to the Add-AzLoadBalancerFrontendIpConfig cmdlet that adds a front-end IP configuration to the load balancer with public IP prefix stored in the variable named $PublicIpPrefix.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-GatewayLoadBalancerId

The reference of Gateway LoadBalancer Provider resource.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-LoadBalancer

Specifies a LoadBalancer object. This cmdlet adds a front-end IP configuration to the load balancer that this parameter specifies.

Type:PSLoadBalancer
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specifies the name of the front-end IP configuration to add.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PrivateIpAddress

Specifies the private IP address to associate with a front-end IP configuration.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-PrivateIpAddressVersion

The private IP address version of the IP configuration.

Type:String
Accepted values:IPv4, IPv6
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-PublicIpAddress

Specifies the public IP address to associate with a front-end IP configuration.

Type:PSPublicIpAddress
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PublicIpAddressId

Specifies the ID of the public IP address in which to add a front-end IP configuration.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PublicIpAddressPrefix

Specifies the public ip address prefix object to associate with a front-end IP configuration.

Type:PSPublicIpPrefix
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PublicIpAddressPrefixId

Specifies the ID of the public ip address prefix object to associate with a front-end IP configuration.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Subnet

Specifies the subnet object in which to add a front-end IP configuration.

Type:PSSubnet
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-SubnetId

Specifies the ID of the subnet in which to add a front-end IP configuration.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Zone

A list of availability zones denoting the IP allocated for the resource needs to come from.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Inputs

PSLoadBalancer

String

String[]

PSSubnet

PSPublicIpAddress

Outputs

PSLoadBalancer