Skip to content

[App Service] Fix webapp up: OS auto-detection, runtime version, HTML support, and validation#33072

Open
seligj95 wants to merge 2 commits intoAzure:devfrom
seligj95:fix/webapp-up-improvements
Open

[App Service] Fix webapp up: OS auto-detection, runtime version, HTML support, and validation#33072
seligj95 wants to merge 2 commits intoAzure:devfrom
seligj95:fix/webapp-up-improvements

Conversation

@seligj95
Copy link
Copy Markdown
Contributor

@seligj95 seligj95 commented Mar 26, 2026

Description

Changes

#25743 — Auto-detect OS from runtime:

  • Enhanced detect_os_from_src() to map Python, Node, .NET Core, and modern .NET → Linux (instead of only Python/Node)
  • Static HTML sites now default to Linux instead of Windows

#25597 — Pre-validate runtime+OS combo:

  • Added validate_runtime_os_combo() that checks the runtime+OS combination is supported before creating any resources
  • Fails early with a helpful message suggesting az webapp list-runtimes

Fix runtime version detection:

  • Added _detect_python_version() that reads Python version from runtime.txt and .python-version files
  • Previously Python always used the hardcoded default (e.g., 3.7) even when the project specified a newer version
  • Note: The original issue reference (2024-11-01 API version for Azure Managed HSM #30756) was incorrect — that issue is about Azure Managed HSM

#25129 — Static HTML on Linux:

  • get_lang_from_content() now auto-detects HTML files even without the --html flag
  • Also fixed the shtml glob pattern (was *shtml. instead of *.shtml)

#25905 — Help text improvements:

  • Updated az webapp up help with accurate OS default documentation
  • Added examples for Python, Node.js, .NET, and static HTML deployments

Testing

  • Added 15 unit tests covering all new functionality in test_webapp_commands_thru_mock.py
  • All 44 tests in the mock test file pass
  • azdev style appservice passes (pylint + flake8)

Files Changed

  • _create_util.py — OS detection, lang detection, Python version detection, validation
  • custom.py — Pre-validation call in webapp_up()
  • _help.py — Updated help text and examples
  • test_webapp_commands_thru_mock.py — 15 new unit tests

Fixes #25743
Fixes #25597
Fixes #25129
Fixes #25905

…zure#25905: `az webapp up`: detection and validation improvements

- Azure#25743: Enhance OS auto-detection from runtime (Python/Node/dotnetcore/dotnet → Linux, ASP.NET → Windows)
- Azure#25597: Add pre-validation of runtime+OS combo before resource creation with helpful error messages
- Azure#30756: Add Python version detection from runtime.txt and .python-version files
- Azure#25129: Auto-detect static HTML sites without --html flag; default HTML to Linux
- Azure#25905: Improve help text with more examples and accurate OS defaults documentation

Also fixes shtml glob pattern (was *shtml. instead of *.shtml).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@seligj95 seligj95 requested a review from NoriZC as a code owner March 26, 2026 15:31
Copilot AI review requested due to automatic review settings March 26, 2026 15:31
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Mar 26, 2026

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

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Hi @seligj95,
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

azure-client-tools-bot-prd bot commented Mar 26, 2026

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Mar 26, 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>

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

This PR improves az webapp up stack/OS auto-detection and adds earlier validation to fail fast for unsupported runtime+OS combinations, alongside refreshed help text and expanded unit coverage.

Changes:

  • Enhanced OS and language detection (including static HTML auto-detection and broader runtime→Linux defaults).
  • Added Python version detection from runtime.txt / .python-version and runtime+OS pre-validation.
  • Updated az webapp up help content and added new unit tests for the new behaviors.

Reviewed changes

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

File Description
src/azure-cli/azure/cli/command_modules/appservice/_create_util.py Updates stack detection logic, adds Python version detection, and introduces runtime+OS validation helper.
src/azure-cli/azure/cli/command_modules/appservice/custom.py Calls new pre-validation during webapp_up() when creating a new app.
src/azure-cli/azure/cli/command_modules/appservice/_help.py Updates az webapp up help text and examples to reflect new defaults/detection.
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands_thru_mock.py Adds unit tests covering the new detection/validation behaviors.

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

…p, lint

- Remove unused LINUX_OS_NAME import (_create_util.py)
- Fix static HTML path: use _dirpath instead of src_path in os.path.join
- Update _detect_python_version docstring to match implementation
- Fix duplicate string formatting argument (pylint W1308)
- Replace tempfile.mkdtemp()+shutil.rmtree() with TemporaryDirectory()

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@seligj95 seligj95 changed the title [App Service] Fix #25743, #25597, #30756, #25129, #25905: az webapp up: detection and validation improvements [App Service] Fix webapp up: OS auto-detection, runtime version, HTML support, and validation Mar 26, 2026
@yonzhan yonzhan assigned yanzhudd and unassigned zhoxing-ms Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

5 participants