[App Service] Fix webapp up: OS auto-detection, runtime version, HTML support, and validation#33072
[App Service] Fix webapp up: OS auto-detection, runtime version, HTML support, and validation#33072
Conversation
…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>
️✔️AzureCLI-FullTest
|
|
Hi @seligj95, |
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
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). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
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-versionand runtime+OS pre-validation. - Updated
az webapp uphelp 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.
src/azure-cli/azure/cli/command_modules/appservice/_create_util.py
Outdated
Show resolved
Hide resolved
src/azure-cli/azure/cli/command_modules/appservice/_create_util.py
Outdated
Show resolved
Hide resolved
src/azure-cli/azure/cli/command_modules/appservice/_create_util.py
Outdated
Show resolved
Hide resolved
...zure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands_thru_mock.py
Outdated
Show resolved
Hide resolved
…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>
az webapp up: detection and validation improvements
Description
Changes
#25743 — Auto-detect OS from runtime:
detect_os_from_src()to map Python, Node, .NET Core, and modern .NET → Linux (instead of only Python/Node)#25597 — Pre-validate runtime+OS combo:
validate_runtime_os_combo()that checks the runtime+OS combination is supported before creating any resourcesaz webapp list-runtimesFix runtime version detection:
_detect_python_version()that reads Python version fromruntime.txtand.python-versionfiles#25129 — Static HTML on Linux:
get_lang_from_content()now auto-detects HTML files even without the--htmlflag*shtml.instead of*.shtml)#25905 — Help text improvements:
az webapp uphelp with accurate OS default documentationTesting
test_webapp_commands_thru_mock.pyazdev style appservicepasses (pylint + flake8)Files Changed
_create_util.py— OS detection, lang detection, Python version detection, validationcustom.py— Pre-validation call inwebapp_up()_help.py— Updated help text and examplestest_webapp_commands_thru_mock.py— 15 new unit testsFixes #25743
Fixes #25597
Fixes #25129
Fixes #25905