G'day all,
I'm currently building out some bicep templates for standing up new environments for a project, and everything has gone well until I got to the Application Gateway.
We have an existing ApplicationGateway instance that I'm hoping to add the new backendAddressPool
/httpListener
/requestRoutingRule
etc to, in the same way we can create a new Microsoft.Web/sites
and attach it to an existing Microsoft.Web/serverfarms
.
Unfortunately these seem to be properties, rather than a sub resource as I get errors trying to create them:
resource appGateway 'Microsoft.Network/applicationGateways@2021-03-01' existing = {
name: appGwName
}
// This resource type is not valid
resource backendPool 'Microsoft.Network/applicationGateways/backendAddressPools@2021-03-01' = {
name: '${appName}-${environment}-backend'
parent: appGateway
properties: {
backendAddresses: [
{
fqdn: appServiceUrl
}
]
}
}
Can anyone confirm whether it is even possible to update the configuration of an existing gateway like this before I burn any more time on it?
Application Gateways have no child resources. You need to deploy the entire Application Gateway with all properties in one deployment. In order to add additional httpListeners
, backendAddressPools
etc..., you need to create a template with all the properties from the existing App GW and then add the new properties to the template.
Application Gateways are a bit tricky to manage with templates. My best advice is to work with WhatIf
deployments when authoring your template as it will help you to verify that none of the existing config is removed or modified accidentaly when deploying the template.