Skip to content

Instantly share code, notes, and snippets.

@sireza
Created September 30, 2025 04:39
Show Gist options
  • Save sireza/f7710d4a77c613be8243ffd461e583ee to your computer and use it in GitHub Desktop.
Save sireza/f7710d4a77c613be8243ffd461e583ee to your computer and use it in GitHub Desktop.
Azure Load Balancer Deploy
// Deploy the internal load balancer module
module internalLoadBalancer './internal-loadbalancer.bicep' = {
name: 'internalLoadBalancerDeployment'
params: {
loadBalancerName: 'twc-internal-lb'
location: location
subnetId: virtualNetwork.properties.subnets[0].id
frontendPrivateIPAddress: '10.0.1.10'
tags: tags
// Backend address pools with explicit VM IPs
backendAddressPools: [
{
name: 'web-backend-pool'
loadBalancerBackendAddresses: [
{
name: 'vm1-address'
properties: {
virtualNetwork: {
id: virtualNetwork.id
}
ipAddress: nic1.properties.ipConfigurations[0].properties.privateIPAddress
}
}
{
name: 'vm2-address'
properties: {
virtualNetwork: {
id: virtualNetwork.id
}
ipAddress: nic2.properties.ipConfigurations[0].properties.privateIPAddress
}
}
]
}
]
// Health probes
probes: [
{
name: 'http-probe'
protocol: 'Http'
port: 80
requestPath: '/'
intervalInSeconds: 15
numberOfProbes: 2
}
{
name: 'https-probe'
protocol: 'Https'
port: 443
requestPath: '/health'
intervalInSeconds: 20
numberOfProbes: 3
}
]
// Load balancing rules
loadBalancingRules: [
{
name: 'http-rule'
protocol: 'Tcp'
frontendPort: 80
backendPort: 80
backendAddressPoolName: 'web-backend-pool'
probeName: 'http-probe'
idleTimeoutInMinutes: 5
enableFloatingIP: false
loadDistribution: 'Default'
}
{
name: 'https-rule'
protocol: 'Tcp'
frontendPort: 443
backendPort: 443
backendAddressPoolName: 'web-backend-pool'
probeName: 'https-probe'
idleTimeoutInMinutes: 5
enableFloatingIP: false
loadDistribution: 'Default'
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment