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"
}
]
}
]
}
]
}
]
}
}