Skip to content

[App Service] Add Active Backup silo management preview - #34239

Open
JarodAertsMsft wants to merge 7 commits into
Azure:devfrom
JarodAertsMsft:active-backup-preview
Open

JarodAertsMsft wants to merge 7 commits into
Azure:devfrom
JarodAertsMsft:active-backup-preview

Conversation

@JarodAertsMsft

@JarodAertsMsft JarodAertsMsft commented Oct 19, 2026 •

Copy link
Copy Markdown

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes Tests Suppressions
⚠️ None ️✔️ 130/130 ⚠️ 1 added
⚠️AzureCLI-BreakingChangeTest
⚠️appservice
rule cmd_name rule_message suggest_message
⚠️ 1011 - SubgroupAdd appservice plan silo sub group appservice plan silo added
⚠️ 1011 - SubgroupAdd webapp last-known-good sub group webapp last-known-good added
⚠️ 1011 - SubgroupAdd webapp managed-traffic sub group webapp managed-traffic added
⚠️ 1011 - SubgroupAdd webapp silo sub group webapp silo added

This PR adds warning or check suppressions. Fix the underlying warning where possible and justify each remaining suppression in a code comment or the PR description.

1 added suppression
File Line Kind Code
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_active_backup_commands.py 16 skipped test @unittest.skipUnless(os.environ.get('AZURE_ACTIVE_BACKUP_LIVE') == '1',

Related command

az appservice plan silo, az webapp silo, az webapp managed-traffic, az webapp last-known-good

Description

Add public-preview Active Backup silo management for App Service plans and web apps using standard AAZ-generated command implementations.

Generation now targets the merged App Service 2026-08-01 contract from Azure/azure-rest-api-specs#44330, pinned to merge commit 2d07da92bcad212fdd5e2bffebf96563081ec250. No additional Swagger PR is required for this CLI update.

Preview scope

The implementation exposes 25 preview commands covering 21 HTTP operations, plus generated update/wait behavior:

Command group Commands
appservice plan silo create, update, show, list, delete, wait
appservice plan silo vnet-integration list
webapp silo create, update, show, list, delete, wait, refresh
webapp silo vnet-integration list, show, add, update, remove
webapp managed-traffic list, show, update
webapp last-known-good list, show, mark
  • Regenerate silo resources with root ARM location/tags and the corrected plan-VNet inspection envelope. Add site-silo VNet collection listing.
  • Require --primary-location in the command models for both silo create commands; omission fails before any HTTP request. Keep standard AAZ location defaults and the separate optional legacy --silo-location field.
  • Remove all handwritten Active Backup compatibility subclasses and their command-class replacements. Authentication, cloud selection, transport, serialization, pagination, polling and error formatting use standard AAZ/core behavior.
  • Retain the generator's standard GET+PUT silo update, including tags and generic --set/--add/--remove support. The tags-only PATCH operations are not separate CLI commands. Site VNet update uses the modeled PATCH operation.
  • Preserve the small resource-ID validator that prevents core ID expansion from retargeting another resource type. Existing ordinary webapp/plan commands, API versions and SDK pins remain unchanged.
  • Keep --no-wait and resource-based wait commands standard. Refresh returns on HTTP 204 acceptance; it does not wait for revision propagation.

Silo pass-through APIs, standalone operation inspection, managed-traffic metrics and a synthetic failover workflow remain out of scope. See the preview guide for usage and limitations.

Accepted backend rollout gaps

Implement the merged contract without CLI-specific workarounds for accepted backend gaps. Tags-only PATCH, site-silo VNet collection GET and trafficMode read-back have agreed service follow-ups; temporary service failures or absent fields are expected until those changes deploy. The CLI does not feature-detect these capabilities, fabricate successful responses, fall back from origin GET to list, or override async-monitor selection. Standard polling can fail on malformed/empty async-status responses while the service operation continues.

Companion models

The corresponding Azure/aaz command-model changes have been prepared and verified locally against a pinned upstream baseline, including preservation of existing parent command indexes. They have not been pushed or published as a companion PR. That separate command-model publication/cross-link remains outstanding; it is not another Swagger change. Developer-local specs, models, patch packages, environments and reports under ignored .x paths are not part of this CLI commit.

Testing Guide

With an eligible primary plan/app, feature-enabled subscription and supported regions, create the plan silo before the site silo:

az appservice plan silo create --resource-group MyGroup --name MyPlan --silo WestPlan --location westus2 --primary-location eastus --number-of-workers 2
az webapp silo create --resource-group MyGroup --name MyApp --silo WestApp --location westus2 --primary-location eastus --traffic-mode Active
az webapp silo show --resource-group MyGroup --name MyApp --silo WestApp
az webapp silo vnet-integration list --resource-group MyGroup --name MyApp --silo WestApp
az appservice plan silo update --resource-group MyGroup --name MyPlan --silo WestPlan --tags environment=preview
az webapp managed-traffic update --resource-group MyGroup --name MyApp --traffic-mode Passive
az webapp silo refresh --resource-group MyGroup --name MyApp

Delete site silos before their backing plan silo. Live execution allocates billable resources and requires explicit authorization and service-side enablement. No live resources were provisioned for this update. Native Windows/Linux scenarios remain opt-in, live-only tests; sanitized replay recordings for those new scenarios are still outstanding.

Local validation for d3f1b046dc

Used the same immutable azdev/diff-tool revision selected by this branch's CI environment setup (c429216bfdae9b196dcfa6689f4d3f15a7b7054e) in the repository virtual environment, with repository-local configuration.

These exact commands passed:

.\env\Scripts\azdev.exe style appservice
.\env\Scripts\azdev.exe linter appservice --ci-exclusions --min-severity medium
git diff HEAD^ HEAD --check

The command-table linter passed with the repository's existing CI exclusions applied; no new exclusions were added.

The focused offline regression command passed: 54 tests run, 52 passed, 2 opt-in live scenarios skipped:

$repo = (Get-Location).Path
$env:PYTHONPATH = "$repo\src\azure-cli;$repo\src\azure-cli-core;$repo\src\azure-cli-testsdk"
$env:AZURE_ACTIVE_BACKUP_LIVE = '0'
Remove-Item Env:\AZURE_TEST_RUN_LIVE -ErrorAction SilentlyContinue
.\env\Scripts\python.exe -m unittest `
    azure.cli.command_modules.appservice.tests.latest.test_active_backup_aaz `
    azure.cli.command_modules.appservice.tests.latest.test_active_backup_commands `
    azure.cli.command_modules.appservice.tests.latest.test_webapp_commands_thru_mock.TestWebappOutputTransformers `
    azure.cli.command_modules.appservice.tests.latest.test_webapp_commands_thru_mock.TestCreateAppServicePlanDefaults `
    azure.cli.command_modules.appservice.tests.latest.test_webapp_commands_thru_mock.TestUpdateWebapp `
    azure.cli.command_modules.appservice.tests.latest.test_webapp_commands_thru_mock.TestOneDeployTag -q

Coverage includes the 25-command inventory/help, modeled request routes and bodies, required primary-location parsing, root location/tags, standard updates/errors/polling, collection pagination, resource-ID guards and adjacent App Service regressions. Offline mocked transport does not establish deployed feature availability.

The broader module run was not fully green. With AZURE_TEST_RUN_LIVE unset and a developer-local pytest guard excluding live-only classes and blocking socket connections, this exact command reached 351 passed, 43 skipped, 201 subtests passed, then stopped on an unrelated existing Functions test:

.\env\Scripts\azdev.exe test appservice --series `
    --xml-path .x\active-backup\aaz-spike\prepush-offline-results.xml `
    --pytest-args -p offline_validation_guard -o cache_dir=.x\active-backup\pytest-cache

FunctionAppOnLinux.test_functionapp_on_linux_version_consumption fails because its recorded Python 3.10 runtime reached end-of-life on 2026-10-31 and the current runtime validator rejects it. The test and runtime-validation code are unchanged by this update; the failure was left unchanged rather than altering unrelated behavior or weakening assertions. The local guard/results are not committed assets, and this result is not a claim that the full suite passed.

Hosted checks for the new head are separate from these local results. The preserved bot-managed validation block above records an earlier head (c8c9e8b...); its 130/130 badge is not evidence for the current generated implementation.

History Notes

[App Service] az appservice plan silo, az webapp silo: Add preview spec-generated Active Backup silo lifecycle, refresh and networking commands.
[App Service] az webapp managed-traffic, az webapp last-known-good: Add preview regional traffic and Last Known Good management.


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

Add dedicated plan/site silo lifecycle, managed regional traffic, Last Known Good, accepted refresh, networking, and operational pass-through commands. Preserve service eligibility and API operation semantics. Include isolated ARM transport, offline coverage, opt-in live scenarios, and usage documentation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 224abf0a-0923-4347-a5ea-5c4a1b4e4824
@azure-pipelines

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

@microsoft-github-policy-service microsoft-github-policy-service Bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Oct 19, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Thank you for your contribution JarodAertsMsft! We will review the pull request and get back to you soon.

@yonzhan

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

Your Name and others added 4 commits October 20, 2026 09:49
Preserve no-wait receipts, return canonical resources after asynchronous writes, add the approved origin-only collection compatibility, and use async-status mode for standalone CRUD operation inspection and waits. Keep service errors visible and do not infer deletion success from polling 404.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 224abf0a-0923-4347-a5ea-5c4a1b4e4824
Add checkout-bound PowerShell Plan, Preflight, Run, Resume and Cleanup modes with explicit subscription/resource authorization, protected evidence, ownership-checked cleanup and offline safety tests. Cover Windows Core workflows while preserving known service polling failures in report history.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 224abf0a-0923-4347-a5ea-5c4a1b4e4824
Preserve silo regions despite configured location defaults, paginate actual ARM collections without flattening property bags, and clear completed mutation journal state regardless of validated output shape. Add parser/output/pagination and safe-resume regressions; keep backend errors and delete-404 policy unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 224abf0a-0923-4347-a5ea-5c4a1b4e4824
Normalize identity conflicts without private argparse APIs, preserve core HTTP error categories and retry behavior, expose named diagnostic inputs, and author complete help/examples. Protect recovery manifests with initialization/lock guards, ownership reconciliation and snapshot handoff validation. Keep strict delete polling errors; add regression coverage validated by 119 Python tests and 57 offline harness checks.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 224abf0a-0923-4347-a5ea-5c4a1b4e4824
@JarodAertsMsft

Copy link
Copy Markdown
Author

Hey Yong Zhang (@yonzhan), we need this payload for a feature we are announcing at ignite. Is it possible to get this reviewed before the cutoff?

@JarodAertsMsft

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Microsoft"


def load_arguments(self, _):
from ._active_backup_commands import load_arguments as load_active_backup_arguments
load_active_backup_arguments(self, _)

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.

Ensure commands and params are registered according to pre-existing conventions. Refer to https://github.com/Azure/azure-cli/blob/dev/doc/authoring_command_modules/authoring_commands.md for guidance or how existing commands and params are registered

from azure.cli.core.util import get_az_user_agent, get_error_type_by_status_code, should_disable_connection_verify


API_VERSION = '2026-08-01'

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.

This looks like a hand rolled client. Is there an sdk for this? Or a rest spec that we can code gen from? Refer to https://azure.github.io/aaz-dev-tools/pages/usage/cli-generator/

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

There is not yet an SDK and the swagger has not yet been published as the API has not yet been 100% deployed. But we have our PR into the swagger repo. I will look to use that to generate CLI and update PR with that. There might be some parts that will still require some somewhat special handling, but will see once I get things into a better state.

Azure/azure-rest-api-specs#44330

Thank you for the direction.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have scoped this PR down to the base commands that can be automatically generated from the Swagger with the cli generator along with some required custom handling for async and some mismatches in our swagger we need to fix.

Some of the content I had previously related to our passthrough APIs (which is where Silo resources can use same endpoints as normal web app resources but with their path), I have omitted for now.

I will continue to test and address comments on the PR, please let me know if the direction here is incorrect. This is my first time doing CLI work and really appreciate the help.

@JarodAertsMsft
JarodAertsMsft marked this pull request as ready for review October 21, 2026 03:28
Copilot AI balanced review requested due to automatic review settings October 21, 2026 03:28

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

File-backed live capture and binary request-file handling have unresolved data-integrity defects.

2 open issues
What changed in this PR

Adds preview Active Backup management to the App Service CLI without changing existing app/plan API versions.

Changes:

  • Adds silo lifecycle, traffic, networking, diagnostics, and operational commands.
  • Implements authenticated transport, operation polling, pagination, and file streaming.
  • Adds mock/live tests, usage documentation, and an opt-in validation harness.
File Description
src/​azure-cli/​azure/​cli/​command_modules/​appservice/​tests/​latest/​test_active_backup_commands.py Opt-in Windows/Linux lifecycle tests.
src/​azure-cli/​azure/​cli/​command_modules/​appservice/​tests/​latest/​test_active_backup_commands_thru_mock.py Command routing, help, and CLI regression tests.
src/​azure-cli/​azure/​cli/​command_modules/​appservice/​tests/​latest/​test_active_backup_client.py Transport, polling, and file-handling tests.
src/​azure-cli/​azure/​cli/​command_modules/​appservice/​commands.py Registers preview commands.
src/​azure-cli/​azure/​cli/​command_modules/​appservice/​active_backup.py Implements Active Backup handlers.
src/​azure-cli/​azure/​cli/​command_modules/​appservice/​_params.py Loads new arguments.
src/​azure-cli/​azure/​cli/​command_modules/​appservice/​_help.py Loads preview help.
src/​azure-cli/​azure/​cli/​command_modules/​appservice/​_active_backup_commands.py Defines commands, arguments, and examples.
src/​azure-cli/​azure/​cli/​command_modules/​appservice/​_active_backup_client.py Provides ARM transport and operation handling.
scripts/​appservice/​test_active_backup.ps1 Adds authorized validation and recovery entrypoint.
scripts/​appservice/​README.md Documents harness operation and safeguards.
doc/​active_backup_preview.md Documents preview usage and limitations.
.gitignore Excludes local validation artifacts.

Review effort: Balanced

Comment on lines +352 to +361
descriptor, temporary = tempfile.mkstemp(dir=os.path.dirname(destination))
with os.fdopen(descriptor, 'wb') as handle:
for chunk in response.iter_content(chunk_size=65536):
handle.write(chunk)
if overwrite:
os.replace(temporary, destination)
temporary = None
else:
os.link(temporary, destination)
return {'file': destination}
Comment on lines +489 to +492
elif isinstance(body, str) and body.startswith('@'):
try:
with open(body[1:], 'rb') as handle:
body = handle.read()
Replace the handwritten transport and signature-driven command dispatch with the spec-limited 24-command AAZ preview. Retain narrow generated-command subclasses for observed resource-envelope, polling, origin-read, VNet-response and conflict-format compatibility. Keep portable offline and gated scenario tests, and remove developer-only PowerShell validation tooling from the feature PR while preserving it locally. Companion model publication, replay recordings and full azdev gates remain review-readiness work.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 224abf0a-0923-4347-a5ea-5c4a1b4e4824
Regenerate the preview commands from the merged 2026-08-01 contract, remove backend compatibility overrides, require primary-location on silo creation, and update regressions and preview documentation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

@msarfraz mansoor sarfraz (msarfraz) added the Request X Engineering Agent Ask the agent to triage this issue or review this PR label Nov 5, 2026
@x-engineering-agent

x-engineering-agent Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

X Engineering Agent Pull request review: Comments

JarodAertsMsft Review of d3f1b046dc22: latest-index validation and durable AAZ-source ownership need correction. The new wait command also exposes an inherited false-success timeout; regression scenario coverage remains unverified.

Check Status Detail
Agent live tests Not run This is a review-only PR.
Regression coverage Unverified For appservice: 2 focused test file(s) changed.
Findings 3 high findings 3 high
Risk Risk 83/100 Critical Critical; owner review required

To address

Tick each item as you address it.

  • High Wait timeout reports success

    Details and fix

    src/azure-cli/azure/cli/command_modules/appservice/aaz/latest/webapp/silo/_wait.py:18 inherits AAZWaitCommand, which delegates to core/aaz/_command.py:276-282 and core/commands/command_operation.py:461. When provisioning never succeeds, the shared helper returns, rather than raises, CLIError; the invoker serializes it as {} with exit code 0. Automation can proceed after an unsuccessful wait. Raise the timeout exception in the shared helper. Add a CLI-invocation regression with repeated nonterminal GET responses and --created --timeout 1 --interval 1, asserting nonzero exit and the timeout diagnostic; preserve successful waits.

  • High Upstream CI

    Details and fix

    Azure.azure-cli

    • Result: failure
    • Included checks: Azure.azure-cli (Verify latest index assets)
    • Failure details:
      • Verify latest index assets / Verify generated latest indices (Uncertain)
        • Evidence: /mnt/vss/_work/1/s/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/network_watcher/packet_capture/_create.py:21: SyntaxWarning: "\C" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\C"? A raw string is also an option.
          az network network-watcher packet-capture create --network-watcher-name "NetworkWatcher_eastus2euap" --packet-capture-name "clitestpcap" --resource-group "NetworkWatcherRG" --storage-location '{"storageId": "/subscriptions//resourceGroups//providers/Microsoft.Storage/storageAccounts/", "filePath": "C:\Captures\testByCli.cap"}' --target "/subscriptions/*****/resourceGroups//providers/Microsoft.Compute/virtualMachines/testVmName"
          Generated latest index files are out of date:
    • src/azure-cli-core/azure/cli/core/helpIndex.latest.json
      Run either:
      azdev latest-index generate --cli .
      or:
      azdev latest-index generate
      Bash exited with code '1'.
      ##[section]Finishing: Verify generated latest indices
      • Next action: Address the first actionable diagnostic quoted from the task log; do not infer a source-code cause from the aggregate build status.
      • Verify: Re-run Verify latest index assets / Verify generated latest indices and confirm the quoted diagnostic is gone.

    Relevance: Azure.azure-cli and Azure.azure-cli (Verify latest index assets) are PR-related, representing the same failed task: “Generated latest index files are out of date”. The PR adds command/help assets without updating helpIndex.latest.json. Regenerate that index and rerun the named task/build. The quoted network escape warning is incidental, not the failure to repair.

  • High Generated code ownership checker

    Review shortened to stay concise; 3425 characters of detail were omitted.

Review details

Test validation

  • Agent live test: Not run; this is a review-only PR. Check author-provided test evidence and upstream CI separately.
  • Regression coverage: For appservice: 2 focused test file(s) changed. Scenario coverage is unverified; review the issue's required conditions, test setup, and assertions before approval. No linked issue was found in the PR timeline; inspect the source issue and its required scenario manually.

Recording-warning correction: The two deterministic recording warnings below are not applicable at this head: test_active_backup_aaz.py:107 derives from unittest.TestCase with mocked transport, while test_active_backup_commands.py:16-18 explicitly guards LiveScenarioTest. Neither requires playback YAML. No Agent live test ran.

Focused coverage: Both files are under src/azure-cli/azure/cli/command_modules/appservice/tests/latest/. Offline assertions cover request routes, root location/tags, explicit false, paging and async errors, but the wait test at test_active_backup_aaz.py:483-499 only covers eventual success/deletion, not timeout. Run that file with the timeout regression, then the authorized Windows/Linux live-only lifecycles with assertions for tags, traffic-mode and VNet read-back rather than request acceptance alone. Deployed scenario coverage is not verified.

Prior Copilot feedback: Both comments target _active_backup_client.py/active_backup.py, which are absent from this head; the log-tail and binary-proxy paths are no longer part of this implementation.

Risk assessment

83/100 · Critical

The Critical rating is driven by security-sensitive behavior, public CLI behavior, failure-handling behavior and 1 additional signal(s).

  • Change scope: 46 changed files, 8382 changed lines (+8380 / -2), including 41 production files.
  • Affected components: appservice
  • Risk drivers: security-sensitive behavior (+28); public CLI behavior (+18); failure-handling behavior (+12); generated output (+12)
  • Regression evidence: Changed regression tests are included, reducing risk.
  • Confidence: High because changed-line patches were available for every production file.
  • Required review: Owning-squad review is required for appservice before merge.

Ask the Agent

Tick a box to queue an action. Requires write access to this repository.

  • Re-review this PR
  • Run Agent live tests on this PR

X Engineering Agent · Reviewer · React with +1 or -1 to train the agent

@x-engineering-agent x-engineering-agent Bot added the X Engineering Agent Reviewed Agent reviewed this PR label Nov 5, 2026
@msarfraz

Copy link
Copy Markdown
Contributor

JarodAertsMsft
Please resolve Copilot and X Engineering bot suggestions and branch conflicts before cutoff date to include it in ignite.

@yonzhan

Copy link
Copy Markdown
Collaborator

There is still CI issue and this PR will be postponed to post Ignite.

This branch has not been deployed

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

Labels

act-observability-squad Auto-Assign Auto assign by bot Backup customer-reported Issues that are reported by GitHub users external to the Azure organization. Request X Engineering Agent Ask the agent to triage this issue or review this PR X Engineering Agent Reviewed Agent reviewed this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants