azure-sdk-for-net: Long running operation failed with status 'Failed' when trying to create a resource using ARM templates
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__0
1.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.Task
1.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__1
2.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.TaskAwaiter
1.GetResult()
at ConsoleApplication1.Program.<CreateTemplateDeploymentAsync>d__3.MoveNext() in C:\Users\rostams\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:line 151<—
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (8 by maintainers)
@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.
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?
Do we have this now? Because I just got this error myself.
CloudException already contains the entire request and response @devigned what is the actual ask here?