Source: Azure/azure-cli#32655 (by Jonas Kamsker (@JKamsker))
Affected extension: functionapp (src/functionapp/)
<<UNTRUSTED:issue-32655>>
Title
az functionapp deploy crashes (JSONDecodeError) because OneDeploy responses contain JSON + appended HTML (Flex Consumption). Also blocks with RunFromExternalUrlException when WEBSITE_RUN_FROM_PACKAGE is set.
Body
Describe the bug
az functionapp deploy (preview) crashes with an unhandled JSON parsing exception when deploying a zip package to a Linux Azure Function App on Flex Consumption.
The underlying deploy request is accepted (202) and returns JSON that includes a deployment id, but the response body appears to contain valid JSON followed by an appended HTML “Server Error in '/' Application” page. This causes Azure CLI to throw JSONDecodeError: Extra data and exit unexpectedly.
In the same scenario, querying the deployment record shows the deployment fails with:
RunFromExternalUrlException: The app setting WEBSITE_RUN_FROM_PACKAGE is set to a remote URL. Therefore, Deployment is not needed... set WEBSITE_RUN_FROM_PACKAGE ... and manually call synctriggers.
Even if this configuration is expected to block zip deployment, the CLI should not crash because the response contains mixed content (JSON + HTML). Instead it should surface the service error cleanly.
This looks related to existing reports about JSON responses having HTML appended (for Flex Consumption deployments), e.g. azure-cli #32443 and #30960.
Related command
PowerShell:
'''
az functionapp deploy -g -n --type zip
--src-url "" `
--verbose
'''
Deployment status query that also returns JSON + appended HTML:
'''
$sub=""
$rg=""
$app=""
$dep=""
az rest --method get --url "https://management.azure.com/subscriptions/$sub/resourceGroups/$rg/providers/Microsoft.Web/sites/$app/deployments/$dep"
--url-parameters api-version=2018-02-01 `
-o jsonc
'''
Errors
From az functionapp deploy ... --verbose (truncated + redacted):
'''
Response content:
{"id":"...","properties":{"deployment":{"id":"", ...}}}
<title>Runtime Error</title>
Server Error in '/' Application.
Runtime Error
... suggests adding to web.config ...
'''
Then Azure CLI throws:
'''
The command failed with an unexpected error. Here is the traceback:
Extra data: line 1 column (char )
...
json.decoder.JSONDecodeError: Extra data: line 1 column (char )
...
requests.exceptions.JSONDecodeError: Extra data: line 1 column (char )
'''
Deployment status call returns status=3 and the service error (and again has HTML appended after JSON):
'''
"status": 3,
"status_text": "RunFromExternalUrlException: The app setting WEBSITE_RUN_FROM_PACKAGE is set to a remote URL. Therefore, Deployment is not needed in this case. For new deployment, just set the WEBSITE_RUN_FROM_PACKAGE to the remote URL of the latest zip package and manually call synctriggers."
'''
Issue script & Debug output
Repro script (PowerShell). Please run with --debug and paste full output below (redact secrets):
'''
$sub=""
$rg=""
$app=""
$pkg=""
1) Deploy
az functionapp deploy -g $rg -n $app --type zip --src-url $pkg --verbose --debug
2) Extract the deployment GUID from the deploy output (deployment id)
$dep=""
3) Query deployment record (this also shows JSON + appended HTML in the response)
az rest --method get --debug --url "https://management.azure.com/subscriptions/$sub/resourceGroups/$rg/providers/Microsoft.Web/sites/$app/deployments/$dep"
--url-parameters api-version=2018-02-01 `
-o jsonc
'''
In the debug output, the key symptom is that the response body contains JSON followed by <!DOCTYPE html> and an ASP.NET-style runtime error page.
Expected behavior
-
CLI should not crash with an unhandled JSONDecodeError.
-
If the service returns non-JSON or mixed content, CLI should:
- fall back to raw-text handling (or parse the first JSON object only),
- and return a clear, actionable error message.
-
If WEBSITE_RUN_FROM_PACKAGE blocks deployment, CLI should surface that message cleanly (and ideally provide guidance: update WEBSITE_RUN_FROM_PACKAGE + call syncfunctiontriggers).
Environment Summary
azure-cli 2.77.0
core 2.77.0
telemetry 1.1.0
Extensions:
application-insights 1.2.3
log-analytics 1.0.0b1
resource-graph 2.1.1
Dependencies:
msal 1.34.0b1
azure-mgmt-resource 23.3.0
Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Config directory 'C:\Users\Jonas.azure'
Extensions directory 'C:\Users\Jonas.azure\cliextensions'
Python (Windows) 3.13.7 (tags/v3.13.7:bcee1c3, Aug 14 2025, 14:15:11) [MSC v.1944 64 bit (AMD64)]
Legal docs and information: aka.ms/AzureCliLegal
Additional context
- The Function App has
WEBSITE_RUN_FROM_PACKAGE set to a remote URL (external package).
- The deployment record reports
RunFromExternalUrlException suggesting “deployment not needed” and to “set WEBSITE_RUN_FROM_PACKAGE to latest zip and manually call synctriggers”.
- Regardless of the correct deployment approach, the CLI bug is that JSON responses appear to have HTML appended, causing JSON parsing to fail (observed both during
az functionapp deploy and when querying deployment status).
- Related issues: #32443 and #30960.
Comments
Comment by @azure-client-tools-bot-prd[bot]
Hi Jonas Kamsker (@JKamsker),
2.77.0 is not the latest Azure CLI(2.82.0).
If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.
Thank you for opening this issue, we will look into it.
Comment by @microsoft-github-policy-service[bot]
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc Kirstyn Amperiadis (@kamperiadis), Ahmed El Sayed (@amamounelsayed), Khuram Khan (@khkh-ms).
Comment by @github-actions[bot]
Here are some similar issues that might help you. Please check if they can solve your problem.
Possible solution (Extracted from existing issue, might be incorrect; please verify carefully)
Solution 1:
This issue might be caused by extra HTML being delivered along with the JSON payload from the deploy REST endpoint. I suspect that is the bug that is triggering this CLI error. The CLI tool should handle such cases gracefully by either parsing only the JSON part or providing a clear error message.
Reference:
Solution 2:
Another issue which causes this is when Firewall/Access Restriction rules are enabled for the scm site and the machine deploying does not have IP allowed. Ensure that the machine deploying has the correct IP allowed in the Access Restriction rules.
Reference:
Powered by issue-sentinel
Comment by @microsoft-github-policy-service[bot]
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc Kirstyn Amperiadis (@kamperiadis), Ahmed El Sayed (@amamounelsayed), Khuram Khan (@khkh-ms).
This breaks usage from the Terraform provider as well, i.e.
''' hcl
resource "azapi_resource" "symbolicname" {
type = "Microsoft.Web/sites/extensions@2022-09-01"
name = "onedeploy"
parent_id = "string"
}
'''
Error: Failed to create/update resource
│
│ with azapi_resource.function_package_deploy,
│ on deployment.tf line 86, in resource "azapi_resource" "function_package_deploy":
│ 86: resource "azapi_resource" "function_package_deploy" {
│
│ creating/updating Resource: (ResourceId
│ "/subscriptions//resourceGroups//providers/Microsoft.Web/sites/<[~]function>/extensions/OneDeploy" / Api
│ Version "2022-09-01"): invalid character '<' after top-level value
<<END:issue-32655>>
Source: Azure/azure-cli#32655 (by Jonas Kamsker (@JKamsker))
Affected extension:
functionapp(src/functionapp/)<<UNTRUSTED:issue-32655>>
Issue #32655 (by Jonas Kamsker (@JKamsker))
Title
az functionapp deploycrashes (JSONDecodeError) because OneDeploy responses contain JSON + appended HTML (Flex Consumption). Also blocks with RunFromExternalUrlException when WEBSITE_RUN_FROM_PACKAGE is set.Body
Describe the bug
az functionapp deploy(preview) crashes with an unhandled JSON parsing exception when deploying a zip package to a Linux Azure Function App on Flex Consumption.The underlying deploy request is accepted (202) and returns JSON that includes a deployment id, but the response body appears to contain valid JSON followed by an appended HTML “Server Error in '/' Application” page. This causes Azure CLI to throw
JSONDecodeError: Extra dataand exit unexpectedly.In the same scenario, querying the deployment record shows the deployment fails with:
RunFromExternalUrlException: The app setting WEBSITE_RUN_FROM_PACKAGE is set to a remote URL. Therefore, Deployment is not needed... set WEBSITE_RUN_FROM_PACKAGE ... and manually call synctriggers.Even if this configuration is expected to block zip deployment, the CLI should not crash because the response contains mixed content (JSON + HTML). Instead it should surface the service error cleanly.
This looks related to existing reports about JSON responses having HTML appended (for Flex Consumption deployments), e.g. azure-cli #32443 and #30960.
Related command
PowerShell:
'''
az functionapp deploy -g -n
--type zip--src-url "" `
--verbose
'''
Deployment status query that also returns JSON + appended HTML:
'''
$sub=""
$rg=""
$app=""
$dep=""
az rest --method get
--url "https://management.azure.com/subscriptions/$sub/resourceGroups/$rg/providers/Microsoft.Web/sites/$app/deployments/$dep"--url-parameters api-version=2018-02-01 `
-o jsonc
'''
Errors
From
az functionapp deploy ... --verbose(truncated + redacted):'''
<title>Runtime Error</title>Response content:
{"id":"...","properties":{"deployment":{"id":"", ...}}}
Server Error in '/' Application.
Runtime Error
... suggests adding to web.config ... '''Then Azure CLI throws:
'''
The command failed with an unexpected error. Here is the traceback:
Extra data: line 1 column (char )
...
json.decoder.JSONDecodeError: Extra data: line 1 column (char )
...
requests.exceptions.JSONDecodeError: Extra data: line 1 column (char )
'''
Deployment status call returns
status=3and the service error (and again has HTML appended after JSON):'''
"status": 3,
"status_text": "RunFromExternalUrlException: The app setting WEBSITE_RUN_FROM_PACKAGE is set to a remote URL. Therefore, Deployment is not needed in this case. For new deployment, just set the WEBSITE_RUN_FROM_PACKAGE to the remote URL of the latest zip package and manually call synctriggers."
'''
Issue script & Debug output
Repro script (PowerShell). Please run with
--debugand paste full output below (redact secrets):'''
$sub=""
$rg=""
$app=""
$pkg=""
1) Deploy
az functionapp deploy -g $rg -n $app --type zip --src-url $pkg --verbose --debug
2) Extract the deployment GUID from the deploy output (deployment id)
$dep=""
3) Query deployment record (this also shows JSON + appended HTML in the response)
az rest --method get --debug
--url "https://management.azure.com/subscriptions/$sub/resourceGroups/$rg/providers/Microsoft.Web/sites/$app/deployments/$dep"--url-parameters api-version=2018-02-01 `
-o jsonc
'''
In the debug output, the key symptom is that the response body contains JSON followed by
<!DOCTYPE html>and an ASP.NET-style runtime error page.Expected behavior
CLI should not crash with an unhandled
JSONDecodeError.If the service returns non-JSON or mixed content, CLI should:
If
WEBSITE_RUN_FROM_PACKAGEblocks deployment, CLI should surface that message cleanly (and ideally provide guidance: updateWEBSITE_RUN_FROM_PACKAGE+ callsyncfunctiontriggers).Environment Summary
azure-cli 2.77.0
core 2.77.0
telemetry 1.1.0
Extensions:
application-insights 1.2.3
log-analytics 1.0.0b1
resource-graph 2.1.1
Dependencies:
msal 1.34.0b1
azure-mgmt-resource 23.3.0
Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Config directory 'C:\Users\Jonas.azure'
Extensions directory 'C:\Users\Jonas.azure\cliextensions'
Python (Windows) 3.13.7 (tags/v3.13.7:bcee1c3, Aug 14 2025, 14:15:11) [MSC v.1944 64 bit (AMD64)]
Legal docs and information: aka.ms/AzureCliLegal
Additional context
WEBSITE_RUN_FROM_PACKAGEset to a remote URL (external package).RunFromExternalUrlExceptionsuggesting “deployment not needed” and to “set WEBSITE_RUN_FROM_PACKAGE to latest zip and manually call synctriggers”.az functionapp deployand when querying deployment status).Comments
Comment by @azure-client-tools-bot-prd[bot]
Hi Jonas Kamsker (@JKamsker),
2.77.0 is not the latest Azure CLI(2.82.0).
If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.
Comment by Yong Zhang (@yonzhan)
Thank you for opening this issue, we will look into it.
Comment by @microsoft-github-policy-service[bot]
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc Kirstyn Amperiadis (@kamperiadis), Ahmed El Sayed (@amamounelsayed), Khuram Khan (@khkh-ms).
Comment by @github-actions[bot]
Here are some similar issues that might help you. Please check if they can solve your problem.
2025-11-01#9369Possible solution (Extracted from existing issue, might be incorrect; please verify carefully)
Solution 1:
This issue might be caused by extra HTML being delivered along with the JSON payload from the deploy REST endpoint. I suspect that is the bug that is triggering this CLI error. The CLI tool should handle such cases gracefully by either parsing only the JSON part or providing a clear error message.
Reference:
ERROR: Extra data: line 1 column 1253 (char 1252)when running az functionapp deploy with --type zip azure-cli#32443 (comment)Solution 2:
Another issue which causes this is when Firewall/Access Restriction rules are enabled for the scm site and the machine deploying does not have IP allowed. Ensure that the machine deploying has the correct IP allowed in the Access Restriction rules.
Reference:
Powered by issue-sentinel
Comment by @microsoft-github-policy-service[bot]
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc Kirstyn Amperiadis (@kamperiadis), Ahmed El Sayed (@amamounelsayed), Khuram Khan (@khkh-ms).
Comment by Adam Tibbing (@tibbing)
This breaks usage from the Terraform provider as well, i.e.
''' hcl
resource "azapi_resource" "symbolicname" {
type = "Microsoft.Web/sites/extensions@2022-09-01"
name = "onedeploy"
parent_id = "string"
}
'''