[App Service] az webapp exec: Add remote shell and command execution for Linux web apps #33640
Open
vageorge00 wants to merge 14 commits into
Open
[App Service] az webapp exec: Add remote shell and command execution for Linux web apps #33640vageorge00 wants to merge 14 commits into
vageorge00 wants to merge 14 commits into
Conversation
️✔️AzureCLI-FullTest
|
|
Hi @vageorge00, |
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| webapp exec | cmd webapp exec added |
microsoft-github-policy-service
Bot
requested review from
jsntcy,
wangzelin007,
yanzhudd and
yonzhan
June 23, 2026 04:05
Contributor
|
Thank you for your contribution @vageorge00! We will review the pull request and get back to you soon. |
Collaborator
|
webapp |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
faditawfik21
approved these changes
Jul 22, 2026
Contributor
There was a problem hiding this comment.
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 execcommand 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.
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.











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/shellendpoint. 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/executeendpoint. Use--commandto run a program directly (no shell), or--shell-commandto run a command line through a shell so operators like|,&&,>work. Supports--working-directory/--cwd, and can target one instance, a comma-separated list, orallinstances 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
Adding e2e tests here: #33640 (comment)
azdev linter appservice --ci-exclusions

azdev linter appservice

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.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.