Unable to deploy using ARM template by passing the content of the json file.
See original GitHub issueHi folks,
I am trying to do a deployment but rather than passing the TemplateLink and ParametersLink, I’d rather passing the content. When I do so however I get an error as follows. What I do right now is simply loading the content of my template file
public static Object GetTemplate() {
return File.ReadAllText( @"E:\OfficialTemp\tmplt.json" ); }
public static Object GetParameters(){
return File.ReadAllText( @"E:\OfficialTemp\params.json"); }
and then in my main:
deployment.Properties = new DeploymentProperties
{
Mode = DeploymentMode.Incremental,
Template = GetTemplate(),
Parameters = GetParameters(),
};
var resourceManagementClient = new ResourceManagementClient( credential )
{ SubscriptionId = subscriptionId };
return await resourceManagementClient.Deployments.CreateOrUpdateAsync(
groupName,
deploymentName,
deployment );
I’d like to mention that my tmplt.json and params.json are exactly the file that I used to in my deployment using the URI so I do not think that is an issue. (I get the error even when I use the values stated for template and parameters files in https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-csharp-template/)
Error: System.AggregateException: One or more errors occurred. —> Microsoft.Rest.Azure.CloudException: The request content was invalid and could not be deserialized: 'Error converting value "
}" to type ‘Microsoft.WindowsAzure.ResourceStack.Frontdoor.Templates.Schema.Template’. Path ‘properties.template’, line 3, position 23171.'. at Microsoft.Azure.Management.ResourceManager.DeploymentsOperations.<BeginCreateOrUpdateWithHttpMessagesAsync>d__9.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Management.ResourceManager.DeploymentsOperations.<CreateOrUpdateWithHttpMessagesAsync>d__8.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Management.ResourceManager.DeploymentsOperationsExtensions.<CreateOrUpdateAsync>d__7.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at ConsoleApplication1.Program.<CreateTemplateDeploymentAsync>d__3.MoveNext() in
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
Thanks @devigned , it seems a bit tricky as we can pass string for template but not the parameter. I modified to this and now passes the json issue. Thanks for the link. That said I get a new exception (Long running operation failed with status ‘Failed’). Should I just retry or you have any other recommendations?
This is an old issue. Is it still relevant?