Skip to content

[App Service] az functionapp flex-migration start: Reuse the source app's existing storage access when no storage account is specified - #34525

Open
Vishal Gupta (vishal1997) wants to merge 3 commits into
Azure:devfrom
vishal1997:flex-migration-preserve-storage-config

Conversation

@vishal1997

@vishal1997 Vishal Gupta (vishal1997) commented Dec 3, 2026 •

Copy link
Copy Markdown

🤖 PR Validation — ️✔️ All clear

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

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.

Vishal Gupta and others added 2 commits December 3, 2026 12:56
When no storage account is named, migration reuses the storage access the source app already has: its AzureWebJobsStorage connection string, or the managed identity it uses for host storage after confirming that identity's blob data role assignment. New access (account keys, role assignments, deployment containers) is set up only for storage accounts named with --storage-account or --deployment-storage-name.

Side-by-side migration now passes the --deployment-storage-* arguments to app creation. Storage settings that reference different accounts stop the command, deployment storage authentication options require a named account, and role assignment conditions are preserved when identity role assignments are copied.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…r message

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 3, 2026 09:03
@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 Dec 3, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Thank you for your contribution Vishal Gupta (@vishal1997)! We will review the pull request and get back to you soon.

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

Migration can overwrite target deployment-storage credentials and continue after required identity-role transfer failures, potentially reporting success when the target cannot access its configured storage.

4 open issues
What changed in this PR

Updates App Service Flex migration to reuse the source app’s storage credentials or managed-identity access when no storage account is specified.

Changes:

  • Adds storage-access validation and credential-based container setup.
  • Updates argument help and preserves conditions when copying role assignments.
  • Expands mocked coverage and configures storage access in live identity-migration tests.
File Description
src/​azure-cli/​azure/​cli/​command_modules/​appservice/​tests/​latest/​test_functionapp_commands.py Grants source identities blob access for live tests.
src/​azure-cli/​azure/​cli/​command_modules/​appservice/​tests/​latest/​test_functionapp_commands_thru_mock.py Tests storage reuse, validation, and settings preservation.
src/​azure-cli/​azure/​cli/​command_modules/​appservice/​custom.py Implements storage-access reuse and migration integration.
src/​azure-cli/​azure/​cli/​command_modules/​appservice/​_params.py Clarifies storage options and hides internal arguments.
src/​azure-cli/​azure/​cli/​command_modules/​appservice/​_constants.py Adds the Storage Blob Data Owner role identifier.

Review effort: Balanced

'deployment_storage_auth_type': plan['deployment_storage_auth_type'],
'deployment_storage_auth_value': plan['deployment_storage_auth_value'],
'deployment_container_connection_string': plan['container_connection_string'],
'allow_deployment_storage_role_assignment': False
Comment on lines +1578 to +1579
_migrate_app_settings(cmd, source_resource_group, source_name, resource_group, name, storage_account,
host_storage_reused=True)
def _find_storage_account_id(cmd, account_name, resource_group_name):
"""Look up a storage account's resource ID for validation only. Nothing is provisioned on the result."""
from azure.cli.command_modules.storage.operations.account import list_storage_accounts
for accounts in (list_storage_accounts(cmd, resource_group_name), list_storage_accounts(cmd)):
deployment_storage_auth_value in existing_settings_dict:
# Validating an existing container needs only read access, so it's checked through the management plane.
# Deployment storage reuses the app's existing connection string setting, so no keys are read.
container_connection_string = None
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

Look up storage accounts in the resource group before listing the subscription, resolve the account ID when an existing deployment container is validated in place, keep the target app's deployment storage connection string setting when app settings are copied, and check that the target app's system-assigned identity can access deployment storage after role assignments are migrated.

Co-authored-by: Copilot <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).

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-codegen-extensibility-squad act-observability-squad customer-reported Issues that are reported by GitHub users external to the Azure organization. Functions az functionapp Storage az storage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants