[Appservice] fix: az webapp config set --generic-configurations silently ignores camelCase properties like webJobsEnabled#33826
az webapp config set --generic-configurations silently ignores camelCase properties like webJobsEnabled#33826Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
webapp |
…amelCase properties like webJobsEnabled
az webapp config set --generic-configurations silently ignores camelCase properties like webJobsEnabled
Live test results —
|
|
@copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33826 (review) and push a fix. Posted by agent-assist (autonomous bug-fix pipeline). |
There was a problem hiding this comment.
Automated CI Review — Changes Requested
Live-test result: success (azdev --live passed for the changed test files).
However, CI has a failing check that must be fixed:
- Check CLI Style — failed (
Azure.azure-cli (Check CLI Style)), 1 error reported.
See the Azure DevOps build log: https://dev.azure.com/azclitools/5147fa83-336e-44ef-bbe0-c86b8ae86cbb/_build/results?buildId=334415
The style checker's underlying process exited with a non-zero code (Bash exit code 4),
indicating a code-style violation (e.g. pylint/flake8/black style issue) introduced by
this PR's changes. Please run the CLI style checks locally (e.g.azdev style/
python scripts/ci/test_source.pyper repo tooling) and fix any reported issues, then
push a new commit.
Remaining checks (8) were still pending/in-progress at review time and will be
re-evaluated automatically once you push a fix.
Posted by agent-assist (autonomous bug-fix pipeline).
Fixed in commit Root cause: When I replaced Fix: Removed |
Live test results —
|
There was a problem hiding this comment.
Automated Review Summary — PASS ✅
- CI checks: 18/18 passed, 0 failed, 0 pending.
- Live test (Tester): completed successfully (
azdev testrun against the changed test files for this PR).
No outstanding issues detected. Marking this PR as ready for human review.
Posted by agent-assist (autonomous bug-fix pipeline).
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot could not run the full agentic suite for this review because it was automatically requested on a bot-authored pull request. Request a review from Copilot under Reviewers to retry with the full agentic suite. Improved support for bot-authored pull requests is coming soon.
This PR addresses a regression/behavior gap where camelCase keys provided via --generic-configurations (e.g., webJobsEnabled) were being set as Python attributes and not included in the request payload, and adds tests to prevent future regressions.
Changes:
- Update
update_site_configsto assign camelCase generic configurations via theSiteConfigmapping interface instead ofsetattr. - Switch JSON parsing for
--generic-configurationstoshell_safe_json_parseand broaden detection for IP restrictions key variants. - Add mock-based tests covering camelCase generic configurations in both
key=valueand JSON forms.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/appservice/custom.py |
Ensures camelCase keys are persisted into SiteConfig payload by using dict-style assignment. |
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands_thru_mock.py |
Adds regression tests validating camelCase generic configuration propagation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| json_object = shell_safe_json_parse(s) | ||
| for config_name in json_object: | ||
| if config_name.lower() == 'ip_security_restrictions': | ||
| if config_name.lower() in ('ip_security_restrictions', 'ipsecurityrestrictions'): | ||
| updating_ip_security_restrictions = True | ||
| result.update(json_object) |
| if any(c.isupper() for c in config_name): | ||
| configs[config_name] = value | ||
| else: | ||
| setattr(configs, config_name, value) |
az webapp config set --generic-configurations 'webJobsEnabled=false'exits 0 but never persists the value. Same silent failure occurs with JSON file input. The property is valid in the ARM API but was dropped before reaching the wire.Root causes (two interacting bugs in
update_site_configs)get_json_object()converts all camelCase JSON keys to snake_case.{"webJobsEnabled": false}→{'web_jobs_enabled': False}. Sinceweb_jobs_enabledis not a named property in the azure-mgmt-web 11.0.0 SDK model, the subsequentsetattris silently ignored.setattr(configs, 'webJobsEnabled', value)creates a Python instance attribute, not an entry in the underlyingMutableMappingdict. In azure-mgmt-web 11.0.0+,SiteConfigis aMutableMapping— the SDK serializes dict keys to the API body, not arbitrary Python attributes.Fix
get_json_object(s)withshell_safe_json_parse(s)to preserve camelCase keys from JSON input.configs[config_name] = valueinstead ofsetattr. Snake_case names continue usingsetattrso the SDK's property aliases correctly translate them (e.g.request_tracing_enabled→requestTracingEnabled).ipSecurityRestrictionsdetection to recognize the camelCase form in addition toip_security_restrictions.Testing Guide
Unit tests added in
test_webapp_commands_thru_mock.pycovering bothkey=valueand JSON input forms.History Notes
[Appservice]
az webapp config set: Fix--generic-configurationssilently dropping camelCase site config properties (e.g.webJobsEnabled)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.