ApplicationGatewaySubnetInboundTrafficBlockedByNetworkSecurityGroup on repeated deployments
See original GitHub issueDescribe the bug I use the aks construction set from a module and when I deploy it the first time, it’s all fine. When I don’t change anything and deploy it again, it fails with this error:
{
"code": "DeploymentFailed",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
"details": [
{
"code": "ApplicationGatewaySubnetInboundTrafficBlockedByNetworkSecurityGroup",
"message": "Network security group /subscriptions/8b25cfae-660b-4066-9ce5-0858e9ab3eac/resourceGroups/test-raro-us/providers/Microsoft.Network/networkSecurityGroups/nsg-agw-nprd-euw-jk67 blocks incoming internet traffic on ports 65200 - 65535 to subnet /subscriptions/8b25cfae-660b-4066-9ce5-0858e9ab3eac/resourceGroups/test-raro-us/providers/Microsoft.Network/virtualNetworks/vnet-nprd-euw-jk67/subnets/appgw-sn, associated with Application Gateway /subscriptions/8b25cfae-660b-4066-9ce5-0858e9ab3eac/resourceGroups/test-raro-us/providers/Microsoft.Network/applicationGateways/agw-nprd-euw-jk67. This is not permitted for Application Gateways that have V2 Sku."
}
]
}
my aks.bicep that I use to call the aks construction module:
// borrow from: https://github.com/Azure/Aks-Construction
// TODOS:
@description('Unique String for all public names')
@maxLength(4)
@minLength(4)
param salt string = take(uniqueString(resourceGroup().id), 4)
// You should use a bicep file to represent an application deployment
// This "Application Main.Bicep" will then call the AKS Construction module
//------Application General Parameters------
param location string = resourceGroup().location
@allowed([
'Production'
'NonProduction'
])
@description('The performance/size spec of the generated resources')
param environmentScale string = 'NonProduction'
//------------------NAMING-----------------
//- As per CAF naming standards: https://docs.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/resource-naming
//Example generated names will be : sql-app-nprd-euw-001, aks-app-nprd-euw-001, log-app-nprd-euw-001
@description('Short name to use for environment resource name')
param environmentName string = 'nprd'
@description('Instance or other differentiator for resource deployment')
param namesuffix string = salt
@description('This json file is used to convert a long location name (eg. UK South) to its short version (eg. UKS)')
var shortLocationNames = json(loadTextContent('./shortLocationNames.json'))
@description('Maps the long name to the short name')
var shortLocationName = '${shortLocationNames[location]}'
@description('Creates a full resource name seed.')
var fullnameseed = '${environmentName}-${shortLocationName}-${namesuffix}'
@description('Should Private Links be created.')
param privateLinks bool = false
//--------------ENVIRONMENT-------------
var environmentConfigurationMap = {
Production: {
aks: {
availabilityZones: [
'1'
'2'
'3'
]
AksPaidSkuForSLA: true
JustUseSystemPool: false
privateCluster: true
networkPolicy: 'azure'
agentCount:6
agentCountMax:12
agentVMSize: 'Standard_D8s_v4'
}
}
NonProduction: {
aks: {
availabilityZones: []
AksPaidSkuForSLA: false
JustUseSystemPool: true
privateCluster: false
agentCount:1
agentCountMax:3
networkPolicy: 'azure'
agentVMSize: 'Standard_DS3_v2'
}
}
}
//---------Kubernetes Construction---------
//ref: https://github.com/Azure/Aks-Construction
param k8sVersion string = '1.22.4'
module aksconst './aks-construction/main.bicep' = {
name: 'aksconstruction'
params: {
location : location
AksDisableLocalAccounts: true
upgradeChannel: 'stable'
resourceName: fullnameseed
kubernetesVersion: k8sVersion
enablePrivateCluster : environmentConfigurationMap[environmentScale].aks.privateCluster
agentCount: environmentConfigurationMap[environmentScale].aks.agentCount
agentVMSize: environmentConfigurationMap[environmentScale].aks.agentVMSize
agentCountMax: environmentConfigurationMap[environmentScale].aks.agentCountMax
enable_aad: true
enableAzureRBAC : true
registries_sku: 'Premium' //no acr
omsagent: true
retentionInDays: 30
custom_vnet: true
ingressApplicationGateway: true
appGWcount: 0
appGWsku: 'WAF_v2'
appGWmaxCount: 10
appgwKVIntegration: true
azureKeyvaultSecretsProvider: true
createKV: true
privateLinks: false // something prevents true from working here, privateLinks
networkPolicy: environmentConfigurationMap[environmentScale].aks.networkPolicy
azurepolicy: 'audit' // no policy, lack of permissions
availabilityZones: environmentConfigurationMap[environmentScale].aks.availabilityZones
AksPaidSkuForSLA: environmentConfigurationMap[environmentScale].aks.AksPaidSkuForSLA
JustUseSystemPool: environmentConfigurationMap[environmentScale].aks.JustUseSystemPool
}
}
output aksClusterName string = aksconst.outputs.aksClusterName
output ApplicationGatewayName string = aksconst.outputs.ApplicationGatewayName
I use the azure cli to deploy it.
To Reproduce Steps to reproduce the behavior:
- Deploy the AKS Construction with the aforementioned aks.bicep
- Deploy it again without changing anything
- See error
Expected behavior I would expect to not get an error and that repeated deployments run fine.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Azure Application Gateway infrastructure configuration
An application gateway is a dedicated deployment in your virtual network. ... You can have multiple instances of a given application gateway ...
Read more >ApplicationGatewaySubnetInbou...
• The 'Destroy' task through the terraform code that you are using is failing because inbound connectivity from the Jenkins pipeline is not ......
Read more >Continuous Kubernetes blue-green deployments on Azure ...
This story is about learning how to do blue/green deployments for Kubernetes on Azure. ... The idea is to deploy our application multiple...
Read more >Synchronizing Azure Application BackEnd address pool in a ...
I'm not seeing how to synchronize the addresses in an Azure Application BackEnd pool in a multiple virtual machine rolling deployment.
Read more >VM-Series and Azure Application Gateway Template
1.0/24 - 192.168.5.0/24) for deploying the Azure Application Gateway, the VM-Series firewalls, the Azure load balancer and the web servers. Each ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This looks like a problem with the Azure Resource Provider, I have raised an issue.
As a short-term workaround, to reduce the impact on Day1 users of this project; I have changed the default parameter value to not deploy the appgw nsg in #207 . For users who require the NSG, it will have to be created outside the scope of the AKS-Construction codebase.
This does not fix the idempotency issue around the NSG, which should come as part of the issue raised.
Reproduced issue. Will investigate.