Azure / Azure/azure-cli-extensions

[functionapp] az functionapp deployment source config-zip to flex consumption function apps inconsistenly fails

Open
#9,992 2 comments 1 reaction 2 assignees Claimed by @a0x1ab View on GitHub
Auto-Assign Functions Service Attention
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

Source: https://github.com/Azure/azure-cli/issues/33184 (by @tekking)
Affected extension: `functionapp` (`src/functionapp/`)

---

<<>>
# Issue #33184 (by @tekking)
## Title
az functionapp deployment source config-zip to flex consumption function apps inconsistenly fails

## Body
### 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:
Image
[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
... [truncated, original was 8856 chars]

## Comments
### Comment by @microsoft-github-policy-service[bot]
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @kamperiadis, @amamounelsayed, @khkh-ms, @act-observability-squad.

### Comment by @yonzhan

Thank you for opening this issue, we will look into it.

### Comment by @microsoft-github-policy-service[bot]
:bell: Routing this issue to @act-observability-squad.

### Comment by @microsoft-github-policy-service[bot]
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @kamperiadis, @amamounelsayed, @khkh-ms, @act-observability-squad.

### Comment by @a0x1ab
> 🤖 *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:

1. Treating a Kudu-restart event as transient (not terminal) during polling.
2. 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 logic
- `src/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. 🚀

<<>>

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.