Q. How can I move resources between Azure Resource Groups?

Q. How can I move resources between Azure Resource Groups?

Q. How can I move resources between Azure Resource Groups?

A. To move resources between Azure Resource Groups use the various AzureResource PowerShell cmdlets. After loading the Azure PowerShell module and authenticating using an Azure AD account (Add-AzureAccount) switch the mode to Azure Service Manager.

Switch-AzureMode -Name AzureResourceManager

Firstly to view all Resource Groups use:

Get-AzureResourceGroup

To view all resources in a specific Resource Group use:

Get-AzureResource -ResourceGroupName <resource group name>

To move all resources in a Resource Group use (I use Force to avoid prompt to confirm the move)

Get-AzureResource -ResourceGroupName <source resource group name> | Move-AzureResource -DestinationResourceGroupName <target resource group name> -Force

To move an individual resource use:

Get-AzureResource -ResourceName <resource name> -ResourceGroupName <source resource group name> | Move-AzureResource -DestinationResourceGroupName <target resource group name> -Force

Easy!

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish