Repository navigation
[App Service] az functionapp create, az functionapp deployment config set: Add Flex Consumption Registry deployment storage support - #34147
Conversation
…fig set`: Add Flex Consumption Registry deployment storage support Add --deployment-image, --deployment-image-auth-type, --deployment-image-identity, --deployment-image-username-setting, --deployment-image-password-setting and --deployment-image-server-url so Flex Consumption apps can run a container image from functionAppConfig.deployment.storage of type Registry (Microsoft.Web 2025-05-01). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
…g show`: Return Flex Registry configuration with API version 2025-05-01 - Re-read Flex apps that use Registry deployment storage at 2025-05-01 so both show commands return the persisted Registry configuration. Blob storage apps keep their existing request and output. - Tests: show round-trips for both show commands, a rejected update followed by show, secret-safe set/show output, and legacy container markers never set on create. The live scenario covers the same flows end to end. - Help: describe what deployment config show returns for Registry storage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
… updates Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
A post-create identity update can erase Basic Registry authentication fields by rewriting the site through an older API.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Adds Flex Consumption Registry deployment storage support to App Service commands.
Changes:
- Adds Registry image/authentication arguments and validation.
- Uses API
2025-05-01while preserving Registry configuration. - Adds help, mocked tests, and a live scenario.
| File | Description |
|---|---|
utils.py |
Supports explicit API versions for raw reads. |
custom.py |
Implements Registry create, update, show, and preservation logic. |
_params.py |
Registers Registry deployment arguments. |
_help.py |
Documents Registry workflows and examples. |
_constants.py |
Defines auth modes, API version, and defaults. |
test_functionapp_commands.py |
Adds live Registry coverage. |
test_functionapp_commands_thru_mock.py |
Adds request, validation, and preservation tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
/azp run |
…tity changes Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
list_flexconsumption_locations and list_flexconsumption_zone_redundant_locations normalized geo region display names by lowercasing and removing spaces only, so "North Central US (Stage)" became "northcentralus(stage)" and never matched the subscription location "northcentralusstage". `az functionapp create --flexconsumption-location northcentralusstage` therefore failed with "Location is invalid" before creating any resources. Reuse _normalize_flex_location in both functions and make it also strip parentheses. ARM location names never contain parentheses, so existing matches are unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0eb1467a-223a-47a0-a810-3e7250c19520 Co-authored-by: Dobby <dobby@microsoft.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
The previous commit made stage regions pass the CLI location check as "northcentralusstage", but App Service only recognizes stage regions by their geo region name: creating the plan failed with "Cannot find GeoRegion with name northcentralusstage." App Service accepts "northcentralus(stage)". Keep the existing normalization and ignore parentheses only when matching subscription locations. `az functionapp list-flexconsumption-locations` now lists "northcentralus(stage)", and `az functionapp create --flexconsumption-location "northcentralus(stage)"` sends that name to App Service. Non-stage regions are unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0eb1467a-223a-47a0-a810-3e7250c19520 Co-authored-by: Dobby <dobby@microsoft.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Registry deployment storage has no runtime, so functionAppConfig.runtime is null. _get_functionapp_runtime_info read it as a dict, so `az functionapp config appsettings set` and `az functionapp config set` failed with AttributeError before sending the update. Treat a missing runtime as not detected, as for other apps, so the runtime check is skipped. Found while validating Registry apps in North Central US (Stage). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0eb1467a-223a-47a0-a810-3e7250c19520 Co-authored-by: Dobby <dobby@microsoft.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
North Central US Stage validationI tested this PR against North Central US (Stage) using a non-production test subscription. The full report below is a public-safe version of the live validation record; subscription/resource identifiers and internal telemetry details were removed. View the full sanitized North Central US Stage validation reportFlex Consumption Registry: North Central US Stage validation reportAzure CLI PR: Azure/azure-cli#34147 OutcomeThe Azure CLI changes successfully validated Flex Consumption Registry deployment-storage configuration in North Central US Stage. The live test covered:
HTTP invocation could not be completed because the downstream stage platform did not yet support Registry-backed worker creation and assignment. This is a platform rollout dependency rather than an Azure CLI validation failure. Result summary
The detailed live matrix contained 54 report rows:
Changes verified in the PRStage-region normalization:
|
| Scenario | Expected | Actual |
|---|---|---|
| List Flex stage locations | App Service stage names are returned | Passed |
| Anonymous Registry create | Runtime is null; storage type is Registry; auth type is Anonymous | Passed |
| Basic Registry create | Setting names are stored without embedding credentials in deployment config | Passed |
| User-assigned identity configuration | UAI resource ID is stored in Registry authentication | Passed; attaching identity was unavailable in stage |
| System-assigned identity configuration | SystemAssignedIdentity auth type is stored | Passed; attaching identity was unavailable in stage |
| Deployment config show | Returns Registry image and authentication | Passed |
| Image tag update | New tag stored; authentication preserved | Passed |
| Image digest update | Digest reference stored; authentication preserved | Passed |
| Anonymous to Basic | Image preserved; Basic setting names added | Passed |
| Basic to UAI | Image preserved; Basic fields cleared; UAI ID added | Passed |
| UAI to system identity | Image preserved; UAI field cleared | Passed |
| System identity to Anonymous | Image preserved; identity fields cleared | Passed |
| Blank image update | Service rejects empty Registry image | Passed |
| Blob-only flags on Registry app | CLI rejects flags with actionable message | Passed |
| Runtime update on Registry app | CLI rejects because Registry storage has no language runtime | Passed |
| Scale update | Scale changes; Registry configuration remains unchanged | Passed |
| Blob-to-Registry update without auth | CLI rejects incomplete argument pair | Passed |
| Blob-to-Registry update with Anonymous auth | Runtime becomes null; storage changes to Registry | Passed |
| App settings update on Registry app | No null-runtime crash; Registry config preserved | Passed after fix |
| General site configuration update | No null-runtime crash; Registry config preserved | Passed after fix |
| Runtime plus image on create | CLI rejects before a write | Passed |
| Image without auth type | CLI rejects before a write | Passed |
| Basic without setting names | CLI rejects before a write | Passed |
| UAI auth without identity | CLI rejects before a write | Passed |
| Identity argument with non-UAI auth | CLI rejects before a write | Passed |
| Registry flags with classic Consumption | CLI rejects before a write | Passed |
| HTTP invocation | Worker pulls and starts Registry image | Blocked by downstream stage rollout |
Representative commands
Resource names are replaced with variables.
Create an Anonymous Registry app
azpr functionapp create `
--resource-group $ResourceGroup `
--name $FunctionApp `
--storage-account $StorageAccount `
--flexconsumption-location 'northcentralus(stage)' `
--deployment-image 'mcr.microsoft.com/azure-functions/dotnet8-quickstart-demo:1.0' `
--deployment-image-auth-type Anonymous `
--disable-app-insights `
--query '{name:name,location:location,runtime:properties.functionAppConfig.runtime,storage:properties.functionAppConfig.deployment.storage}' `
--output jsonRead deployment configuration
azpr functionapp deployment config show `
--resource-group $ResourceGroup `
--name $FunctionApp `
--output jsonVerify null-runtime app-settings behavior
azpr functionapp config appsettings set `
--resource-group $ResourceGroup `
--name $FunctionApp `
--settings FXR_PROBE=1 `
--query "[?name=='FXR_PROBE'].name" `
--output jsonVerify client-side validation
azpr functionapp create `
--resource-group $ResourceGroup `
--name $NegativeApp `
--storage-account $StorageAccount `
--flexconsumption-location 'northcentralus(stage)' `
--runtime python `
--runtime-version 3.11 `
--deployment-image 'mcr.microsoft.com/azure-functions/dotnet8-quickstart-demo:1.0' `
--deployment-image-auth-type AnonymousExpected: --deployment-image cannot be used with --runtime..., with no site created.
Automated validation
The appservice mocked command test file completed with 70/70 tests passing after the two fixes. This includes regression coverage for:
- Matching stage location names while preserving the App Service name sent to the service
- Updating app settings when a Registry app returns a null runtime
The final portable Windows artifact was also checked for the new create/update arguments and Azure CLI startup behavior.
Compatibility and rollout
The CLI changes are compatible with regions where Registry deployment storage is not enabled: the CLI sends the new payload, and the service returns its regional feature-gate response.
Mixed-version behavior observed during testing:
- The CLI and App Service configuration path can accept and store Registry deployment configuration.
- Worker creation and assignment require the corresponding downstream platform rollout.
- Until that rollout completes, configuration operations can pass while HTTP invocation remains unavailable.
No CLI rollback is required for that platform condition. The regional service feature can remain disabled or be rolled back independently until downstream components are ready.
Remaining validation
After the downstream platform rollout reaches a test region, rerun:
- Anonymous, Basic, UAI, and system-identity create
- Registry configuration readback
- Image pull
- Worker assignment
- HTTP invocation
- Authentication transitions followed by invocation
The CLI configuration and validation portions are covered by the live and automated results above.
Highlights:
- Ran a 54-row live scenario matrix covering Registry create/read/update, Anonymous and Basic authentication, identity configuration shapes, tag/digest updates, authentication transitions, Blob-to-Registry conversion, scale/config preservation, and client-side validation.
- Confirmed the stage-location fix in
416923fff. - Reproduced and fixed the null-runtime appsettings/config crash in
4bf37ec7b. - Ran the complete appservice mocked command test file after the fixes: 70/70 passed.
- Registry configuration operations passed in stage. HTTP invocation remained blocked by a downstream stage rollout dependency, not by CLI argument handling.
Please review the scenario matrix, compatibility notes, and remaining end-to-end validation items included below.
|
pragatikushwaha Please fix the CI issues |
|
🔔 Routing this PR to @Azure/act-observability-squad. |
|
🔔 Routing this PR to @Azure/act-codegen-extensibility-squad. |
There was a problem hiding this comment.
Review
The observed style failures are not PR-related: their task logs name unchanged ACS and SQL files, while this change is confined to App Service. No source change is requested for those failures; rerun or escalate the failing style workflows. No evidence-confirmed code or deterministic review-tool findings were identified on this head. This is not a merge approval.
Upstream CI
azdev-style
- Result: failure
- Relevance: Uncertain
- Evidence: The check completed without a concise diagnostic.
- Suggested fix: Open the linked log and confirm whether the first actionable error touches the PR diff before changing code.
- Verify: Re-run
azdev-styleand confirm it passes on the new head.
Azure.azure-cli
- Result: failure
- Included checks:
Azure.azure-cli (Check CLI Style) - Failure details:
- Check CLI Style / Bash (Uncertain)
- Evidence: src/azure-cli/azure/cli/command_modules/acs/custom.py:2946:11: W0718: Catching too general exception Exception (broad-exception-caught)
src/azure-cli/azure/cli/command_modules/acs/custom.py:2964:11: W0718: Catching too general exception Exception (broad-exception-caught)
************* Module azure.cli.command_modules.acs.azurecontainerstorage._validators
src/azure-cli/azure/cli/command_modules/acs/azurecontainerstorage/_validators.py:361:19: R0916: Too many boolean expressions in if statement (6/5) (too-many-boolean-expressions)
- Evidence: src/azure-cli/azure/cli/command_modules/acs/custom.py:2946:11: W0718: Catching too general exception Exception (broad-exception-caught)
- Check CLI Style / Bash (Uncertain)
Your code has been rated at 10.00/10
ERROR: Pylint: FAILED
Running flake8 on modules...
Flake8: PASSED
- 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 Check CLI Style / Bash and confirm the quoted diagnostic is gone.
Evidence-based classification: Both azdev-style and Azure DevOps Check CLI Style / Bash are not PR-related. The initial diagnostic formatter marks relevance uncertain; the retrieved task log resolves that uncertainty. Run Azdev Style reports acs/custom.py:1087,2946,2964: W0718, acs/azurecontainerstorage/_validators.py:361: R0916, and sql/custom.py:1779: W0613, followed by ERROR: Pylint: FAILED, Flake8: PASSED, and exit code 12. None of those paths is changed here. The Azure DevOps task likewise quotes the ACS diagnostics above. Rerun both style validations against the current base or escalate these unrelated module diagnostics to their owners; do not alter App Service code merely to clear aggregate failures.
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. Changed tests invokeaz functionapp create, but invocation alone does not verify the required scenario or output. No linked issue was found in the PR timeline; inspect the source issue and its required scenario manually.
The changed src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1772-1842 scenario asserts Registry create/config set/show and functionapp output. The focused mocks in tests/latest/test_appservice_utils.py exercise request payloads, API versions, partial updates, rejected inputs and preserved configuration. These are stronger than command invocation alone, but synthetic image digests do not establish a working live Registry deployment. No author-provided execution result was found in the PR description. The scenario is a LiveScenarioTest; no changed recording is not itself a defect. Before human approval, verify the service-shaped scenario's setup/output assertions and obtain focused execution evidence for Registry storage and compatibility with Blob storage. The author can run azdev test test_functionapp_commands.FunctionAppFlexConsumptionRegistryStorageTest --live and the focused test_appservice_utils tests through the repository's normal test workflow. This review did not dispatch or run Agent live tests.
Risk assessment
60/100 · High · High confidence
The High rating is driven by security-sensitive behavior, public CLI behavior, failure-handling behavior.
- Change scope: 7 changed files, 990 changed lines (
+951/-39), including 5 production files. - Affected components:
appservice - Risk drivers: security-sensitive behavior (+28); public CLI behavior (+18); failure-handling behavior (+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
appservicebefore merge.
Posted by x-engineering-agent (Reviewer)
|
🔔 Routing this PR to @Azure/act-observability-squad. |
|
🔔 Routing this PR to @Azure/act-codegen-extensibility-squad. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0eb1467a-223a-47a0-a810-3e7250c19520
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
X Engineering Agent ReportReview — CommentsReviewUpstream CI completed successfully for
Before merge, run and record the focused Registry scenario against the current head with a real resolvable image. Verify create/show and Blob-to-Registry transition, auth-mode changes, identity assign/remove, and scale/always-ready/update-strategy updates retain the image and setting-name references. Assert service acceptance and returned configuration through the actual API versions; add image-pull/runtime evidence if deployment success is claimed. Rerun the existing Blob scenario alongside it to protect compatibility. Test validation
Risk assessment60/100 · High · High confidence The High rating is driven by security-sensitive behavior, public CLI behavior, failure-handling behavior.
Posted by x-engineering-agent (Reviewer) Live test — FailedFAIL (exit 1) Selectors: Changed test files runWorkflow run: https://github.com/Azure/issue-sentinel/actions/runs/38658791926 Last 80 lines of azdev outputPosted by x-engineering-agent (Tester) |
|
🔔 Routing this PR to @Azure/act-observability-squad. |
|
🔔 Routing this PR to @Azure/act-codegen-extensibility-squad. |


🤖 PR Validation —⚠️ Review suggested
Related command
az functionapp createaz functionapp deployment config setaz functionapp deployment config showaz functionapp showDescription
Flex Consumption apps can run a container image by setting
functionAppConfig.deployment.storage.typetoRegistry(Microsoft.Web API version2025-05-01). This PR adds CLI support for configuring it.New arguments, in a
Flex Registry Deploymentargument group onaz functionapp createandaz functionapp deployment config set:--deployment-image--deployment-image-auth-type--diatAnonymous,SystemAssignedIdentity,UserAssignedIdentity, orBasic.--deployment-image-identity--diiUserAssignedIdentityonly.--deployment-image-username-setting--diusBasiconly.--deployment-image-password-setting--dipsBasiconly.Behavior:
Basictakes username and password app-setting names; the CLI never accepts a registry password and never reads app settings.--deployment-image-server-url/--diurl. A newly constructedBasicauthentication object contains onlytype,usernameSettingName, andpasswordSettingName(noserverUrl). A site that already has a service-setserverUrlmay still show it and preserve it when authentication is not replaced; explicitly replacing authentication writes only the supplied mode's fields. This narrows the CLI from the current ADO task/GitHub Add missing pyyaml dependency in setup.py #86/Provide TSV (tab separated values) output formatter #88 optional-field criterion, without changing the Microsoft.Web API schema; owner confirmation and task-criterion alignment are pending.az functionapp create --deployment-image ...builds a RegistryfunctionAppConfigwithout a runtime and explicitly sendssiteUpdateStrategy.type = Recreate, matching the service default.--runtime,--runtime-version,--environment,--deployment-storage-*, and the legacy--registry-*arguments are rejected.--maximum-instance-countdefaults to 1000 for Registry creates (per review request, with owner sign-off still needed), and--instance-memorydefaults to 2048 MB; existing Blob create defaults are unchanged.--always-ready-instancesis supported, and Application Insights is created unless--disable-app-insightsis set. Registry image configuration does not automatically assign identities or grant registry access; use--assign-identity,--role AcrPull, and--scopefor that.az functionapp deployment config set --deployment-image ...reads the site at2025-05-01, updates onlydeployment.storage, removesfunctionAppConfig.runtime, and writes the site back with a single PUT at2025-05-01, so other properties are preserved. Switching from blob storage requires both the image and the authentication type; on an app that already uses Registry storage, either can be updated alone only when the retained counterpart is non-empty. The merged configuration must contain a non-empty image and authentication type before any PUT; supplying valid values can repair missing stored configuration. Blob and Registry arguments can't be combined, and blob arguments are rejected on Registry apps.az functionapp showandaz functionapp deployment config showuse their existing raw2023-12-01reads, without a Registry-specific second GET. The full returned JSON preserves Registry authentication and unknown fields without older-schema projection.show_functionappmatches the baseline implementation exactly; non-Flex apps and slots retain their existing SDK/configuration/publishing-information path. Credential values are never retrieved;Basicshows only the app setting names.2023-12-01GET, remove response-only null fields/runtime for Registry, and PUT Registry configuration at2025-05-01. Blob apps keep their original GET/PUT requests at2023-12-01.az functionapp runtime config setrejects Registry apps because they have no runtime. The explicit newer API remains on new Registry deployment writes to honor the published contract; redundant read/identity version switching has been removed.az functionapp identity assignandaz functionapp identity removeuse normal SDK API selection, without Registry-specific GET/PUT overrides, and preserve Basic authentication setting names and unknown configuration. The unused runtime and other modes' null fields are still omitted in the identity PUT. Real-SDK transport tests cover default-version requests for Registry Basic, Blob, and non-Flex apps; Blob and non-Flex requests remain unchanged.az functionapp config container) are unchanged.Testing Guide
Tests:
test_functionapp_commands_thru_mock.py:TestFlexRegistryDeploymentConfigMocked,TestFlexRegistryIdentityMocked,TestFlexRegistryCreateMocked, andTestFlexRegistryArgumentParsingcover exact request payloads and API versions for every authentication mode and image form, set/show round-trips through both show commands (blob requests unchanged), partial updates, missing/null/empty merged image/authentication rejection without writing, repair of invalid stored configuration, non-Flex app/slot routing, rejection of invalid arguments without writing, a service rejection followed by a show that returns the previous configuration, absence of secrets in debug logs and in set/show output, preservation of Registry authentication across scale/always-ready/update-strategy and real-SDK identity assign/remove writes with Blob HTTP requests unchanged, runtime-set rejection, create conflicts and defaults, legacy container markers never set on create (containerkind,linuxFxVersion,DOCKER_*settings), and argument aliases, including rejection of both removed server URL flags.test_functionapp_commands.py: live scenariotest_functionapp_flex_registry_deployment(FunctionAppFlexis aLiveScenarioTest) covers create, both show commands, identity andBasicupdates, digest and tag-plus-digest images, and a rejected update followed by show.Review and rollout
serverUrl. The complete mocked command test file passes against the actual CLI 2.91 source (68 tests, 58 subtests); full App Service pylint/PEP8 and the command/help linter with CI exclusions pass. Changed Python compilation, help YAML parsing, baseline show-implementation comparison, and whitespace checks also pass. Full remote CI and live Registry E2E are separate release gates. On this head, the repo-wide style jobs fail on the same pre-existing ACS, SQL, and CLI-core diagnostics seen on the prior head, with no App Service style diagnostics; live E2E has not run on this head and requires a Registry-enabled region and the published2025-05-01contract.History Notes
[App Service]
az functionapp create: Add--deployment-imageand related arguments to create Flex Consumption apps that run a container image[App Service]
az functionapp deployment config set: Add--deployment-imageand related arguments to configure container image deployment for Flex Consumption apps[App Service]
az functionapp show,az functionapp deployment config show: Return the container image deployment configuration of Flex Consumption apps[App Service]
az functionapp scale config set,az functionapp scale config always-ready set,az functionapp scale config always-ready delete,az functionapp update-strategy config set: Preserve Registry authentication in Flex configuration updates[App Service]
az functionapp identity assign,az functionapp identity remove: Preserve Registry authentication through identity changes[App Service]
az functionapp runtime config set: Explain that Registry-based Flex apps have no runtime to updateThis 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.