2

I would like to deploy a template from the Azure Resource Manager QuickStart Templates.

Many of the templates there have a default value specified in the template file (for example this one azuredeploy.json ):

"ouPath": {
  "type": "string",
  "defaultValue": "",
  "metadata": {
    "description": "Specifies an organizational unit (OU) for the domain account. Enter the full distinguished name of the OU in quotation marks. Example: 'OU=testOU; DC=domain; DC=Domain; DC=com"
  }
},

However, the corresponding azuredeploy.parameters.json does not define the ouPath value.

When I specify the file in --parameters-file in the Azure CLI call:

azure group deployment create "${resource_group_name}" "${deployment_name}" --template-uri "${template_uri}" --parameters-file ${parameters_file}

I get an error:

info: Executing command group deployment create
  error: Template and Deployment "parameters" objects lengths do not match
  Deployment Parameter file does not have { ouPath } defined.
  error: Error information has been recorded to /Users/techraf/.azure/azure.err
  error: group deployment create command failed

If I define add the value explicitly to the parameters.json file, the deployment works properly.


Main question:

The sheer number of examples (parameters.json) in the above Azure repository without explicitly specified values makes me think, there must be a way to tell Azure to use default value instead of providing it in parameters.json.

Is there a way to avoid adding the values that have defaultValue defined in the template file when using Azure CLI?


Additional question:

Worse yet, in the example I have given above, the default value is empty and if I specify an empty value in the parameters.json:

"ouPath": {
  "value": ""
},

I get an interactive prompt for the value.

How can I avoid that?

  • Using a default value should just be a case of not supplying it in the parameters file, I do this all the time and it works fine. I wonder if the issue here is that the default value is an empty string, if you set the default to something else does it then work? – Sam Cogan Oct 20 '16 at 8:41
  • In my case, it doesn't work for any value, for example 201-vm-winrm-windows requires me to define windowsOSVersion in parameters.json even though it has a default value of 2012-R2-Datacenter in the template. – techraf Oct 20 '16 at 8:45
  • Are you using the latest version of PowerShell cmdlets and Azure SDK? I had issues in the past where random paramters would complain about a lack of value (whilst others with default values would be fine), this has gone away in the last few months – Sam Cogan Oct 20 '16 at 8:47
  • I'm not using PowerShell, I am using Azure CLI. 0.10.5 on OS X – techraf Oct 20 '16 at 8:49
0

It seems it was a bug in Azure CLI 0.10.5.

The problem does not happen with the 0.10.6 although the release notes do not mention this fix explicitly.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.