|
| 1 | +--- |
| 2 | +title: Troubleshoot the SubnetIsDelegated error code |
| 3 | +description: Learn how to troubleshoot the SubnetIsDelegated error when you try to create a node pool. |
| 4 | +ms.date: 08/07/2025 |
| 5 | +editor: v-jsitser |
| 6 | +ms.reviewer: v-liuamson |
| 7 | +ms.service: azure-kubernetes-service |
| 8 | +#Customer intent: As an Azure Kubernetes user, I want to troubleshoot the SubnetIsDelegated error so that I can successfully create a node pool. |
| 9 | +ms.custom: sap:Create, Upgrade, Scale and Delete operations (cluster or nodepool) |
| 10 | +--- |
| 11 | +# Troubleshoot the SubnetIsDelegated error code |
| 12 | + |
| 13 | +This article discusses how to identify and resolve the SubnetIsDelegated error that occurs when you try to create a node pool. |
| 14 | + |
| 15 | +## Prerequisites |
| 16 | + |
| 17 | +- Azure CLI (version 2.0.59 or a later version) |
| 18 | + |
| 19 | +## Symptoms |
| 20 | + |
| 21 | +When you try to create a node pool in an AKS cluster, you receive the following error message: |
| 22 | + |
| 23 | +> **Code:** **SubnetIsDelegated** |
| 24 | +> |
| 25 | +> **Message:** `AgentPoolProfile` subnet with id \<subnet-id\> cannot be used as it\'s a delegated subnet. Please check <https://aka.ms/adv-network-prerequest> for more details. |
| 26 | +
|
| 27 | +## Cause |
| 28 | + |
| 29 | +If you try to create a node pool by using a subnet, and the subnet is delegation-enabled for a particular Azure service, the new node pool can't be integrated with the AKS service. |
| 30 | + |
| 31 | +## Resolution |
| 32 | + |
| 33 | +To resolve this issue, follow these steps: |
| 34 | + |
| 35 | +1. Verify that the subnet is correctly delegated: |
| 36 | + |
| 37 | + ```bash |
| 38 | + az network vnet subnet show \ |
| 39 | + --resource-group $RESOURCE_GROUP \ |
| 40 | + --vnet-name $VNET_NAME \ |
| 41 | + --name $SUBNET_NAME \ |
| 42 | + --query delegations |
| 43 | + ``` |
| 44 | + |
| 45 | +1. Make sure that the output shows **Microsoft.ContainerService/managedClusters** as the delegated service or no delegated service. If the output shows any other Azure service delegation, remove it by running the following command: |
| 46 | + |
| 47 | + ```bash |
| 48 | + az network vnet subnet update \ |
| 49 | + --resource-group $RESOURCE_GROUP \ |
| 50 | + --vnet-name $VNET_NAME \ |
| 51 | + --name $SUBNET_NAME \ |
| 52 | + --remove delegations 0 |
| 53 | + ``` |
| 54 | + |
| 55 | +1. Run the following command to add Managed Cluster delegation: |
| 56 | + |
| 57 | + ```bash |
| 58 | + az network vnet subnet update \ |
| 59 | + --resource-group $RESOURCE_GROUP \ |
| 60 | + --vnet-name $VNET_NAME \ |
| 61 | + --name $SUBNET_NAME \ |
| 62 | + --delegations Microsoft.ContainerService/managedClusters |
| 63 | + ``` |
| 64 | + |
| 65 | +1. After the subnet delegation is removed, try again to create the node pool by using the `az aks nodepool add` command. |
| 66 | + |
| 67 | +## References |
| 68 | + |
| 69 | +- [az aks node pool examples](/cli/azure/aks/nodepool?view=azure-cli-latest#az-aks-nodepool-add-examples&preserve-view=true) |
| 70 | + |
| 71 | +[!INCLUDE [azure-help-support](../../../includes/azure-help-support.md)] |
0 commit comments