15

Recently I've started creating a new resource group but it seems to be stuck at provisioning server farm resource. Restarting deployment outputs the following error:

New-AzureResourceGroup : DeploymentActive: Unable to edit or replace deployment 'App': previous deployment from '8/26/2015 8:48:55 AM' is still active (expiration time is '9/2/2015 8:48:54 AM').

I have no time to wait for its expiration. Is there a way to cancel Azure ARM deployment?

Demchenko Anton
  • 385
  • 4
  • 13

4 Answers4

17

Stop-AzureRmResourceGroupDeployment should cancel the deployment and preserve the resourcegroup if you need to go that route.

https://learn.microsoft.com/en-us/powershell/module/azurerm.resources/stop-azurermresourcegroupdeployment

Scott Coldwell
  • 868
  • 7
  • 14
bmoore-msft
  • 8,376
  • 20
  • 22
  • 3
    installing the AzureRM modules can be challenging... BTW: it seems the cmdlet has been renamed with an additional "RM" inside: Stop-AzureRMResourceGroupDeployment – Falco Alexander Oct 20 '15 at 18:14
  • 1
    There will be two versions of the cmdlets for a while - 0.9.8 will have the two modes and AzureRM will simply be Azure. – bmoore-msft Oct 21 '15 at 02:25
  • 1
    [let's try again] - There is a new [preview] version of the cmdlets, one with AzureRM in the name (the 1.0 preview https://azure.microsoft.com/en-us/blog/azps-1-0-pre/) and that is currently using PowerShellGet for installation, so a bit different than previous versions. The non-preview version of the cmdlets out now can be installs from the Web Platform Installer. Both should be in the Web Platform Installer once they are GA. Both will work against Azure for the foreseeable future. – bmoore-msft Oct 21 '15 at 02:44
  • 1
    thx. this was indeed a bit confusing. also there are many tasks you don't know where to start: old Portal, new Portal, Powershell, azure support... – Falco Alexander Oct 21 '15 at 08:07
2

For those using Azure CLI:

> az deployment sub cancel --name <deployment name>
Oskar
  • 1,996
  • 1
  • 22
  • 39
1

Since Microsoft is retiring the AzureRm module, the new command looks like this:

Stop-AzDeployment

https://learn.microsoft.com/en-us/powershell/module/az.resources/stop-azdeployment?view=azps-9.1.0

eladyanai
  • 1,063
  • 2
  • 15
  • 34
0

You can use the Remove-AzureResourceGroup cmdlet. It will start deleting the resources and cancel the deployment. However, the best way to avoid waiting for anything is to deploy with a different name, and let the delete run in the background.

https://msdn.microsoft.com/en-us/library/dn654585.aspx

theadriangreen
  • 2,218
  • 1
  • 14
  • 14