question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ARM template deployment does not work when Parameter property is used

See original GitHub issue

An unhandled exception of type ‘Microsoft.Rest.Azure.CloudException’ occurred in mscorlib.dll

Additional information: The request content was invalid and could not be deserialized: ‘Error converting value “http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#” to type ‘Microsoft.WindowsAzure.ResourceStack.Frontdoor.Data.Definitions.DeploymentParameterDefinition’. Path ‘properties.parameters.$schema’, line 291, position 100.’.

var deployment = new Deployment(); deployment.Properties = new DeploymentProperties { Mode = DeploymentMode.Incremental, Template = templateFileContent, Parameters = parameterFileContent };

File contents are being read as follows: JObject parameterFileContent = GetJsonFileContents(pathToParameter); public static JObject GetJsonFileContents(string pathToJson) { JObject templatefileContent = new JObject(); using (StreamReader file = File.OpenText(pathToJson)) { using (JsonTextReader reader = new JsonTextReader(file)) { templatefileContent = (JObject)JToken.ReadFrom(reader); return templatefileContent; } }

    }

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
blumucommented, Oct 18, 2016

OK, so that was it. The new Nuget (named Microsoft.Azure.Management.ResourceManager) introduces a breaking change: you now need to specify the entire template parameter file content including the $schema and contentVersion field, as opposed to just the "paramters" : { } node like in previous version of the nuget (Microsoft.Azure.Management.Resources).

1reaction
blumucommented, Oct 11, 2016

@TianoMS I’m guessing you are referring to nuget Microsoft.Azure.Management.ResourceManager which I am also guessing is now replacing Microsoft.Azure.Management.Resources? I actually tried the latest version of this package (1.3.1) and got a weird error:

One or more errors occurred.The request content was invalid and could not be deserialized: 'Error converting value "{
 "myTemplateParameter": {
    "value": "ed103462dsfasdf"
 }
 }" to type 'System.Collections.Generic.Dictionary`2[System.String,Microsoft.WindowsAzure.ResourceStack.Frontdoor.Data.Definitions.DeploymentParameterDefinition]'. Path 'properties.parameters', line 78, position 424.'.

Is the Azure REST API now expecting a different format for the Parameters field?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ARM deployment fails when properties are passed an ...
The issue here was that I was passing including name parameter along with other parameters when setting resource properties.
Read more >
Quickstart: Troubleshoot ARM template JSON deployments
This quickstart describes how to troubleshoot Azure Resource Manager template (ARM template) JSON deployment errors.
Read more >
Exploring ARM Templates: Azure Resource Manager Tutorial
Parameters allow you to pass different values to the ARM template for use during the deployment. Some common examples include names of ...
Read more >
Azure Resource Manager Templates Tutorial 2023
These parameters are used in run time or during deployment. In a parameter, we need to define the name, type, values, and properties....
Read more >
Azure Resource Manager - Adding parameters to ARM ...
Using parameter values. The built-in parameters() function can be used to retrieve the value provided by the end user as a part of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found