Create Azure Internal Load Balancer using PowerShell

Input Parameters:

Subnets: Subnet_10.x.x.x
Resource Groups (Service Name): ServerGroup1
VMs: Server1, Server2
InternalLoadBalancerName: InternalLB1
Port: 443

Find the Subnets where you would like to create a internal load balancer.

Get-AzureVNetSite

Find the VMs which you would like to add to this internal load balancer

Get-AzureVM -ServiceName ServerGroup1

Create a Internal Network

Add-AzureInternalLoadBalancer -ServiceName ServerGroup1 -InternalLoadBalancerName InternalLB1 -SubnetName “Subnet_10.x.x.x” -StaticVNetIPAddress 10.x.x.x

Add VM to this network

Get-AzureVM -ServiceName ServerGroup1 -Name Server1 | Add-AzureEndpoint -LBSetName “InternalLB1” -Name “InternalLB1” -DefaultProbe -InternalLoadBalancerName “InternalLB1” -Protocol tcp -PublicPort 443 -LocalPort 443 -LoadBalancerDistribution sourceIP | Update-AzureVM

Add second VM to this network

Get-AzureVM -ServiceName ServerGroup1 -Name Server2 | Add-AzureEndpoint -LBSetName “InternalLB1” -Name “InternalLB1” -DefaultProbe -InternalLoadBalancerName “InternalLB1” -Protocol tcp -PublicPort 443 -LocalPort 443 -LoadBalancerDistribution sourceIP | Update-AzureVM