About Me

My photo
I am MCSE in Data Management and Analytics with specialization in MS SQL Server and MCP in Azure. I have over 13+ years of experience in IT industry with expertise in data management, Azure Cloud, Data-Canter Migration, Infrastructure Architecture planning and Virtualization and automation. Contact me if you are looking for any sort of guidance in getting your Infrastructure provisioning automated through Terraform. I sometime write for a place to store my own experiences for future search and read by own blog but can hopefully help others along the way. Thanks.

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: