Skip to content

[App Service] Add deployment guidance, warnings, and container image fix for Linux web apps#33088

Open
vageorge00 wants to merge 5 commits intoAzure:devfrom
vageorge00:appservice-deploy-ux-improvements
Open

[App Service] Add deployment guidance, warnings, and container image fix for Linux web apps#33088
vageorge00 wants to merge 5 commits intoAzure:devfrom
vageorge00:appservice-deploy-ux-improvements

Conversation

@vageorge00
Copy link
Copy Markdown

@vageorge00 vageorge00 commented Mar 27, 2026

Related command
az webapp create, az webapp deploy, az webapp up, az webapp delete, az webapp deployment source config-local-git, az appservice plan update

Description

Fixes https://github.com/serverless-paas-balam/tuxedo/issues/119

Improves the Azure CLI experience for deploying Linux web apps by adding help text, runtime warnings, and a container image bug fix.

Help text: Added deployment guidance to az webapp create, SCM_DO_BUILD_DURING_DEPLOYMENT guidance to az webapp deploy, OS/runtime/plan defaults to az webapp up, branch convention to config-local-git, and scale up vs scale out to az appservice plan update.

Code: Fixed container image path doubling in create_webapp/create_webapp_slot when --container-image-name includes the registry host. Added runtime warnings for zip deploy on Python/Node/PHP, OS type defaulting, runtime auto-detection, plan auto-generation, delete plan warning, and local-git branch convention.

Testing Guide

azdev style appservice  # PASSED
azdev linter appservice  # PASSED

# Verify help text changes:
az webapp create --help
az webapp deploy --help
az webapp up --help

# Verify runtime warnings (create a Python Linux app and deploy):
az webapp deploy -g MyRG -n MyPythonApp --src-path app.zip --type zip
# Should see: "Note: 'az webapp deploy' does not install dependencies..."

End-to-end agent tests across Python, .NET, Java, and containers confirmed all warnings fire correctly.
Manual end-end tests:

Testing container image bug fix
Normal case:
Image name is just nginx:latest (no registry host). CLI prepends the host: index.docker.io/nginx:latest.
image
image

Test case (bug fix):
Image name already includes the registry host (docker.io/). Before fix, CLI would prepend it again:
docker.io/docker.io/nginx:latest (broken).
After our fix, CLI strips the duplicate: docker.io/nginx:latest (correct).
image
image

Testing some logging changes
az webapp deployment source config-local-git -g test-container-rg -n test-container-app2
We get log about branch info
image

az webapp delete -g test-container-rg -n test-container-app3
We get warning about plan being deleted
image

We get added help info:
az webapp deploy --help
image

az webapp create --help
image

param check:
image

History Notes

[App Service] az webapp create: Add post-creation deployment guidance and startup command examples
[App Service] az webapp deploy: Add dependency installation guidance for Linux zip deployments
[App Service] az webapp up: Add logging for OS type, runtime auto-detection, and plan auto-generation
[App Service] Fix container image path doubling when --container-image-name includes registry host
[App Service] az webapp delete: Add warning about App Service Plan deletion


@microsoft-github-policy-service agree company="Microsoft"

vageorge00 and others added 3 commits March 27, 2026 10:50
…Linux

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-client-tools-bot-prd
Copy link
Copy Markdown

Validation for Azure CLI Full Test Starting...

Thanks for your contribution!

@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
Copy link
Copy Markdown

Validation for Breaking Change Starting...

Thanks for your contribution!

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Mar 27, 2026

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

@github-actions
Copy link
Copy Markdown

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

type: command
short-summary: Get a URL for a git repository endpoint to clone and push to for web app deployment.
long-summary: |
Note: The default deployment branch is 'master'. If your local branch is 'main',
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

site_config = get_site_configs(cmd, resource_group_name, name, slot)
site_config.scm_type = 'LocalGit'
_generic_site_operation(cmd.cli_ctx, resource_group_name, name, 'create_or_update_configuration', slot, site_config)
logger.warning("Note: The default deployment branch is 'master'. If your local branch is 'main', "
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

linux_fx = getattr(site_config, 'linux_fx_version', '') or ''
stack_prefix = linux_fx.split('|')[0].upper() if '|' in linux_fx else ''
if stack_prefix in ('PYTHON', 'NODE', 'PHP'):
logger.warning(
Copy link
Copy Markdown
Author

@vageorge00 vageorge00 Mar 27, 2026

Choose a reason for hiding this comment

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

If we add this warning log:
Pros:
Helps with deployment confusion when --help is not read

Cons:

  • Logs even if SCM_DO_BUILD_DURING_DEPLOYMENT is already set. Could check app settings (extra API call) to suppress, but could add some latency.
  • If WEBSITE_RUN_FROM_PACKAGE=1 is also set, it overrides SCM_DO_BUILD_DURING_DEPLOYMENT and Oryx won't run. The warning's guidance would be misleading in that case.
  • Also logs when --type is not specified (artifact_type=None), which could include non-zip deploys. The stack check (PYTHON/NODE/PHP) mitigates most false positives since Java/.NET stacks won't match.

Open to removing the runtime warning and keeping only the help text guidance if the noise is a concern.

@vageorge00 vageorge00 marked this pull request as ready for review March 27, 2026 23:09
Copilot AI review requested due to automatic review settings March 27, 2026 23:09
Suggested next steps after creation:
- Deploy your code:
az webapp deploy -g MyResourceGroup -n MyAppName --src-path app.zip --type zip
- For apps loading large models or dependencies at startup, increase the container
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is only relevant to linux apps, we should specify that here

az webapp create -g MyResourceGroup -p MyPlan -n MyUniqueAppName --end-to-end-encryption-enabled true --min-tls-version 1.2
- name: Create a Linux Python web app with a custom startup command.
text: >
az webapp create -g MyResourceGroup -p MyLinuxPlan -n MyUniqueAppName --runtime "PYTHON:3.12" --startup-file "gunicorn --bind=0.0.0.0 app:app"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does this may sense to include in a create command when there is no code deployed?

az webapp up -n MyApp --runtime "PYTHON:3.12" --plan MyPlan --sku P1v3
- name: Deploy a .NET app to Linux (must specify --os-type linux).
text: >
az webapp up -n MyDotnetApp --runtime "DOTNETCORE:8.0" --os-type linux --plan MyPlan
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we pick the latest LTS runtime versions for each of these?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves the Azure CLI App Service module UX for Linux web app deployments by adding contextual help/warnings and fixing a container image normalization bug that could generate invalid image paths.

Changes:

  • Fixes container image name “registry host doubling” when --container-image-name already includes the registry host (webapp + slot creation).
  • Adds new warning messages in key flows (webapp create, webapp delete, webapp up, webapp deploy, config-local-git, plan create) to guide next steps and clarify defaults/limitations.
  • Expands command help text for az webapp create, az webapp deploy, az webapp up, and related commands with deployment guidance and conventions.

Reviewed changes

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

File Description
src/azure-cli/azure/cli/command_modules/appservice/custom.py Container image normalization fix + multiple new runtime/defaulting/deployment guidance warnings.
src/azure-cli/azure/cli/command_modules/appservice/_params.py Refines parameter help text for plan scaling, startup command guidance, and webapp up defaults.
src/azure-cli/azure/cli/command_modules/appservice/_help.py Adds/extends long summaries and examples to clarify deployment flows and conventions.

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

Comment on lines +9143 to +9149
if language:
if not version_used_create or version_used_create == '-':
logger.warning("No --runtime specified. Could not auto-detect a valid %s version. "
"Please specify --runtime explicitly. "
"Use 'az webapp list-runtimes' for available options.", language.upper())
else:
logger.warning("No --runtime specified. Using %s version: %s.", language, version_used_create)
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

For static site detection (language == "static"), get_runtime_version_details returns "-" and this new warning will incorrectly tell users to specify --runtime. Consider excluding STATIC_RUNTIME_NAME from this warning (and possibly skipping the message whenever version_used_create == "-") to avoid misleading guidance for --html/static deployments.

Copilot uses AI. Check for mistakes.
Comment on lines +9560 to +9566
# Warn interpreted-language Linux apps that zip deploy won't auto-build
if params.is_linux_webapp and artifact_type in (None, 'zip'):
try:
site_config = get_site_configs(cmd, resource_group_name, name, slot)
linux_fx = getattr(site_config, 'linux_fx_version', '') or ''
stack_prefix = linux_fx.split('|')[0].upper() if '|' in linux_fx else ''
if stack_prefix in ('PYTHON', 'NODE', 'PHP'):
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

This warning condition treats artifact_type=None as equivalent to zip, but artifact_type is inferred later from src_path (_update_artifact_type). As a result, deploying a non-zip artifact without --type (e.g., a static file) can still trigger the "zip deploy won't auto-build" warning. Consider determining the effective artifact type first (call the inference helper earlier or check src_path extension) and only warn when the final type is zip.

Copilot uses AI. Check for mistakes.

_enable_basic_auth(cmd, name, None, resource_group_name, basic_auth.lower())
if not using_webapp_up:
logger.warning("Webapp '%s' created. Deploy your code with: az webapp deploy or az webapp up", name)
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

The post-create message always says the webapp was "created", but this function also runs when the app name already exists (it logs that earlier and then does a create_or_update). This is misleading for update scenarios; consider conditioning the message on name_validation.name_available or changing it to "created or updated".

Suggested change
logger.warning("Webapp '%s' created. Deploy your code with: az webapp deploy or az webapp up", name)
logger.warning("Webapp '%s' created or updated. Deploy your code with: az webapp deploy or az webapp up", name)

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It's run from az webapp create. Keep wording.

Comment on lines +4318 to +4320
os_type = 'Linux' if is_linux else 'Windows'
logger.warning("App Service Plan '%s' created (%s).", name, os_type)

Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

This log is emitted immediately after the create/update request is started, before poller.result() completes, and it always says "created" even when the plan already exists (create-or-update semantics) or when the LRO later fails. Consider moving this message after a successful result and wording it as "created or updated" (and/or including the resulting provisioning state).

Copilot uses AI. Check for mistakes.
local_context_attribute=LocalContextAttribute(name='web_name', actions=[LocalContextAction.SET],
scopes=['webapp', 'cupertino']))
c.argument('startup_file', help="Linux only. The web's startup file")
c.argument('startup_file', help="Linux only. The web's startup file. "
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is really the startup command, not really a file, maybe slightly to reflect that

short-summary: Allows management operations for webjobs on a web app.
long-summary: |
To create WebJobs, use the Azure portal. For more information and other options,
see: https://learn.microsoft.com/azure/app-service/webjobs-create
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This might be linux specific guidance, I assume windows would work if the command exists. If webjob management via CLI is not supported for linux then we may want to take action to not allow it at all.

urlparse(container_registry_url).hostname,
container_image_name[1:] if container_image_name.startswith('/') else container_image_name)
if container_registry_url:
registry_host = urlparse(container_registry_url).hostname
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There is a bunch of legacy stuff with old app settings. Which problem are we trying to solve here? I don't want to mistakenly break something, and maybe we can push people in a better direction?

"storage_mounts": storage_mounts,
})

os_type = 'Linux' if is_linux else 'Windows'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

just making sure, are we possibly missing xenon? I have no idea how that shows up. It may also be "windows"

stack_prefix = linux_fx.split('|')[0].upper() if '|' in linux_fx else ''
if stack_prefix in ('PYTHON', 'NODE', 'PHP'):
logger.warning(
"Note: 'az webapp deploy' does not install dependencies (pip install, npm install, "
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit: this sentence az webapp deploy' does not install dependencies (pip install, npm install, etc.) for Linux web apps. is not exactly correct. We don't unless the app setting is set.

I guess maybe just rephrase slightly to make it very clear

Good point - no ruby

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@yonzhan yonzhan assigned yanzhudd and unassigned jiasli and zhoxing-ms Mar 27, 2026
@microsoft-github-policy-service
Copy link
Copy Markdown
Contributor

@vageorge00 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"
Contributor License Agreement

Contribution License Agreement

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
and conveys certain license rights to Microsoft Corporation and its affiliates (“Microsoft”) for Your
contributions to Microsoft open source projects. This Agreement is effective as of the latest signature
date below.

  1. Definitions.
    “Code” means the computer software code, whether in human-readable or machine-executable form,
    that is delivered by You to Microsoft under this Agreement.
    “Project” means any of the projects owned or managed by Microsoft and offered under a license
    approved by the Open Source Initiative (www.opensource.org).
    “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any
    Project, including but not limited to communication on electronic mailing lists, source code control
    systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of
    discussing and improving that Project, but excluding communication that is conspicuously marked or
    otherwise designated in writing by You as “Not a Submission.”
    “Submission” means the Code and any other copyrightable material Submitted by You, including any
    associated comments and documentation.
  2. Your Submission. You must agree to the terms of this Agreement before making a Submission to any
    Project. This Agreement covers any and all Submissions that You, now or in the future (except as
    described in Section 4 below), Submit to any Project.
  3. Originality of Work. You represent that each of Your Submissions is entirely Your original work.
    Should You wish to Submit materials that are not Your original work, You may Submit them separately
    to the Project if You (a) retain all copyright and license information that was in the materials as You
    received them, (b) in the description accompanying Your Submission, include the phrase “Submission
    containing materials of a third party:” followed by the names of the third party and any licenses or other
    restrictions of which You are aware, and (c) follow any other instructions in the Project’s written
    guidelines concerning Submissions.
  4. Your Employer. References to “employer” in this Agreement include Your employer or anyone else
    for whom You are acting in making Your Submission, e.g. as a contractor, vendor, or agent. If Your
    Submission is made in the course of Your work for an employer or Your employer has intellectual
    property rights in Your Submission by contract or applicable law, You must secure permission from Your
    employer to make the Submission before signing this Agreement. In that case, the term “You” in this
    Agreement will refer to You and the employer collectively. If You change employers in the future and
    desire to Submit additional Submissions for the new employer, then You agree to sign a new Agreement
    and secure permission from the new employer before Submitting those Submissions.
  5. Licenses.
  • Copyright License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license in the
    Submission to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute
    the Submission and such derivative works, and to sublicense any or all of the foregoing rights to third
    parties.
  • Patent License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license under
    Your patent claims that are necessarily infringed by the Submission or the combination of the
    Submission with the Project to which it was Submitted to make, have made, use, offer to sell, sell and
    import or otherwise dispose of the Submission alone or with the Project.
  • Other Rights Reserved. Each party reserves all rights not expressly granted in this Agreement.
    No additional licenses or rights whatsoever (including, without limitation, any implied licenses) are
    granted by implication, exhaustion, estoppel or otherwise.
  1. Representations and Warranties. You represent that You are legally entitled to grant the above
    licenses. You represent that each of Your Submissions is entirely Your original work (except as You may
    have disclosed under Section 3). You represent that You have secured permission from Your employer to
    make the Submission in cases where Your Submission is made in the course of Your work for Your
    employer or Your employer has intellectual property rights in Your Submission by contract or applicable
    law. If You are signing this Agreement on behalf of Your employer, You represent and warrant that You
    have the necessary authority to bind the listed employer to the obligations contained in this Agreement.
    You are not expected to provide support for Your Submission, unless You choose to do so. UNLESS
    REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, AND EXCEPT FOR THE WARRANTIES
    EXPRESSLY STATED IN SECTIONS 3, 4, AND 6, THE SUBMISSION PROVIDED UNDER THIS AGREEMENT IS
    PROVIDED WITHOUT WARRANTY OF ANY KIND, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY OF
    NONINFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
  2. Notice to Microsoft. You agree to notify Microsoft in writing of any facts or circumstances of which
    You later become aware that would make Your representations in this Agreement inaccurate in any
    respect.
  3. Information about Submissions. You agree that contributions to Projects and information about
    contributions may be maintained indefinitely and disclosed publicly, including Your name and other
    information that You submit with Your Submission.
  4. Governing Law/Jurisdiction. This Agreement is governed by the laws of the State of Washington, and
    the parties consent to exclusive jurisdiction and venue in the federal courts sitting in King County,
    Washington, unless no federal subject matter jurisdiction exists, in which case the parties consent to
    exclusive jurisdiction and venue in the Superior Court of King County, Washington. The parties waive all
    defenses of lack of personal jurisdiction and forum non-conveniens.
  5. Entire Agreement/Assignment. This Agreement is the entire agreement between the parties, and
    supersedes any and all prior agreements, understandings or communications, written or oral, between
    the parties relating to the subject matter hereof. This Agreement may be assigned by Microsoft.

… static site fix, container warning, startup command clarification

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants