[App Service] Prevent access restriction updates from dropping site config - #34050
Open
danielw5 wants to merge 2 commits into
Open
[App Service] Prevent access restriction updates from dropping site config#34050danielw5 wants to merge 2 commits into
danielw5 wants to merge 2 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
remove_webapp_access_restriction can still throw a TypeError when restriction lists are None, which is a user-facing correctness issue.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the App Service access restriction update flow to avoid unintended overwrites of unrelated site configuration when modifying access restriction settings.
Changes:
- Introduces a helper to PATCH only specific site config
propertiesviaupdate_configuration. - Updates
add/remove/setaccess restriction operations to use the new partial-update approach instead of sending the full retrieved site config object.
File summaries
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/appservice/access_restrictions.py |
Switches access restriction mutations to partial site-config PATCH updates to prevent dropping unrelated config. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+172
to
+182
| properties = {} | ||
|
|
||
| if use_same_restrictions_for_scm_site is not None: | ||
| setattr(configs, 'scm_ip_security_restrictions_use_main', bool(use_same_restrictions_for_scm_site)) | ||
| properties['scmIpSecurityRestrictionsUseMain'] = bool(use_same_restrictions_for_scm_site) | ||
| if default_action is not None: | ||
| setattr(configs, 'ip_security_restrictions_default_action', default_action) | ||
| properties['ipSecurityRestrictionsDefaultAction'] = default_action | ||
| if scm_default_action is not None: | ||
| setattr(configs, 'scm_ip_security_restrictions_default_action', scm_default_action) | ||
| properties['scmIpSecurityRestrictionsDefaultAction'] = scm_default_action | ||
|
|
||
| app_config = _generic_site_operation( | ||
| cmd.cli_ctx, resource_group_name, name, 'update_configuration', | ||
| slot, configs) | ||
| app_config = _update_webapp_access_restrictions( | ||
| cmd, resource_group_name, name, slot, properties) |
Comment on lines
+24
to
+27
| def _update_webapp_access_restrictions(cmd, resource_group_name, name, slot, properties): | ||
| config = {'properties': properties} | ||
| return _generic_site_operation( | ||
| cmd.cli_ctx, resource_group_name, name, 'update_configuration', slot, config) |
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Yong Zhang (yonzhan)
requested review from
Ethan Yang (necusjz) and
Julie Zhu (yanzhudd)
September 9, 2026 23:01
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.
🤖 PR Validation — ️✔️ All clear
Related command
Description
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis 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.