I am working on a blueprint to create a baseline configuration on new subscription. It will deploy a few vnets using template artifacts and the artifacts works and I can rerun the blueprint repeatedly.
But as soon as I create a VM in a vNet, the whole blueprint will fail to update, even when vNet artifact is not changed.
When I run
Set-AzBlueprintAssignment -Name "${blueprintName}_assignment" -AssignmentFile .\${blueprintName}\assign.json
It will fail with error :
The artifact 'prodvnet' of type 'Template' failed to deploy due to the following error: Template deployment failed with error [ { "code": "InUseSubnetCannotBeDeleted", "message": "Subnet sub-private is in use by /subscriptions/xxxxxxxxx/resourceGroups/rg-prodvm/providers/Microsoft.Network/networkInterfaces/prodvm2750/ipConfigurations/ipconfig1 and cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See aka.ms/deletesubnet." } ]
I have to delete the VM, then I can reassign the blueprint and it will work again.
This means I can't use blueprint to constantly update my environment as soon as I have VM deployed.
Is there any workaround for this problem? I tried to find some documents for blueprint template artifacts, see if there is a forced "increamental" deployment mode, but didn't find it.
Thanks,
Jack