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.

Long running operation failed with status 'Failed' when trying to create a resource using ARM templates

See original GitHub issue

I am trying to create a deployment based on https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-csharp-template/.

public static async Task<DeploymentExtended> CreateTemplateDeploymentAsync(
   TokenCredentials credential, 
   string groupName, 
   string deploymentName, 
   string subscriptionId)
   {
     Console.WriteLine("Creating the template deployment...");
     var templateParams = new Dictionary<string, Dictionary<string, object>>{
       { "adminPassword", new Dictionary<string, object>{{"value","Azure1234567"}}},
       { "adminUserName", new Dictionary<string, object>{{"value", "davidmu" } }}
     };

     var deployment = new Deployment();
     deployment.Properties = new DeploymentProperties
     {
       Mode = DeploymentMode.Incremental,
       Template = JObject.Parse(File.ReadAllText("Templates\\CreateVMTemplate2.json")),
       Parameters = templateParams
     };
     var resourceManagementClient = new ResourceManagementClient(credential) { SubscriptionId = subscriptionId };
     return await resourceManagementClient.Deployments.CreateOrUpdateAsync(groupName, deploymentName, deployment);
    }

I ran this multiple times and each time I get this exception. Is there anything that I am missing here?

Error: System.AggregateException: One or more errors occurred. —> Microsoft.Rest.Azure.CloudException: Long running operation failed with status ‘Failed’. at Microsoft.Rest.Azure.AzureClientExtensions.<GetPutOrPatchOperationResultAsync>d__12.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.Rest.Azure.AzureClientExtensions.<GetPutOrPatchOperationResultAsync>d__01.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.TaskAwaiter1.GetResult() at ConsoleApplication1.Program.<CreateTemplateDeploymentAsync>d__3.MoveNext() in C:\Users\rostams\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:line 151 --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result() at ConsoleApplication1.Program.Main(String[] args) in C:\Users\rostams\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:line 49 ---> (Inner Exception #0) Microsoft.Rest.Azure.CloudException: Long running operation failed with status 'Failed'. at Microsoft.Rest.Azure.AzureClientExtensions.<GetPutOrPatchOperationResultAsync>d__12.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.Rest.Azure.AzureClientExtensions.<GetPutOrPatchOperationResultAsync>d__01.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.TaskAwaiter1.GetResult() at ConsoleApplication1.Program.<CreateTemplateDeploymentAsync>d__3.MoveNext() in C:\Users\rostams\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:line 151<—

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

6reactions
devignedcommented, Jul 20, 2016

@kirthik and @hovsepm we really should provide all HTTP first principles in exceptions. They should include the request / response headers, body, uri, etc., so that a consumer of the lib could reproduce the request using PS or curl. Beyond that, “Failed” is completely inadequate and should contain the information for why the deployment failed.

3reactions
troshko111commented, Jan 25, 2017

Hit same error. Quick mitigation would be to open portal and look for the real error under resource group - deployments - your deployment

But the error is pretty ridiculous, it should include the proper amount of detail and honestly it’s rather critical SDK bug, how come it’s not fixed in half a year?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot common Azure deployment errors
Error code Mitigation More inform... AccountNameInvalid Follow naming guidelines for storage accounts. Resolve erro... AccountPropertyCannotBeSet Check available storage account properties. storageAcco... AnotherOperationInProgress Wait for concurrent operation...
Read more >
Invalid template errors - Azure Resource Manager
Describes how to resolve invalid template errors when deploying Bicep files or Azure Resource Manager templates (ARM templates).
Read more >
Troubleshooting common ARM Templates errors | by Dave R
7. Error message: InvalidTemplateDeployment — Long running operation failed with status 'Failed'. Status Message: The template deployment is not ...
Read more >
Common errors deploying Azure Bicep and ARM templates
The deployment of Microsoft. Logic/workflows fails with a BadRequest and shows the following error details:
Read more >
Azure DevOps pipeline arm template deployment ...
Since yesterdays afternoon, a redeploy of a previously working deployment fails with the following error: At least one resource deployment ...
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