Skip to content

[App Service] Prevent access restriction updates from dropping site config - #34050

Open
danielw5 wants to merge 2 commits into
Azure:devfrom
danielw5:dev
Open

[App Service] Prevent access restriction updates from dropping site config#34050
danielw5 wants to merge 2 commits into
Azure:devfrom
danielw5:dev

Conversation

@danielw5

@danielw5 danielw5 commented Sep 9, 2026

Copy link
Copy Markdown
Member

🤖 PR Validation — ️✔️ All clear

Breaking Changes Tests
️✔️ None ️✔️ 130/130

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 feature


This checklist is used to make sure that common guidelines for a pull request are followed.

Copilot AI lite review requested due to automatic review settings September 9, 2026 20:55
@danielw5
danielw5 requested a review from a team as a code owner September 9, 2026 20:55
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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 properties via update_configuration.
  • Updates add/remove/set access 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)
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants