Search code examples
azureazure-cloud-shell

ARM Template deployment fails in Azure Cloud Shell


When I issue the following command in the Azure Cloud shell:

az group deployment create --resource-group OurResourceGroup --template-file @WebSiteSQLDatabase.json --parameters @WebSiteSQLDatabase.parameters.json

I receive the following error message:

[Errno 36] File name too long: '{\r\n  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#...

The message continues on and outputs the entire template as if that were the filename that was too long. This is clearly a Python error...I have verified that the file is in the right location, and tried several different locations.

I have also tried executing from a URL:

Azure:~$ az group deployment create --resource-group OurResourceGroup --template-uri https://xxxx.file.core.windows.net/cs-xxxx-xxxx/templates/WebSiteSQLDatabase.json

but it returns this message:

HTTP Error 400: The value for one of the HTTP headers is not in the correct format.

Any suggestions would be appreciated.


Solution

  • I doubt you need @ in front of the file name. The second error is due to the fact that Azure File is not exposed with HTTP url, you should use blob storage, not file share

    error in the template: sql server name cannot contain -
    also, it appears that there is some bug in Azure Cli that prevents this from working (doing the same in PS works).