Resources were getting recreated each time I execute az cli command

Abhishek Balaaje G 0 Reputation points
2023-05-15T05:55:29.2+00:00

I am trying to create resources with Az cli everytime if i deploy the change in template in file, all the resources were getting re created for each and every deployment.

Please help me to resolve this issue

Thanks!

Errors:

abhishek@xxxxx-abhishek HubSpoke % az deployment group create --resource-group abg-rg --template-file main.bicep --verbose --mode complete

{"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/......../resourceGroups/abg-rg/providers/Microsoft.Resources/deployments/main","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"ResourceDeploymentFailure","target":"/subscriptions/......./resourceGroups/abg-rg/providers/Microsoft.Resources/deployments/abg-rg-HubVnet","message":"The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'.","details":[{"code":"DeploymentFailed","target":"/subscriptions/......../resourceGroups/abg-rg/providers/Microsoft.Resources/deployments/abg-rg-HubVnet","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"InUseSubnetCannotBeDeleted","message":"Subnet GatewaySubnet is in use by /subscriptions/.........../resourceGroups/abg-rg/providers/Microsoft.Network/virtualNetworkGateways/HubNetworkGW/ipConfigurations/default and cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See aka.ms/deletesubnet.","details":[]}]}]}]}}

Command ran in 98.932 seconds (init: 0.077, invoke: 98.855)

abhishek@xxxxx-abhishek HubSpoke % az deployment group create --resource-group abg-rg --template-file main.bicep --verbose --mode incremental

{"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/........./resourceGroups/abg-rg/providers/Microsoft.Resources/deployments/main","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"ResourceDeploymentFailure","target":"/subscriptions/cb3bdeb3-af4f-4572-885d-57b8c5d1e5a7/resourceGroups/abg-rg/providers/Microsoft.Resources/deployments/abg-rg-HubVnet","message":"The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'.","details":[{"code":"DeploymentFailed","target":"/subscriptions/...../resourceGroups/abg-rg/providers/Microsoft.Resources/deployments/abg-rg-HubVnet","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"InUseSubnetCannotBeDeleted","message":"Subnet GatewaySubnet is in use by /subscriptions/cb3bdeb3-af4f-4572-885d-57b8c5d1e5a7/resourceGroups/abg-rg/providers/Microsoft.Network/virtualNetworkGateways/HubNetworkGW/ipConfigurations/default and cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See aka.ms/deletesubnet.","details":[]}]}]}]}}

Azure Network Watcher
Azure Network Watcher
An Azure service that is used to monitor, diagnose, and gain insights into network performance and health.
173 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.