azure-cli: stat: path too long for Windows - error when using large parameters.json file

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az group deployment create

Errors:

stat: path too long for Windows

To Reproduce:

Create a parameters.json file that has 490+ lines with name value pairs. The total character count of said JSON file is 37343. Total file size is 37KB. The structure of the json file looks similar this:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "applicationSettings": {
            "value": {
                "CI": {
                    "AzureWebJobsStorage": "areallylongvaluethatyoumustputhereinordertoreproducetheproblemsojustaddabunchofletterstoproducetheproblemandthenaddthistoeachfieldletmeknowhowitworks",
                    "AzureWebJobsDashboard": "",
                    "AzureWebJobsServiceBus": "",
                    "AzureWebJobsServiceBusSource": ""
                },
                "DEV": {
                    "AzureWebJobsStorage": "",
                    "AzureWebJobsDashboard": "",
                    "AzureWebJobsServiceBus": "",
                    "AzureWebJobsServiceBusSource": ""
                },
                "QA": {
                    "AzureWebJobsStorage": "",
                    "AzureWebJobsDashboard": "",
                    "AzureWebJobsServiceBus": "",
                    "AzureWebJobsServiceBusSource": ""
                },
                "STG": {
                    "AzureWebJobsStorage": "",
                    "AzureWebJobsDashboard": "",
                    "AzureWebJobsServiceBus": "",
                    "AzureWebJobsServiceBusSource": ""
                },
                "TRN": {
                    "AzureWebJobsStorage": "",
                    "AzureWebJobsDashboard": "",
                    "AzureWebJobsServiceBus": "",
                    "AzureWebJobsServiceBusSource": ""
                },
                "PROD": {
                    "AzureWebJobsStorage": "",
                    "AzureWebJobsDashboard": "",
                    "AzureWebJobsServiceBus": "",
                    "AzureWebJobsServiceBusSource": ""
                }
            }
        }
    }
}

For each object in applicationSettings, there are 78 name value pairs with a value. When I remove chunks of JSON, the command works. The JSON file is formatted correctly and there are no errors. There appears to be a problem parsing a json file with a lot of content.

  • Put any pre-requisite steps here…
  • az group deployment create --resource-group WB-CI --template-file .\function-app-orderProcessing.json --parameter @function-app-orderProcessing.parameters.json

Expected Behavior

Environment Summary

Windows-10-10.0.17763-SP0
Python 3.6.6
Shell: powershell.exe

azure-cli 2.0.78

Additional Context

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (7 by maintainers)

Most upvoted comments

@ajklotz This problem is also related to the version of Python, so you can reinstall azure-cli by using Python 3.8 first. I’ve identified the underlying problem, and I’ll submit a PR to fix it in other versions of Python.

@a-vishar You are right, the error doesn’t occur when I remove @. I was told to provide the @ prefix in another github issue, but I can omit that. I’m glad to hear you are finding the root cause, thank you so much.

I got the idea to use @ from this github issue https://github.com/Azure/azure-cli/issues/11600