Reputation: 4946
I successfully moved several resources via REST API into other resource groups (using this howto) but it failed when I tried to move a WebApp and its service plan. I know there are limitations: I have to move the entire resource group and the target resource group mustn't contain a WebApp. So my target resource group is empty and my source resource group only contains the WebApp and the service plan. As suggested in the howto, I wrote this JSON:
{
"targetResourceGroup": "/subscriptions/Subscription-B/resourceGroups/newRG",
"resources": [
"/subscriptions/Subscription-A/resourceGroups/oldRG/providers/Microsoft.Web/serverFarms/test",
"/subscriptions/Subscription-A/resourceGroups/oldRG/providers/Microsoft.Web/sites/test"
]
}
and run it via command:
armclient post https://management.azure.com/subscriptions/Subscription-A/resourceGroups/oldRG/moveResources?api-version=2015-01-01 @path/to/my/json -verbose
I get "202: accepted" in the command window and in the portal I see in both resource groups (oldRG and newRG) the info text "resources being moved" but after a minute, nothing has changed.
Edit: When I click on "delete" in the oldRG, I see all the contained ressources: there are 4 alertrules, 1 autoscalesetting and 1 certificate. As mentioned in the limitations, I have to move all of them. But how can I access these 3 types of ressources? I don't have their ressource ID because I don't find them when I search for them.
Upvotes: 4
Views: 1357
Reputation: 4946
The solution was a combination of Zain Rizvi's answer and this:
I thought it does not matter, that's why I told you the names of the both resource groups are oldRG
and newRG
- but actually they have the same name. That was the problem. Even if they are in different subscriptions, I wasn't able to move my resources into a resource-group with the same name as the current resource has. So I created a new empty resourcegroup (tmpRG) inside subscriptionB and moved my resources from subscriptionA\myRG to subscriptionB\tmpRG and then from subscriptionB\tmpRG to subscriptionB\myRG.
Upvotes: 0
Reputation: 24636
The certificate resource Id looks like:
/subscriptions/Subscription-A/resourceGroups/oldRG/providers/Microsoft.Web/certificates/<certificateThumbprint>
You don't have to pass in autoscale settings or alert rules.
Upvotes: 1