Skip to content

[App Service] az webapp exec: Add remote shell and command execution for Linux web apps #33640

Open
vageorge00 wants to merge 14 commits into
Azure:devfrom
vageorge00:exec-execute
Open

[App Service] az webapp exec: Add remote shell and command execution for Linux web apps #33640
vageorge00 wants to merge 14 commits into
Azure:devfrom
vageorge00:exec-execute

Conversation

@vageorge00

@vageorge00 vageorge00 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Related command
az webapp exec

Description
Adds az webapp exec (preview), a new command for Linux web apps that lets you interact with the running container directly from the CLI. It has two modes:

  • --mode shell (default): opens an interactive terminal session to the main container over a WebSocket to the SCM /exec/shell endpoint. Supports a custom shell via --shell, ANSI/VT rendering, terminal-resize forwarding, UTF-8/UTF-16 input, and "Ctrl+C twice to exit". Works on both Windows and Unix consoles.
  • --mode execute: runs a command in the container (fire-and-forget) via the SCM /exec/execute endpoint. Use --command to run a program directly (no shell), or --shell-command to run a command line through a shell so operators like |, &&, > work. Supports --working-directory/--cwd, and can target one instance, a comma-separated list, or all instances in parallel.

The command validates that the target is a Linux web app and rejects invalid mode/parameter combinations with clear errors. Slots are supported via --slot.

Testing Guide
Interactive shell to a random instance
az webapp exec -g MyRg -n MyWebapp --mode shell

Interactive shell on a specific instance, using /bin/sh
az webapp exec -g MyRg -n MyWebapp --mode shell -i --shell /bin/sh

Run a program directly (no shell interpretation)
az webapp exec -g MyRg -n MyWebapp --mode execute --command "mkdir /home/site/newdir"

Run a shell command line (operators work) on all instances
az webapp exec -g MyRg -n MyWebapp --mode execute --instance all --shell-command "echo hi > /home/LogFiles/out.txt"

Execute against a slot
az webapp exec -g MyRg -n MyWebapp -s staging --mode execute --command "touch newfile.txt"

Unit tests: azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_exec_thru_mock.py
All pass
image
image

Adding e2e tests here: #33640 (comment)

azdev linter appservice --ci-exclusions
image

azdev linter appservice
image

History Notes
[App Service] az webapp exec: Add command to run an interactive shell or execute commands in Linux web app containers (preview)

This checklist is used to make sure that common guidelines for a pull request are followed.

@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Jun 23, 2026

Copy link
Copy Markdown
️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.14
️✔️acs
️✔️latest
️✔️3.12
️✔️3.14
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.14
️✔️ams
️✔️latest
️✔️3.12
️✔️3.14
️✔️apim
️✔️latest
️✔️3.12
️✔️3.14
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.14
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.14
️✔️aro
️✔️latest
️✔️3.12
️✔️3.14
️✔️backup
️✔️latest
️✔️3.12
️✔️3.14
️✔️batch
️✔️latest
️✔️3.12
️✔️3.14
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.14
️✔️billing
️✔️latest
️✔️3.12
️✔️3.14
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.14
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.14
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.14
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.14
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.14
️✔️config
️✔️latest
️✔️3.12
️✔️3.14
️✔️configure
️✔️latest
️✔️3.12
️✔️3.14
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.14
️✔️container
️✔️latest
️✔️3.12
️✔️3.14
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.14
️✔️core
️✔️latest
️✔️3.12
️✔️3.14
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.14
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.14
️✔️dls
️✔️latest
️✔️3.12
️✔️3.14
️✔️dms
️✔️latest
️✔️3.12
️✔️3.14
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.14
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.14
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.14
️✔️find
️✔️latest
️✔️3.12
️✔️3.14
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.14
️✔️identity
️✔️latest
️✔️3.12
️✔️3.14
️✔️iot
️✔️latest
️✔️3.12
️✔️3.14
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.14
️✔️lab
️✔️latest
️✔️3.12
️✔️3.14
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.14
️✔️maps
️✔️latest
️✔️3.12
️✔️3.14
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.14
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.14
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.14
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.14
️✔️network
️✔️latest
️✔️3.12
️✔️3.14
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.14
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.14
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.14
️✔️profile
️✔️latest
️✔️3.12
️✔️3.14
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.14
️✔️redis
️✔️latest
️✔️3.12
️✔️3.14
️✔️relay
️✔️latest
️✔️3.12
️✔️3.14
️✔️resource
️✔️latest
️✔️3.12
️✔️3.14
️✔️role
️✔️latest
️✔️3.12
️✔️3.14
️✔️search
️✔️latest
️✔️3.12
️✔️3.14
️✔️security
️✔️latest
️✔️3.12
️✔️3.14
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.14
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.14
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.14
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.14
️✔️sql
️✔️latest
️✔️3.12
️✔️3.14
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.14
️✔️storage
️✔️latest
️✔️3.12
️✔️3.14
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.14
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.14
️✔️util
️✔️latest
️✔️3.12
️✔️3.14
️✔️vm
️✔️latest
️✔️3.12
️✔️3.14

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi @vageorge00,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Jun 23, 2026

Copy link
Copy Markdown
⚠️AzureCLI-BreakingChangeTest
⚠️appservice
rule cmd_name rule_message suggest_message
⚠️ 1001 - CmdAdd webapp exec cmd webapp exec added

@microsoft-github-policy-service microsoft-github-policy-service Bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Jun 23, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Thank you for your contribution @vageorge00! We will review the pull request and get back to you soon.

@yonzhan

yonzhan commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

webapp

@vageorge00
vageorge00 marked this pull request as ready for review July 22, 2026 14:05
@vageorge00
vageorge00 requested a review from a team as a code owner July 22, 2026 14:05
Copilot AI review requested due to automatic review settings July 22, 2026 14:05
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@vageorge00 vageorge00 changed the title az webapp exec [App Service] az webapp exec Jul 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new preview command, az webapp exec, under the App Service command module to let users interact with Linux web app containers via the SCM (Kudu) /exec/shell (interactive) and /exec/execute (fire-and-forget) endpoints.

Changes:

  • Adds the webapp exec command implementation with validation, instance targeting, interactive WebSocket shell mode, and parallel execute mode.
  • Registers the new command and wires up parameters/help content.
  • Adds unit tests validating parameter rules and key helper behaviors.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/azure-cli/azure/cli/command_modules/appservice/webapp_exec.py New command implementation for interactive shell and execute modes via SCM endpoints.
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_exec_thru_mock.py Unit tests covering validation and helper functions for webapp exec.
src/azure-cli/azure/cli/command_modules/appservice/commands.py Registers az webapp exec as a preview command.
src/azure-cli/azure/cli/command_modules/appservice/_params.py Adds CLI arguments for webapp exec (mode, instance, command variants, etc.).
src/azure-cli/azure/cli/command_modules/appservice/_help.py Adds help text and examples for the new command.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/azure-cli/azure/cli/command_modules/appservice/webapp_exec.py
Comment thread src/azure-cli/azure/cli/command_modules/appservice/webapp_exec.py
Comment thread src/azure-cli/azure/cli/command_modules/appservice/webapp_exec.py
Comment thread src/azure-cli/azure/cli/command_modules/appservice/webapp_exec.py
Comment thread src/azure-cli/azure/cli/command_modules/appservice/webapp_exec.py
Comment thread src/azure-cli/azure/cli/command_modules/appservice/webapp_exec.py
Comment thread src/azure-cli/azure/cli/command_modules/appservice/webapp_exec.py Outdated
@vageorge00

vageorge00 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Adding e2e test results here:
SHELL MODE
Shell mode from windows:
image
Shell mode from Linux wsl
image
Specify --shell:
image
Shell mode to a specific instance:
image

EXECUTE MODE
Execute succeeds cases:

Execute mode , instance not specified
image
Instance list
image
all
image
Cases where execute fails (incorrect/invalid args)
no instance specified, instance specified, all, instance list
image
image
Wrong instance -> fail fast (even if some of the instances in the list are valid) We do not want partially running commands because of invalid instances.
image
Command succeeds on some instances, fails on others
image

Comment thread src/azure-cli/azure/cli/command_modules/appservice/webapp_exec.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/appservice/webapp_exec.py
Comment thread src/azure-cli/azure/cli/command_modules/appservice/webapp_exec.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/appservice/webapp_exec.py
Comment thread src/azure-cli/azure/cli/command_modules/appservice/webapp_exec.py Outdated
@vageorge00 vageorge00 changed the title [App Service] az webapp exec [App Service] az webapp exec: Add remote shell and command execution for Linux web apps  Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-observability-squad Auto-Assign Auto assign by bot customer-reported Issues that are reported by GitHub users external to the Azure organization. Web Apps az webapp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants