Creating Azure Standard Load Balancers with PowerShell
Creating variables to store key parameters.
Identifying the proper cmdlets to create a frontend IP configuration, backend address pool, health probe, Load Balancer rule configuration, and NAT rules.
Creating the Azure Standard Load Balancer using the correct parameters.
Create the Variables
Click the Cloud Shell icon (
>_) at the top of the page.Click PowerShell.
Click Show advanced settings.
Use the combo box under Cloud Shell region to select West US.
Under Storage account, click the radio button for Use existing.
In the box under File share, enter "shell".
Click Create storage.
Identify the current resource group.
get-azresourcegroupSelect the ResourceGroupName value and copy it to the clipboard.
Create a variable and set it to the value copied in the previous step.
$resource='RESOURCE_GROUP_NAME'Set the
locationvariable.$location='westus'Create the public IP address.
$publicIP = New-AzPublicIpAddress ` -ResourceGroupName $resource ` -Name 'myPublicIp' ` -Location $location ` -AllocationMethod static ` -Sku StandardCreate the frontend IP configuration.
$feip = New-AzLoadBalancerFrontendIpConfig -Name 'MyFrontEndPool' -PublicIPAddress $publicIPCreate the backend address pool.
$bepool = New-AzLoadBalancerBackEndAddressPoolConfig -Name 'myBackEndPool'Create the health probe.
$probe = New-AzLoadBalancerProbeConfig ` -Name 'myHealthProbe' ` -Protocol Http ` -Port 80 ` -RequestPath / ` -IntervalInSeconds 360 ` -ProbeCount 5Create the Load Balancer rule.
$rule = New-AzLoadBalancerRuleConfig ` -Name 'myLoadBalancerRuleWeb' ` -Protocol Tcp ` -Probe $probe ` -FrontendPort 80 ` -BackendPort 80 ` -FrontendIpConfiguration $feip ` -BackendAddressPool $bepoolCreate the necessary NAT rules.
$natrule1 = New-AzLoadBalancerInboundNatRuleConfig ` -Name 'myLoadBalancerRDP1' ` -FrontendIpConfiguration $feip ` -Protocol tcp ` -FrontendPort 4221 ` -BackendPort 3389 $natrule2 = New-AzLoadBalancerInboundNatRuleConfig ` -Name 'myLoadBalancerRDP2' ` -FrontendIpConfiguration $feip ` -Protocol tcp ` -FrontendPort 4222 ` -BackendPort 3389 $natrule3 = New-AzLoadBalancerInboundNatRuleConfig ` -Name 'myLoadBalancerRDP3' ` -FrontendIpConfiguration $feip ` -Protocol tcp ` -FrontendPort 4223 ` -BackendPort 3389
Create the Azure Standard Load Balancer
Create the Load Balancer.
New-AzLoadBalancer ` -ResourceGroupName $resource ` -Name 'myLoaBalancer' ` -Sku Standard ` -Location $location ` -FrontendIpConfiguration $feip ` -BackendAddressPool $bepool ` -Probe $probe ` -LoadBalancingRule $rule ` -InboundNatRule $natrule1,$natrule2,$natrule3
No comments:
Post a Comment