azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Moving Azure resources doesn't do anything

Open tomasherceg opened this issue 11 years ago • 14 comments

I tried to used the Move-AzureResource commandlet and it doesn't do anything. It returns me immediately to the Powershell prompt.

Neither

get-azureresource -resourcegroupname MyGroup | move-azureresource -destinationresourcegroupname MyNewGroup

nor

move-azureresource -destinationresourcegroupname MyNewGroup -ResourceId MyResourceId -Force

works for me.

The behavior is exactly the same as here: http://stackoverflow.com/questions/30123326/cant-get-move-azureresource-working

tomasherceg avatar May 12 '15 17:05 tomasherceg

I have got the exact same problem Nothing happens when you run the commands. Debug shows nothing interesting or errors

ghost avatar May 26 '15 13:05 ghost

@eriksonjonas I used March release instead of the latest release and it worked. I've moved a storage account to other resource group. This may help you.

ilkayilknur avatar May 29 '15 12:05 ilkayilknur

Same here, I'll go and try the March release as suggested

steevegilbert avatar May 29 '15 20:05 steevegilbert

@ilkayilknur thx, ill try that release

ghost avatar May 29 '15 22:05 ghost

I tried 0.8.16 but moving web apps doesn't work in that version either...

petrsvihlik avatar Jun 01 '15 14:06 petrsvihlik

Interesting, i could move a storage acc, but no cloud service and vm.

ghost avatar Jun 01 '15 15:06 ghost

Same for me, I'm trying to move a web app from a resource group in the Australian data centre to another resource group in the same data centre, and I receive a number of error messages (from the portal audit log)

"...statusMessage:{"Code":"Conflict","Message":"ResourceGroup contains resources and cannot be deleted without deleting the resource first.","Target":null,"Details":[{"Message":"ResourceGroup contains resources and cannot be deleted without deleting the resource first."}..."

"statusCode:BadRequest statusMessage:{"Code":"BadRequest","Message":"Exception of type 'Microsoft.WindowsAzure.Management.Monitoring.MonitoringServiceException' was thrown."}"

Could this be something to do with the application insights and event rules (belonging to the web app/app service plan/resourcegroup) being housed in the Central US data centre?

I am trying this in version 0.9.2.

This is the result from the powershell window:

Move-AzureResource : { "Error": { "Code": "99", "Message": "Resources '/subscriptions/{subscriptionid}/resourceGroups/adam-RG/providers/microso ft.insights/alertrules/CPUHigh adam-webserver-test,/subscriptions/{subscriptionid}/resourceGroups/a dam-RG/providers/microsoft.insights/alertrules/LongHttpQueue adam-webserver-test,/subscriptions/{subscriptionid}/resourceGroups/adam-RG/providers/microsoft.insights/autoscalesettings/adam-webserver-test-adam-RG,/subscr iptions/{subscriptionid}/resourceGroups/adam-RG/providers/Microsoft.Web/serverFarms/adam-webserver- test,/subscriptions/{subscriptionid}/resourceGroups/adam-RG/providers/Microsoft.Web/sites/adam-test 456' could not be moved. The tracking Id is '{trackingid}'", "Target": null, "Details": null } } At line:1 char:48

  • Get-AzureResource -ResourceGroupName adam-RG | Move-AzureResource -DestinationRe ...
  •                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : CloseError: (:) [Move-AzureResource], ErrorResponseMessageException
    • FullyQualifiedErrorId : 99,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.MoveAzureResourceComm and

sagoo33 avatar Jun 02 '15 21:06 sagoo33

This is now fixed. Please update to latest 0.9.3

vivsriaus avatar Jun 15 '15 20:06 vivsriaus

Sadly I cannot confirm that this is fixed with 0.9.3, tried it today with that version but still the behavior is the same as stated in the linked Stackoverflow question.

ckonig avatar Jun 18 '15 13:06 ckonig

To move a VM using Move-AzureResourceGroup you need to move the containing cloud service and all its VMs at the same time. For example:

Get-AzureResource -ResourceGroupName OriginalResourceGroup | where { $_.ResourceType -match 'Microsoft.ClassicCompute' } | Move-AzureResource -DestinationResourceGroupName NewResourceGroup

By default, the resources in a cloud service are put in a resource group with the same name as the DNS name of the cloud service.

nmackenzie avatar Jul 17 '15 17:07 nmackenzie

I just tried moving web apps across resource groups - which was the original issue - and it works fine in 0.9.4.

petrsvihlik avatar Jul 17 '15 17:07 petrsvihlik

Hey Guys . You know if I can move this resources ? Resources Like , Virtual networkings , Backup Vaults .

I tried using these lines: Get-AzureResource -ResourceId $ ResourceID | Move-AzureResource -DestinationResourceGroupName $ Name

Thanks .

OliverFlux avatar Aug 04 '15 20:08 OliverFlux

I haven't tried that. Check this out: http://feedback.azure.com/forums/223579-azure-preview-portal/suggestions/6178622-ability-to-move-resources-from-one-resource-group

petrsvihlik avatar Aug 05 '15 06:08 petrsvihlik

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @rthorn17

ghost avatar Aug 14 '19 19:08 ghost