I receive an AKS error message when deploying to App services. But I don't use AKS at all.

Kim Gabrielsen 0 Reputation points
2025-08-04T23:56:24.7266667+00:00

I'm using bicep scripts to create an app gateway, v-nets and subnets. It goes according to plan.

But when my scripts starts to create the container env i receive this error message from AKS which stops my deployment dead in its track. It's an AKS error message but I'm not using AKS at all in my account. Bicep scripts can be provided. I have not been able to find any solution to my problem.

{
  "status": "Failed",
  "error": {
    "code": "DeploymentFailed",
    "target": "/subscriptions/<subscription>/resourceGroups/agwaca-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/<subscription>/resourceGroups/agwaca-rg/providers/Microsoft.Resources/deployments/env",
        "message": "The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'.",
        "details": [
          {
            "code": "DeploymentFailed",
            "target": "/subscriptions/<subscription>/resourceGroups/agwaca-rg/providers/Microsoft.Resources/deployments/env",
            "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/<subscription>/resourceGroups/agwaca-rg/providers/Microsoft.App/managedEnvironments/env-jv7mhmxta5tuc",
                "message": "The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'.",
                "details": [
                  {
                    "code": "ManagedEnvironmentSubnetIsDelegated",
                    "message": "AgentPoolProfile subnet with id /subscriptions/<subscription>/resourceGroups/agwaca-rg/providers/Microsoft.Network/virtualNetworks/vnet-jv7mhmxta5tuc/subnets/aca-env-subnet cannot be used as it's a delegated subnet. Please check https://aka.ms/adv-network-prerequest for more details.\r\nStatus: 400 (Bad Request)\r\nErrorCode: SubnetIsDelegated\r\n\r\nContent:\r\n{\r\n  \"code\": \"SubnetIsDelegated\",\r\n  \"details\": null,\r\n  \"message\": \"AgentPoolProfile subnet with id /subscriptions/<subscription>/resourceGroups/agwaca-rg/providers/Microsoft.Network/virtualNetworks/vnet-jv7mhmxta5tuc/subnets/aca-env-subnet cannot be used as it's a delegated subnet. Please check https://aka.ms/adv-network-prerequest for more details.\",\r\n  \"subcode\": \"\"\r\n}\r\n\r\nHeaders:\r\nCache-Control: no-cache\r\nPragma: no-cache\r\nx-ms-operation-identifier: REDACTED\r\nx-ms-correlation-request-id: REDACTED\r\nx-ms-request-id: 29cc3b6c-b76c-4b05-8455-f44cb1067d85\r\nStrict-Transport-Security: REDACTED\r\nx-ms-throttling-version: REDACTED\r\nx-ms-ratelimit-remaining-subscription-writes: REDACTED\r\nx-ms-routing-request-id: REDACTED\r\nX-Content-Type-Options: REDACTED\r\nX-Cache: REDACTED\r\nX-MSEdge-Ref: REDACTED\r\nDate: Mon, 04 Aug 2025 23:14:30 GMT\r\nContent-Length: 393\r\nContent-Type: application/json\r\nExpires: -1\r\n"
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
}

Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rakesh Mishra 165 Reputation points Microsoft External Staff Moderator
    2025-08-07T07:16:47.3033333+00:00

    Hi @Kim Gabrielsen ,

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    The subnet aca-env-subnet you have designated for the managed environment has one or more subnet delegations configured. Delegations reserve a subnet for specific services (e.g., Microsoft.Web/serverFarms) and prevent other resource types (including the agent pool for Container Apps) from attaching IP configurations. The error ManagedEnvironmentSubnetIsDelegated is triggered when a delegated subnet is reused.

    For Consumption-only environment:
    • Your subnet must not be delegated to any services.
    For Workload profiles environment:
    • You must delegate your subnet to Microsoft.App/environments.

    If still facing issue, please share Bicep module for VNet, Subnet, Container app and Container App Environment to assist you further.

    Reference:

    Please accept as Yes if the answer is helpful so that it can help others in the community.


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.