az functionapp deployment source config-zip to flex consumption function apps inconsistenly fails
Describe the bug
Please let me know (or remove/move this issue) if this is not the correct spot for this issue (I'm not sure if the behavior comes from az cli itself, or the kudu function host). We're currently moving from (linux) consumption apps to using flex consumption apps. While deploying our app source (C#) to our function apps with az cli, we're seeing inconsistent failures, reporting deployment was partially succesful, but with no clear failure in the included logs in command line.
Function app itself (in Azure) shows the deployment in a failed state in deployment center with Message like '[KuduSpecializer] Kudu has been restarted after package deployed for deployment 034b9835-723a-4c45-a879-a921f13df306. Kudu Restart Count: 1.'. While I couldn't find much information on this, the single resource I found (at https://learn.microsoft.com/en-us/answers/questions/5818081/azure-function-deployment) implies that the message is a transient restart state, and polling proces should wait longer before polling again.
Is it possible the cli is getting back this reply and ending/cancelling the deployment process at that point, or is the failure intended behavior (and possibly unrelated to above message)?
Related command
az functionapp deployment source config-zip -g $ResourceGroupName
-n $FunctionAppName --src $PackagePath
--debug
Errors
In CLI: ERROR: Deployment was partially successful. These are the deployment logs: [{"log_time": "2026-04-14T13:48:01.034239Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "Starting deployment pipeline.", "type": 0}, {"log_time": "2026-04-14T13:48:01.0345968Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-SourcePackageUriDownloadStep] Skipping download. Zip package is present at /tmp/zipdeploy/034b9835-723a-4c45-a879-a921f13df306.zip", "type": 0}, {"log_time": "2026-04-14T13:48:01.0347716Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-ValidationStep] starting.", "type": 0}, {"log_time": "2026-04-14T13:48:01.0477203Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-ValidationStep] completed.", "type": 0}, {"log_time": "2026-04-14T13:48:01.0480149Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-ExtractZipStep] starting.", "type": 0}, {"log_time": "2026-04-14T13:48:01.1456618Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-ExtractZipStep] completed.", "type": 0}, {"log_time": "2026-04-14T13:48:01.1459906Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-ContentValidationStep] starting.", "type": 0}, {"log_time": "2026-04-14T13:48:01.1462036Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-ContentValidationStep] completed.", "type": 0}, {"log_time": "2026-04-14T13:48:01.1463926Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-PreBuildValidationStep] Skipping pre-build validation (remotebuild = false).", "type": 0}, {"log_time": "2026-04-14T13:48:01.1465806Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-OryxBuildStep] Skipping oryx build (remotebuild = false).", "type": 0}, {"log_time": "2026-04-14T13:48:01.1467617Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-PostBuildValidationStep] starting.", "type": 0}, {"log_time": "2026-04-14T13:48:01.1469602Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-PostBuildValidationStep] completed.", "type": 0}, {"log_time": "2026-04-14T13:48:01.1471881Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-PackageZipStep] starting.", "type": 0}, {"log_time": "2026-04-14T13:48:01.677484Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-PackageZipStep] completed.", "type": 0}, {"log_time": "2026-04-14T13:48:01.6780361Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-UploadPackageStep] starting.", "type": 0}, {"log_time": "2026-04-14T13:48:01.9159076Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-UploadPackageStep] completed. Uploaded package to storage successfully.", "type": 0}, {"log_time": "2026-04-14T13:48:02.0999034Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-RemoveWorkersStep] starting.", "type": 0}, {"log_time": "2026-04-14T13:48:02.1552036Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-RemoveWorkersStep] completed.", "type": 0}, {"log_time": "2026-04-14T13:48:02.1555245Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-SyncTriggerStep] starting.", "type": 0}]
In Function deployment center:
[KuduSpecializer] Kudu has been restarted after package deployed for deployment 034b9835-723a-4c45-a879-a921f13df306. Kudu Restart Count: 1.
Issue script & Debug output
Logs from azure task with debug flag passed to command
WARNING: Getting scm site credentials for zip deployment WARNING: Starting zip deployment. This operation can take a while to complete ... WARNING: Deployment endpoint responded with status code 202 for deployment id "034b9835-723a-4c45-a879-a921f13df306" ERROR: Deployment was partially successful. These are the deployment logs: [{"log_time": "2026-04-14T13:48:01.034239Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "Starting deployment pipeline.", "type": 0}, {"log_time": "2026-04-14T13:48:01.0345968Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-SourcePackageUriDownloadStep] Skipping download. Zip package is present at /tmp/zipdeploy/034b9835-723a-4c45-a879-a921f13df306.zip", "type": 0}, {"log_time": "2026-04-14T13:48:01.0347716Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-ValidationStep] starting.", "type": 0}, {"log_time": "2026-04-14T13:48:01.0477203Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-ValidationStep] completed.", "type": 0}, {"log_time": "2026-04-14T13:48:01.0480149Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-ExtractZipStep] starting.", "type": 0}, {"log_time": "2026-04-14T13:48:01.1456618Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-ExtractZipStep] completed.", "type": 0}, {"log_time": "2026-04-14T13:48:01.1459906Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-ContentValidationStep] starting.", "type": 0}, {"log_time": "2026-04-14T13:48:01.1462036Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-ContentValidationStep] completed.", "type": 0}, {"log_time": "2026-04-14T13:48:01.1463926Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-PreBuildValidationStep] Skipping pre-build validation (remotebuild = false).", "type": 0}, {"log_time": "2026-04-14T13:48:01.1465806Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-OryxBuildStep] Skipping oryx build (remotebuild = false).", "type": 0}, {"log_time": "2026-04-14T13:48:01.1467617Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-PostBuildValidationStep] starting.", "type": 0}, {"log_time": "2026-04-14T13:48:01.1469602Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-PostBuildValidationStep] completed.", "type": 0}, {"log_time": "2026-04-14T13:48:01.1471881Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-PackageZipStep] starting.", "type": 0}, {"log_time": "2026-04-14T13:48:01.677484Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-PackageZipStep] completed.", "type": 0}, {"log_time": "2026-04-14T13:48:01.6780361Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-UploadPackageStep] starting.", "type": 0}, {"log_time": "2026-04-14T13:48:01.9159076Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-UploadPackageStep] completed. Uploaded package to storage successfully.", "type": 0}, {"log_time": "2026-04-14T13:48:02.0999034Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-RemoveWorkersStep] starting.", "type": 0}, {"log_time": "2026-04-14T13:48:02.1552036Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-RemoveWorkersStep] completed.", "type": 0}, {"log_time": "2026-04-14T13:48:02.1555245Z", "id": "034b9835-723a-4c45-a879-a921f13df306", "message": "[Kudu-SyncTriggerStep] starting.", "type": 0}]
Expected behavior
From the earlier linked QA I think the az cli might have to wait for the restart to finish before polling status again (instead of failing deployment).
Environment Summary
{ "azure-cli": "2.85.0", "azure-cli-core": "2.85.0", "azure-cli-telemetry": "1.1.0", "extensions": { "azure-devops": "1.0.2" } }
(Run from AzureCli@2 task in Azure DevOps)
Additional context
No response
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @kamperiadis, @amamounelsayed, @khkh-ms, @act-observability-squad.
Thank you for opening this issue, we will look into it.
:bell: Routing this issue to @act-observability-squad.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @kamperiadis, @amamounelsayed, @khkh-ms, @act-observability-squad.
🤖 This comment was posted automatically by the Agent Assist pipeline.
🔍 Fixer Analysis — Issue #33184
Module: azure-cli → appservice / functionapp
Command: az functionapp deployment source config-zip
Root Cause (suspected)
When deploying to Flex Consumption function apps, Kudu performs a restart after the package is deployed. The CLI polls the deployment status endpoint, but receives a transient [KuduSpecializer] Kudu has been restarted... state and interprets this as a failure ("Deployment was partially successful"). The fix likely requires:
- Treating a Kudu-restart event as transient (not terminal) during polling.
- Continuing to poll after the restart completes before reporting final status.
Affected file(s) (likely)
src/azure-cli/azure/cli/command_modules/appservice/custom.py— zip-deploy polling logicsrc/azure-cli/azure/cli/command_modules/appservice/_utils.py— deployment status helpers
Suggested fix direction
In the deployment polling loop, detect [KuduSpecializer] Kudu has been restarted messages and treat them as a retry signal rather than a failure. Wait for the next poll cycle to see if deployment ultimately completes successfully.
Assigning @Copilot to produce a fix. 🚀
Routed to Azure/azure-cli-extensions as #9992 (https://github.com/Azure/azure-cli-extensions/issues/9992) because this targets the functionapp extension, whose source lives in Azure/azure-cli-extensions.
Posted by agent-assist (autonomous bug-fix pipeline).