Repository navigation
az webapp exec rejects Linux custom-container web apps whose kind is "linux,container" #34226
Description
Describe the bug
TLDR; I'm unable to connect to my linux container running on Azure App Service because I get the following error:
Site is not a Linux web app. 'az webapp exec' is only supported for Linux web apps.
Details:
az webapp exec fails with "Site is not a Linux web app" for a Linux custom-container web app whose kind is linux,container. The site is a Linux web app by every other measure: it runs on a Linux App Service plan, reserved is true, siteConfig.linuxFxVersion is DOCKER|..., and the portal shows its operating system as Linux.
The check in webapp_exec.py calls is_linux_webapp, which first calls is_webapp. is_webapp requires the substring app in kind. Because linux,container doesn't contain app, the site is rejected before the linux check is reached.
For comparison, az webapp ssh decides with webapp.reserved, which is true for this site:
Users can't work around this by correcting the kind. A PATCH that sets kind to app,linux,container succeeds, and the activity log records Microsoft.Web/sites/write as Succeeded, but a later GET still returns linux,container.
All six web apps in our resource group have this kind, so this likely affects other sites created the same way.
Site properties:
az webapp show -g <rg> -n <app> --query "{kind:kind, reserved:reserved, linuxFxVersion:siteConfig.linuxFxVersion}"
{
"kind": "linux,container",
"linuxFxVersion": "DOCKER|<registry>.azurecr.io/<image>:latest",
"reserved": true
}
Failing command, debug output trimmed to the relevant lines:
az webapp exec --subscription <subscription-id> -g <rg> -n <app> --debug
DEBUG: cli.knack.cli: Command arguments: ['webapp', 'exec', '--subscription', '<subscription-id>', '--resource-group', '<rg>', '--name', '<app>', '--debug']
DEBUG: cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<rg>/providers/Microsoft.Web/sites/<app>?api-version=2025-05-01'
DEBUG: cli.azure.cli.core.sdk.policies: Response status: 200
azure.cli.core.azclierror.ValidationError: Site is not a Linux web app. 'az webapp exec' is only supported for Linux web apps.
ERROR: cli.azure.cli.core.azclierror: Site is not a Linux web app. 'az webapp exec' is only supported for Linux web apps.
Attempt to correct the kind, which is accepted but not applied:
az rest --method patch --url "https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<rg>/providers/Microsoft.Web/sites/<app>?api-version=2024-04-01" --body '{\"kind\":\"app,linux,container\"}'
az webapp show -g <rg> -n <app> --query kind
"linux,container"
Related command
az webapp exec
Errors
Site is not a Linux web app. 'az webapp exec' is only supported for Linux web apps.
Issue script & Debug output
Site properties:
az webapp show -g <rg> -n <app> --query "{kind:kind, reserved:reserved, linuxFxVersion:siteConfig.linuxFxVersion}"
{
"kind": "linux,container",
"linuxFxVersion": "DOCKER|<registry>.azurecr.io/<image>:latest",
"reserved": true
}
Failing command, debug output trimmed to the relevant lines:
az webapp exec --subscription <subscription-id> -g <rg> -n <app> --debug
DEBUG: cli.knack.cli: Command arguments: ['webapp', 'exec', '--subscription', '<subscription-id>', '--resource-group', '<rg>', '--name', '<app>', '--debug']
DEBUG: cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<rg>/providers/Microsoft.Web/sites/<app>?api-version=2025-05-01'
DEBUG: cli.azure.cli.core.sdk.policies: Response status: 200
azure.cli.core.azclierror.ValidationError: Site is not a Linux web app. 'az webapp exec' is only supported for Linux web apps.
ERROR: cli.azure.cli.core.azclierror: Site is not a Linux web app. 'az webapp exec' is only supported for Linux web apps.
Attempt to correct the kind, which is accepted but not applied:
az rest --method patch --url "https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<rg>/providers/Microsoft.Web/sites/<app>?api-version=2024-04-01" --body '{\"kind\":\"app,linux,container\"}'
az webapp show -g <rg> -n <app> --query kind
"linux,container"
Expected behavior
az webapp exec opens a shell in the app container, because the site is a Linux web app.
Environment Summary
azure-cli 2.91.0
core 2.91.0
telemetry 1.1.0
Dependencies:
msal 1.39.0
azure-mgmt-resource 24.0.0
Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Config directory 'C:\Users\<user>\.azure'
Extensions directory 'C:\Users\<user>\.azure\cliextensions'
Python (Windows) 3.14.7 (tags/v3.14.7:823f032, Aug 5 2026, 10:51:32) [MSC v.1944 64 bit (AMD64)]
Additional context
The check is unchanged on the dev branch at the commit linked above, and 2.91.0 is the latest release.
Activity
yonzhan commentedon Oct 14, 2026
Thank you for opening this issue, we will look into it.
x-engineering-agent commentedon Oct 15, 2026
A Linux App Service custom-container site returned by the service as kind linux,container and reserved=true is rejected by az webapp exec as non-Linux, before the command reaches the container. The same rejection was reproduced in the Windows Server 2025 sandbox with CLI 2.91.0 and current dev. The command should accept this Linux site while continuing to reject non-Linux and non-webapp sites.
Important
Likely root cause (93% confidence): webapp_exec fetches the site then calls is_linux_webapp. That predicate calls is_webapp first, which requires the literal substring app in kind; kind linux,container fails that condition even when the site is reserved for Linux. The CLI throws ValidationError before reaching the SCM command execution.
📍 Affected code
utils.pysrc/azure-cli/azure/cli/command_modules/appserviceis_linux_webappwebapp_exec.pysrc/azure-cli/azure/cli/command_modules/appservicewebapp_execnetwork_capture.pysrc/azure-cli/azure/cli/command_modules/appservicecollect_network_capture🛠️ Proposed change
In appservice/utils.py, teach is_linux_webapp to recognize the specific Linux custom-container site kind even when it lacks app, using the Linux/reserved site signals while retaining logic/function and Windows exclusions. Keep is_webapp unchanged rather than altering other command classifications. Both exec and network capture then use the corrected shared predicate.
🚫 Ruled out
🧬 Origin
functionapp deployment github-actions: Add new functionapp github-actions commands #23326 (2022-07-28); is_linux_webapp from [App Service]az webapp up: Add--track-statusparameter to use deployment status API (#28235) #28235 (2024-01-25); exec from {App Service}az webapp exec: Add remote shell and command execution for Linux web apps #33640 (2026-08-05).⏱️ Why this surfaced now
The 2026-08-05 addition of az webapp exec reused the older kind predicate, exposing its assumption for custom-container sites; the issue surfaced on CLI 2.91.0. No appservice-related dependency bump was evident in the reviewed year of dependency pin changes.
az webapp exec: Add remote shell and command execution for Linux web apps #33640 added exec on 2026-08-05; {Release} Upgrade to Azure CLI 2.91.0 #34143 released CLI 2.91.0 on 2026-09-29.functionapp deployment github-actions: Add new functionapp github-actions commands #23326 and is_linux_webapp to [App Service]az webapp up: Add--track-statusparameter to use deployment status API (#28235) #28235; network capture also reused the predicate in [App Service]az webapp troubleshoot collect network-capture: Add command to collect network capture #33949.💥 Blast radius
🔬 Technical details
Evidence
Test plan
Add an appservice tests/latest ScenarioTest that creates a Linux App Service plan and a custom-container site with kind linux,container (as in the sandbox), verifies the returned kind and reserved flag, waits for the container to start, and invokes az webapp exec --mode execute --command on it; assert the command reaches the container rather than merely avoiding the preflight error. The live-test lane must record the scenario after a successful run. Also cover normal app,linux, Windows, function/logic and Linux custom-container kinds with focused predicate tests, and exercise the network-capture guard with the same kind without mocking the predicate; existing mock-only webapp exec tests bypass this failure.
Generated code: Handwritten code. The predicate in appservice/utils.py and both callers are handwritten Python code outside aaz/ or generated clients.
Ask the Agent
Tick a box to queue an action. Requires write access to this repository.
Live reproduction (BAMI sandbox) — Reproduced
Verdict: Reproduced on the current build.
Steps run (redacted)
2.91.0 (reported)
2.91.0 (latest)
dev @ af86318
Sandbox run
Commands ran in an isolated Azure sandbox subscription from a validated ReproSpec; output is redacted.
microsoft-github-policy-service commentedon Oct 27, 2026
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc AzureAppServiceCLI (@AzureAppServiceCLI), antcp, @yutanglin16, @Azure/act-observability-squad.
microsoft-github-policy-service commentedon Oct 27, 2026
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc AzureAppServiceCLI (@AzureAppServiceCLI), antcp, @yutanglin16, @Azure/act-observability-squad.
x-engineering-agent commentedon Oct 27, 2026
⏳ Queued — X Engineering Agent picked up this request and will post its findings here.