How to - Redeploy a VNet involved in a VNet integration with an Azure Function? #3634
-
Hello everyone 👋🏼, Since few days I am working on an infrastructure as code deployment involving among other things a function app (Azure Functions) with a VNet integration. I have some code like below in a module for the deployment of the function app (with an app service plan): resource functionAppNetworkConfiguration 'Microsoft.Web/sites/networkConfig@2021-01-01' = {
parent: functionApp // Deployed in a previous step of the same module
name: 'virtualNetwork'
properties: {
subnetResourceId: subnetId // Output from another module deployed in a previous step
swiftSupported: true // I don't really know what this property is for 😅
}
} But if I try to deploy the same infrastructure as code without any change, I get the error below on the deployment of the VNet: Subnet xxx is in use by /subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Network/virtualNetworks/xxx/subnets/xxx/serviceAssociationLinks/AppServiceLink and cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See aka.ms/deletesubnet. As a workaround I am currently removing the VNet integration in the function app if it exists before a deployment to be able to launch again the deployment without an error, but it is definitely not a perfect solution 😓 Am I doing something wrong here? I naively thought that if you don't change anything in your code and deploy in incremental mode nothing should change in Azure, but it seems the deployment try to delete the subnet used for the VNet integration in the function app. But it is definitely not what I want to do here. I would like to be able to launch many deployments without any change in the code and without error 😁
Thank you in advance for your help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 13 replies
-
Hi @rpothin are you able to share the code that you are using for the deployment of the VNET/Subnet? Assuming that you are also including the "delegations" for "Microsoft.Web/serverfarms" on the redeployment of the subnet? |
Beta Was this translation helpful? Give feedback.
Hi @rpothin are you able to share the code that you are using for the deployment of the VNET/Subnet?
Assuming that you are also including the "delegations" for "Microsoft.Web/serverfarms" on the redeployment of the subnet?