Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
68e18a9
Establishing the LB for internal LB
MariusStorhaug Mar 4, 2022
414a136
Merge branch 'main' of https://github.com/Azure/ResourceModules into …
MariusStorhaug Mar 5, 2022
e2bcab9
Merge branch 'main' of https://github.com/Azure/ResourceModules into …
MariusStorhaug Mar 5, 2022
43f8abb
Test loadbalancer update
MariusStorhaug Mar 5, 2022
b18c0f5
Update readme
MariusStorhaug Mar 5, 2022
990a36e
Test
MariusStorhaug Mar 5, 2022
e3dac30
Test with && !empty()
MariusStorhaug Mar 5, 2022
6fe046a
test deployment without backend child
MariusStorhaug Mar 5, 2022
d4152ad
Update with using backend child
MariusStorhaug Mar 5, 2022
ea0ea20
Fix for tunnelInterface
MariusStorhaug Mar 5, 2022
81dfeef
Fix backendAddressPool.loadBalancerBackendAddresses
MariusStorhaug Mar 5, 2022
34d0315
fix privateIPAllocationMethod when subnet is blank
MariusStorhaug Mar 5, 2022
d047a0b
Fix internal LB and full param files
MariusStorhaug Mar 5, 2022
85372cf
Test
MariusStorhaug Mar 5, 2022
b5e513a
Deploy LB for testing with VMs
MariusStorhaug Mar 5, 2022
c255fcb
update dependency pipeline
MariusStorhaug Mar 5, 2022
fa282ab
deploy dependency lb
MariusStorhaug Mar 5, 2022
4e728b0
Uncomment dependency pipeline
MariusStorhaug Mar 5, 2022
3c12c1d
Merge branch 'main' of https://github.com/Azure/ResourceModules into …
MariusStorhaug Mar 5, 2022
5c12885
Update arm/Microsoft.Network/loadBalancers/.parameters/internal.param…
Mar 6, 2022
63cedae
Update utilities/pipelines/dependencies/Microsoft.Network/loadBalance…
Mar 6, 2022
85aa9cd
simplify dependency params
MariusStorhaug Mar 6, 2022
e79244d
Update .github/workflows/platform.dependencies.yml
Mar 6, 2022
a244960
Update .azuredevops/platformPipelines/platform.dependencies.yml
Mar 6, 2022
5476e13
Update .azuredevops/platformPipelines/platform.dependencies.yml
Mar 6, 2022
73acaf8
Update .azuredevops/platformPipelines/platform.dependencies.yml
Mar 6, 2022
720bc13
remove dependencies on workflow file as its no longer required by the…
MariusStorhaug Mar 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ stages:
deploymentBlocks:
- path: $(modulePath)/.parameters/parameters.json
- path: $(modulePath)/.parameters/min.parameters.json
- path: $(modulePath)/.parameters/internal.parameters.json

- stage: Publishing
displayName: Publish module
Expand Down
15 changes: 15 additions & 0 deletions .azuredevops/platformPipelines/platform.dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -884,3 +884,18 @@ stages:
- path: $(dependencyPath)/$(resourceType)/parameters/parameters.json
templateFilePath: $(templateFilePath)
displayName: Default Virtual Machine

- stage: deploy_lb
displayName: Deploy load balancers
dependsOn:
- deploy_vnet
variables:
resourceType: 'Microsoft.Network/loadBalancers'
templateFilePath: $(modulesPath)/$(resourceType)/deploy.bicep
jobs:
- template: /.azuredevops/pipelineTemplates/jobs.validateModuleDeployment.yml
parameters:
deploymentBlocks:
- path: $(dependencyPath)/$(resourceType)/parameters/internal.parameters.json
templateFilePath: $(templateFilePath)
displayName: Deploy module
2 changes: 1 addition & 1 deletion .github/workflows/ms.network.loadbalancers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
strategy:
fail-fast: false
matrix:
parameterFilePaths: ['min.parameters.json', 'parameters.json']
parameterFilePaths: ['min.parameters.json', 'parameters.json', 'internal.parameters.json']
steps:
- name: 'Checkout'
uses: actions/checkout@v2
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/platform.dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1265,3 +1265,30 @@ jobs:
subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}'
removeDeployment: '${{ env.removeDeployment }}'

job_deploy_lb:
runs-on: ubuntu-20.04
name: 'Deploy load balancers'
env:
namespace: 'Microsoft.Network\loadBalancers'
needs:
- job_deploy_vnet
strategy:
fail-fast: false
matrix:
parameterFilePaths: ['internal.parameters.json']
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Deploy module'
uses: ./.github/actions/templates/validateModuleDeployment
with:
templateFilePath: 'arm/${{ env.namespace }}/deploy.bicep'
parameterFilePath: '${{ env.dependencyPath }}/${{ env.namespace }}/parameters/${{ matrix.parameterFilePaths }}'
location: '${{ env.defaultLocation }}'
resourceGroupName: '${{ env.defaultResourceGroupName }}'
subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}'
removeDeployment: '${{ env.removeDeployment }}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"value": "<<namePrefix>>-az-lb-internal-001"
},
"loadBalancerSku": {
"value": "Standard"
},
"frontendIPConfigurations": {
"value": [
{
"name": "privateIPConfig1",
"subnetId": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<<namePrefix>>-az-vnet-x-001/subnets/<<namePrefix>>-az-subnet-x-001"
}
]
},
"backendAddressPools": {
"value": [
{
"name": "servers"
}
]
},
"probes": {
"value": [
{
"name": "probe1",
"protocol": "Tcp",
"port": "62000",
"intervalInSeconds": 5,
"numberOfProbes": 2
}
]
},
"loadBalancingRules": {
"value": [
{
"name": "privateIPLBRule1",
"frontendIPConfigurationName": "privateIPConfig1",
"frontendPort": 0,
"backendPort": 0,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 4,
"protocol": "All",
"loadDistribution": "Default",
"probeName": "probe1",
"disableOutboundSnat": true,
"enableTcpReset": false,
"backendAddressPoolName": "servers"
}
]
},
"inboundNatRules": {
"value": [
{
"name": "inboundNatRule1",
"frontendIPConfigurationName": "privateIPConfig1",
"frontendPort": 443,
"backendPort": 443,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 4,
"protocol": "Tcp",
"enableTcpReset": false
},
{
"name": "inboundNatRule2",
"frontendIPConfigurationName": "privateIPConfig1",
"frontendPort": 3389,
"backendPort": 3389
}
]
},
"roleAssignments": {
"value": [
{
"roleDefinitionIdOrName": "Reader",
"principalIds": [
"<<deploymentSpId>>"
]
}
]
},
"diagnosticLogsRetentionInDays": {
"value": 7
},
"diagnosticStorageAccountId": {
"value": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<<namePrefix>>azsax001"
},
"diagnosticWorkspaceId": {
"value": "/subscriptions/<<subscriptionId>>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<<namePrefix>>-az-law-x-001"
},
"diagnosticEventHubAuthorizationRuleId": {
"value": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<<namePrefix>>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey"
},
"diagnosticEventHubName": {
"value": "adp-<<namePrefix>>-az-evh-x-001"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
"value": [
{
"name": "publicIPConfig1",
"publicIPAddressId": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/publicIPAddresses/adp-<<namePrefix>>-az-pip-min-lb",
"subnetId": "",
"privateIPAddress": ""
"publicIPAddressId": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/publicIPAddresses/adp-<<namePrefix>>-az-pip-min-lb"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
"value": [
{
"name": "publicIPConfig1",
"publicIPAddressId": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/publicIPAddresses/adp-<<namePrefix>>-az-pip-x-lb",
"subnetId": "",
"privateIPAddress": ""
"publicIPAddressId": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/publicIPAddresses/adp-<<namePrefix>>-az-pip-x-lb"
}
]
},
Expand Down
47 changes: 27 additions & 20 deletions arm/Microsoft.Network/loadBalancers/deploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,24 @@ param inboundNatRules array = []
@description('Optional. The outbound rules.')
param outboundRules array = []

var frontendsSubnets = [for item in frontendIPConfigurations: {
id: item.subnetId
}]
var frontendsPublicIPAddresses = [for item in frontendIPConfigurations: {
id: item.publicIPAddressId
}]
var frontendsObj = {
subnets: frontendsSubnets
publicIPAddresses: frontendsPublicIPAddresses
}

var frontendIPConfigurations_var = [for (frontendIPConfiguration, index) in frontendIPConfigurations: {
name: frontendIPConfiguration.name
properties: {
subnet: !empty(frontendIPConfiguration.subnetId) ? frontendsObj.subnets[index] : null
publicIPAddress: !empty(frontendIPConfiguration.publicIPAddressId) ? frontendsObj.publicIPAddresses[index] : null
privateIPAddress: !empty(frontendIPConfiguration.privateIPAddress) ? frontendIPConfiguration.privateIPAddress : null
privateIPAllocationMethod: !empty(frontendIPConfiguration.subnetId) ? (empty(frontendIPConfiguration.privateIPAddress) ? 'Dynamic' : 'Static') : null
subnet: contains(frontendIPConfiguration, 'subnetId') && !empty(frontendIPConfiguration.subnetId) ? {
id: frontendIPConfiguration.subnetId
} : null
publicIPAddress: contains(frontendIPConfiguration, 'publicIPAddressId') && !empty(frontendIPConfiguration.publicIPAddressId) ? {
id: frontendIPConfiguration.publicIPAddressId
} : null
privateIPAddress: contains(frontendIPConfiguration, 'privateIPAddress') && !empty(frontendIPConfiguration.privateIPAddress) ? frontendIPConfiguration.privateIPAddress : null
privateIPAddressVersion: contains(frontendIPConfiguration, 'privateIPAddressVersion') ? frontendIPConfiguration.privateIPAddressVersion : 'IPv4'
privateIPAllocationMethod: contains(frontendIPConfiguration, 'subnetId') && !empty(frontendIPConfiguration.subnetId) ? (contains(frontendIPConfiguration, 'privateIPAddress') ? 'Static' : 'Dynamic') : null
gatewayLoadBalancer: contains(frontendIPConfiguration, 'gatewayLoadBalancer') && !empty(frontendIPConfiguration.gatewayLoadBalancer) ? {
id: frontendIPConfiguration.gatewayLoadBalancer
} : null
publicIPPrefix: contains(frontendIPConfiguration, 'publicIPPrefix') && !empty(frontendIPConfiguration.publicIPPrefix) ? {
id: frontendIPConfiguration.publicIPPrefix
} : null
}
}]

Expand Down Expand Up @@ -130,13 +130,17 @@ var probes_var = [for probe in probes: {
name: probe.name
properties: {
protocol: contains(probe, 'protocol') ? probe.protocol : 'Tcp'
requestPath: (contains(probe, 'protocol') && toLower(probe.protocol) == 'tcp') ? null : probe.requestPath
requestPath: toLower(probe.protocol) != 'tcp' ? probe.requestPath : null
port: contains(probe, 'port') ? probe.port : 80
intervalInSeconds: contains(probe, 'intervalInSeconds') ? probe.intervalInSeconds : 5
numberOfProbes: contains(probe, 'numberOfProbes') ? probe.numberOfProbes : 2
}
}]

var backendAddressPoolNames = [for backendAddressPool in backendAddressPools: {
name: backendAddressPool.name
}]

@description('Optional. The name of metrics that will be streamed.')
@allowed([
'AllMetrics'
Expand Down Expand Up @@ -169,20 +173,20 @@ resource loadBalancer 'Microsoft.Network/loadBalancers@2021-05-01' = {
}
properties: {
frontendIPConfigurations: frontendIPConfigurations_var
backendAddressPools: backendAddressPools
loadBalancingRules: loadBalancingRules_var
backendAddressPools: backendAddressPoolNames
outboundRules: outboundRules_var
probes: probes_var
}
}

module loadBalancer_backendAddressPools 'backendAddressPools/deploy.bicep' = [for (backendAddressPool, index) in backendAddressPools: {
name: '${uniqueString(deployment().name, location)}-LoadBalancer-backendAddressPools-${index}'
name: '${uniqueString(deployment().name, location)}-loadBalancer-backendAddressPools-${index}'
params: {
loadBalancerName: loadBalancer.name
name: backendAddressPool.name
loadBalancerBackendAddresses: contains(backendAddressPool, 'loadBalancerBackendAddresses') ? backendAddressPool.loadBalancerBackendAddresses : []
tunnelInterfaces: contains(backendAddressPool, 'tunnelInterfaces') ? backendAddressPool.tunnelInterfaces : []
tunnelInterfaces: contains(backendAddressPool, 'tunnelInterfaces') && !empty(backendAddressPool.tunnelInterfaces) ? backendAddressPool.tunnelInterfaces : []
loadBalancerBackendAddresses: contains(backendAddressPool, 'loadBalancerBackendAddresses') && !empty(backendAddressPool.loadBalancerBackendAddresses) ? backendAddressPool.loadBalancerBackendAddresses : []
}
}]

Expand Down Expand Up @@ -245,3 +249,6 @@ output resourceId string = loadBalancer.id

@description('The resource group the load balancer was deployed into')
output resourceGroupName string = resourceGroup().name

@description('The backend address pools available in the load balancer.')
output backendpools array = loadBalancer.properties.backendAddressPools
1 change: 1 addition & 0 deletions arm/Microsoft.Network/loadBalancers/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ Tag names and tag values can be provided as needed. A tag can be left without a

| Output Name | Type | Description |
| :-- | :-- | :-- |
| `backendpools` | array | The backend address pools available in the load balancer. |
| `name` | string | The name of the load balancer |
| `resourceGroupName` | string | The resource group the load balancer was deployed into |
| `resourceId` | string | The resource ID of the load balancer |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"value": "adp-<<namePrefix>>-az-lb-internal-001"
},
"loadBalancerSku": {
"value": "Standard"
},
"frontendIPConfigurations": {
"value": [
{
"name": "privateIPConfig1",
"subnetId": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<<namePrefix>>-az-vnet-x-001/subnets/<<namePrefix>>-az-subnet-x-001"
}
]
},
"backendAddressPools": {
"value": [
{
"name": "servers"
}
]
},
"probes": {
"value": [
{
"name": "probe1",
"protocol": "Tcp",
"port": "62000",
"intervalInSeconds": 5,
"numberOfProbes": 2
}
]
},
"loadBalancingRules": {
"value": [
{
"name": "privateIPLBRule1",
"frontendIPConfigurationName": "privateIPConfig1",
"frontendPort": 0,
"backendPort": 0,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 4,
"protocol": "All",
"loadDistribution": "Default",
"probeName": "probe1",
"disableOutboundSnat": true,
"enableTcpReset": false,
"backendAddressPoolName": "servers"
}
]
},
"inboundNatRules": {
"value": [
{
"name": "inboundNatRule1",
"frontendIPConfigurationName": "privateIPConfig1",
"frontendPort": 443,
"backendPort": 443,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 4,
"protocol": "Tcp",
"enableTcpReset": false
},
{
"name": "inboundNatRule2",
"frontendIPConfigurationName": "privateIPConfig1",
"frontendPort": 3389,
"backendPort": 3389
}
]
}
}
}