About Me

My photo
I am an MCSE in Data Management and Analytics, specializing in MS SQL Server, and an MCP in Azure. With over 19+ years of experience in the IT industry, I bring expertise in data management, Azure Cloud, Data Center Migration, Infrastructure Architecture planning, as well as Virtualization and automation. I have a deep passion for driving innovation through infrastructure automation, particularly using Terraform for efficient provisioning. If you're looking for guidance on automating your infrastructure or have questions about Azure, SQL Server, or cloud migration, feel free to reach out. I often write to capture my own experiences and insights for future reference, but I hope that sharing these experiences through my blog will help others on their journey as well. Thank you for reading!

Error: Updating In-Use Subnet or Subnet In Use - Unable to Update CIDR

sometime when you execute below command.  

C:\Windows\System32\godevsuite137>az network vnet subnet update --resource-group rakResourceGroup --vnet-name rakVnet --name rakSubnet --address-prefix 10.20.2.0/24

you get error:-

(InUseSubnetCannotBeUpdated) Subnet rakSubnet is in use and cannot be updated.

Code: InUseSubnetCannotBeUpdated

Message: Subnet rakSubnet is in use and cannot be updated.

what is meaning of this error and how to check which all resources are associated with this subnet

This error message indicates that the subnet "rakSubnet" that you are trying to update is currently in use and cannot be updated. The error message is coming from the "InUseSubnetCannotBeUpdated" code, which indicates that the subnet is currently being used by one or more resources and cannot be modified.

This error occurs because the subnet you're trying to update is being used by some resources, such as a virtual machine, a load balancer or other resource which is connected to it. And those resources are actively using the subnet IP range, so it cannot be updated.

To resolve this error, you will need to identify the resources that are currently using the subnet, and either remove or move them to a different subnet before you can update the subnet CIDR.

You can use the command az network vnet subnet list --resource-group <resource_group> --vnet-name <vnet_name> to list the resources associated with the subnet.

Example:-

az network vnet subnet list --resource-group rakResourceGroup --vnet-name rakVnet


This command will list all resources associated with the subnet "rakSubnet" in the VNet named "rakVnet" in the resource group "rakResourceGroup".

Once you have identified the resources that are using the subnet, you can move or remove them to a different subnet before updating the CIDR of the current subnet.

It's also important to note that, changing subnet CIDR will affect the resources connected to it, and it might cause interruption to the service. So it's important to do it in a maintenance window or test it in a staging environment before applying it to the production environment.

No comments: