Trevor Elliott
Trevor Elliott

Reputation: 11252

New-AzureRmResourceGroupDeployment: "Deployment 'xxx' could not be found"

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.

Upvotes: 2

Views: 2574

Answers (1)

TravisEz13
TravisEz13

Reputation: 2413

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

Upvotes: 2

Related Questions