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.

Passing in an object to DeploymentProperties.Parameters fails to serialize and results in ARM deployment rejection

See original GitHub issue

Creating an Azure Resource Manager Deployment by specifying the parameters as an object in the request results in the parameters being dropped from serialization:

deployment.Properties = new DeploymentProperties
{
    Mode = DeploymentMode.Incremental,
    TemplateLink = new TemplateLink("[redacted]"),
    Parameters = new
    {
        diskStorageAccountName = "value",
        imageVhdPath = "value",
        virtualNetworkName = "value",
        virtualNetworkSubnetName = "value",
        vmName = value,
        vmAdminUserName = "value",
        vmAdminPassword = "value"
    }
};

generates the following request:

PUT https://management.azure.com/subscriptions/[redacted]/resourcegroups/[redacted]/providers/Microsoft.Resources/deployments/gameserver?api-version=2014-04-01-preview HTTP/1.1
x-ms-client-request-id: [redacted]
accept-language: en-US
Authorization: [redacted]
User-Agent: Microsoft.Azure.Management.Resources.ResourceManagementClient/3.0.0.0
Content-Type: application/json; charset=utf-8
Host: management.azure.com
Content-Length: 200
Expect: 100-continue

{
  "properties": {
    "templateLink": {
      "uri": "[redacted]"
    },
    "parameters": {},
    "mode": "Incremental"
  }
}

which results in a 400 result in the status, as parameters are missing from the request.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
fabsenetcommented, Jul 26, 2018

this issue is over two years old and I still struggle with it today. I found no other sources on the web and I have no idea how others are doing this. There should be a .Net-way of providing parameters but there isn’t.

I created the working json parameters string from objects in this way to mirror the json parameters template file:

var parametersObject = new
{
    myParam1 = new { value = "abc" },
    myParam2 = new {value = "def" },
    command3 = new { value = "aaa" }
};

var parametersJson = JsonConvert.SerializeObject(new { parameters=parametersObject });
0reactions
adrianhallcommented, Aug 7, 2019

My apologies for this taking so long. Is this still an issue?

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 >
Consolidated JDK 8 Release Notes
For systems unable to reach the Oracle Servers, a secondary mechanism expires this JRE (version 8u381) on 2023-11-17. After either condition is met...
Read more >
Java 8 release changes
Java 8 Release Highlights. This article applies to: Java version(s): 8.0. This page highlights changes impacting end users for each Java release.
Read more >
Cloud Management Error - Azure deployment using AR...
Hi All, I am trying out a POC of the cloud portal for our customer. We've created a catalog item using an Azure...
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