question

jackchentoronto avatar image
0 Votes"
jackchentoronto asked jackchentoronto answered

blueprint vNet artifact failed to be updated when there is a VM in it

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

azure-blueprints
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

jackchentoronto avatar image
0 Votes"
jackchentoronto answered

OK I see this is more a vNet ARM issue, not blueprint particularly.

It's the same issue https://github.com/Azure/azure-quickstart-templates/issues/2786

When vNet is redeployed, even with incremental mode, it will delete/recreate subnet.

A conditional deployment might be a workaround, but it kind of sucks.

I have tried blueprint and I am disappointed, it looks good on paper, but when you really try to use it, there are lots of problems make it not really usable as it's supposed to.

For example, many functions will not work in blueprint artifacts when they are working in ARM templates.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.