Skip to content

Instantly share code, notes, and snippets.

@sumitsaiwal
Created February 2, 2018 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sumitsaiwal/b90e4df10fe4a619024070d2ed6b94bc to your computer and use it in GitHub Desktop.
Save sumitsaiwal/b90e4df10fe4a619024070d2ed6b94bc to your computer and use it in GitHub Desktop.
Moving Azure resources from one RG to another.
#Login
Login-AzureRmAccount
#Variables
$sourceRG = Read-Host 'sourceRG' #Name of source Resource Group
$destinationRG = Read-Host 'destinationRG' #Name of destinatino Resource Group
$Subscription = Read-Host 'SubscriptionName' #Name of Subscription
#Get resources
Select-AzureRmSubscription -SubscriptionName $Subscription
$resources = Get-AzureRmResource | ? {$_.ResourceGroupName –eq $sourceRG}
#Move resources
Move-AzureRmResource -DestinationResourceGroupName $destinationRG -ResourceId $resources.ResourceId -Verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment