1

I'm using the latest Azure Powershell and have started getting this error when I run the following code to deploy my template:

New-AzureRmResourceGroupDeployment -Name ((Get-ChildItem $TemplateFile).BaseName + '-' + ((Get-Date).ToUniversalTime()).ToString('MMdd-HHmm')) `
                                  -ResourceGroupName $ResourceGroupName `
                                  -TemplateFile $TemplateFile `
                                  -Mode $DeploymentMode `
                                  @OptionalParameters `
                                  -Force -Verbose -ErrorAction Stop

Results in this error:

VERBOSE: 7:34:35 PM - Template is valid.
VERBOSE: 7:34:35 PM - Create template deployment 'MyDeployment-0615-2331'
VERBOSE: 7:34:35 PM - Checking deployment status in 5 seconds
Microsoft.Rest.Azure.CloudException: Deployment 'MyDeployment-0615-2331' could not be found.
   at Microsoft.Azure.Management.ResourceManager.DeploymentOperationsOperations.<ListWithHttpMessagesAsync>d__6.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.DeploymentOperationsOperationsExtensions.<ListAsync>d__3.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.DeploymentOperationsOperationsExtensions.List(IDeploymentOperationsOperations operations, String resourceGroupName, String deploymentName, Nullable`1 top)
   at Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkClient.ResourceManagerSdkClient.WriteDeploymentProgress(String resourceGroup, String deploymentName, Deployment deployment)
   at Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkClient.ResourceManagerSdkClient.WaitDeploymentStatus(String resourceGroup, String deploymentName, Deployment basicDeployment, Action`3 job, ProvisioningState[] status)

   at Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkClient.ResourceManagerSdkClient.ProvisionDeploymentStatus(String resourceGroup, String deploymentName, Deployment deployment)
   at Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkClient.ResourceManagerSdkClient.ExecuteDeployment(PSCreateResourceGroupDeploymentParameters parameters)
   at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet.ExecuteCmdlet()
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()

This doesn't really make any sense to me because it should not be looking for an existing deployment, it should be creating a new one. The deployment is never created in Azure.

This is an intermittent problem and doesn't happen all the time, but is pretty frequent.

Trevor Elliott
  • 11,292
  • 11
  • 63
  • 102
  • It seams like an error happens when Azure PowerShell is trying to get the provision status of your deployment. You see, creating a deployment does take sometime, so the Azure PowerShell will check the provision status every 5 seconds after you run the command. The error occur because, somehow, the deployment is not being created, so Azure PowerShell cannot get the provision status. Can you share your template and parameters, so that I can reproduce your issue? – Jack Zeng Jun 16 '16 at 05:26

1 Answers1

1

This is a known issue and Azure PowerShell SDK team is working on a fix and looking for templates that repro the problem.

TravisEz13
  • 2,263
  • 1
  • 20
  • 28