title: How do I create a Private EndPoint that has a Delegated Subnet in Azure?
body: <p>I have created a Private Azure Kubernetes Service. Now, I need to create a Private EndPoint that connect my existing VNET to the AZ Kubernetes.</p>
  <pre><code>az network private-endpoint create 
  --name PrivateKubeApiEndpoint2 
  --resource-group hat-eastus2-nprd-rg 
  --vnet-name eastus-28828-nprd-vnet 
  --subnet eastus2-28828-nprd-snet 
  --private-connection-resource-id /subscriptions/***/resourcegroups/aks-demo2-rg/providers/Microsoft.ContainerService/managedClusters/aks-demo2-cluster 
  --group-ids management 
  --connection-name myKubeConnection
  </code></pre>
  <p>It gives me an error saying:</p>
  <blockquote>
  <p>(PrivateEndpointCreationNotAllowedAsSubnetIsDelegated) Private endpoint /subscriptions/<em><strong>/resourceGroups/hat-eastus2-nprd-rg/providers/Microsoft.Network/privateEndpoints/PrivateKubeApiEndpoint2 cannot be created as subnet /subscriptions/</strong></em>/resourceGroups/hat-eastus2-nprd-rg/providers/Microsoft.Network/virtualNetworks/eastus-28828-nprd-vnet/subnets/eastus2-28828-nprd-snet is delegated.</p>
  </blockquote>
  <p>Question is: How do I assign a subnet that was set as delegated?</p>