Created
February 2, 2018 12:05
-
-
Save sumitsaiwal/b90e4df10fe4a619024070d2ed6b94bc to your computer and use it in GitHub Desktop.
Moving Azure resources from one RG to another.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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