How can I pass ARM template parameters through the API instead of a parameter file?
<p>I'm attempting to automate the creation of some resources in Azure using Azure Resource Manager .NET libraries. I am able to create the Resource Group and have placed my ARM template in an accessible location on blob storage; however, I would like to be able to pass in the parameters to the request in code instead of staging a JSON file somewhere in storage.</p>
<p>It seems like this should be possible. For example, on the <code>Deployment.Properties</code> object, it has both <code>Parameters</code> and <code>ParametersLink</code>, but I cannot find any documentation on its usage and the following is throwing an exception saying that no value was specified for the parameters in the template:</p>
<pre><code>deployment.Properties = new DeploymentProperties
{
    Mode = DeploymentMode.Incremental,
    TemplateLink = new TemplateLink(&quot;link-to-my-template-json-in-storage&quot;),
    Parameters = new
    {
        diskStorageAccountName = &quot;value&quot;,
        imageVhdPath = &quot;value&quot;,
        virtualNetworkName = &quot;value&quot;,
        virtualNetworkSubnetName = &quot;value&quot;,
        vmName = value,
        vmAdminUserName = &quot;value&quot;,
        vmAdminPassword = &quot;value&quot;
    }
};
</code></pre>
<p>This yields the following error:</p>
<blockquote>
<p>An unhandled exception of type 'Microsoft.Rest.Azure.CloudException' occurred in mscorlib.dll</p>
<p>Additional information: Deployment template validation failed: 'The value for the template parameter 'diskStorageAccountName' at line '5' and column '32' is not provided. Please see <a href="http://aka.ms/arm-deploy/#parameter-file" rel="nofollow noreferrer">http://aka.ms/arm-deploy/#parameter-file</a> for usage details.'.</p>
</blockquote>
<p>Am I doing something wrong? <code>DeploymentProperties.Parameters</code> is just an <code>Object</code> so I had assumed that it would be serialized and passed on correctly -- is this assumption incorrect?</p>
<p>Edit: The <a href="https://msdn.microsoft.com/en-us/library/microsoft.azure.management.resources.models.deploymentproperties.parameters.aspx" rel="nofollow noreferrer">MSDN article</a> is not very helpful either.</p>
<p>Edit 2: I wonder if this is a bug in the autogenerated code. See line 700 here:</p>
<p><a href="https://github.com/Azure/azure-sdk-for-net/blob/master/src/ResourceManagement/Resource/ResourceManagement/Generated/DeploymentOperations.cs" rel="nofollow noreferrer">https://github.com/Azure/azure-sdk-for-net/blob/master/src/ResourceManagement/Resource/ResourceManagement/Generated/DeploymentOperations.cs</a></p>
<p>Looks like it is trying to <code>JObject.Parse</code></p>
<p>Edit 3: Opened an <a href="https://github.com/Azure/azure-sdk-for-net/issues/1749" rel="nofollow noreferrer">issue on GitHub</a>.</p>