Skip to content

Commit ac7b079

Browse files
committed
restructure the article
1 parent a09ccfd commit ac7b079

File tree

3 files changed

+28
-26
lines changed

3 files changed

+28
-26
lines changed
-1.28 KB
Loading
-10.1 KB
Loading

articles/azure-resource-manager/management/move-resource-group-and-subscription.md

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ ai-usage: ai-assisted
1313

1414
This article explains how to move Azure resources between resource groups, whether they are within the same subscription or across different subscriptions. If the move involves different subscriptions, both subscriptions must be part of the same Microsoft Entra ID tenant. You can perform the move using tools like the [Azure portal](#use-the-portal), [Azure PowerShell](#use-azure-powershell), [Azure CLI](#use-azure-cli), the [REST API](#use-rest-api), or [Python](#use-python).
1515

16-
During the move operation, both the source and target resource groups are locked. This means you cannot create, delete, or update resources within these resource groups while the move is in progress. However, existing resources remain fully operational. For instance, if you move a virtual machine (VM) from one resource group to another, the VM can't be deleted, and its properties (such as VM size) can't be modified during the move. Despite this, the VM continues to operate normally, and services relying on it will not experience any additional downtime. The lock can last up to four hours, but most moves are completed much faster, and the lock is removed accordingly.
16+
During the move operation, both the source and target resource groups are locked. This means you can't create, delete, or update resources within these resource groups while the move is in progress. However, existing resources remain fully operational. For instance, if you move a virtual machine (VM) from one resource group to another, the VM can't be deleted, and its properties (such as VM size) can't be modified during the move. Despite this, the VM continues to operate normally, and services relying on it will not experience any additional downtime. The lock can last up to four hours, but most moves are completed faster, and the lock is removed accordingly.
1717

18-
Only top-level (parent) resources should be specified in the move request. Child resources are automatically moved along with their parent but cannot be moved independently. For example, a parent resource like `Microsoft.Compute/virtualMachines` can be moved, and its child resource, such as `Microsoft.Compute/virtualMachines/extensions`, will be moved with it. However, the child resource cannot be moved on its own.
18+
Only top-level (parent) resources should be specified in the move request. Child resources are automatically moved along with their parent but can't be moved independently. For example, a parent resource like `Microsoft.Compute/virtualMachines` can be moved, and its child resource, such as `Microsoft.Compute/virtualMachines/extensions`, will be moved with it. However, the child resource can't be moved on its own.
1919

20-
While moving a resource preserves its dependencies with child resources, dependencies with other resources may break and require reconfiguration. Note that moving a resource only changes its associated resource group, it does not alter the physical region of the resource.
20+
While moving a resource preserves its dependencies with child resources, dependencies with other resources may break and require reconfiguration. Moving a resource only changes its associated resource group, it doesn't alter the physical region of the resource.
2121

2222
> [!NOTE]
2323
> Azure resources can't be moved if a read-only lock exists on the source or destination resource group or subscription.
@@ -128,7 +128,9 @@ For illustration purposes, we have only one dependent resource.
128128
* Step 2: Move the resource and dependent resources together from the source subscription to the target subscription.
129129
* Step 3: Optionally, redistribute the dependent resources to different resource groups within the target subscription.
130130

131-
## Use the portal
131+
## Move resources
132+
133+
### Use the portal
132134

133135
To move resources, select the resource group that contains those resources.
134136

@@ -166,9 +168,9 @@ When the move has completed, you're notified of the result.
166168

167169
:::image type="content" source="./media/move-resource-group-and-subscription/view-notification.png" alt-text="Screenshot of the Azure portal displaying a notification with the results of the move operation.":::
168170

169-
## Use Azure PowerShell
171+
### Use Azure PowerShell
170172

171-
### Validate
173+
#### Validate
172174

173175
To test your move scenario without actually moving the resources, use the [Invoke-AzResourceAction](/powershell/module/az.resources/invoke-azresourceaction) command. Use this command only when you need to predetermine the results.
174176

@@ -194,7 +196,7 @@ If validation passes, you see no output.
194196

195197
If validation fails, you see an error message describing why the resources can't be moved.
196198

197-
### Move
199+
#### Move
198200

199201
To move existing resources to another resource group or subscription, use the [Move-AzResource](/powershell/module/az.resources/move-azresource) command. The following example shows how to move several resources to a new resource group.
200202

@@ -210,9 +212,9 @@ Move-AzResource -DestinationResourceGroupName $destinationName -ResourceId $reso
210212

211213
To move to a new subscription, include a value for the `DestinationSubscriptionId` parameter.
212214

213-
## Use Azure CLI
215+
### Use Azure CLI
214216

215-
### Validate
217+
#### Validate
216218

217219
To test your move scenario without actually moving the resources, use the [az resource invoke-action](/cli/azure/resource#az-resource-invoke-action) command. Use this command only when you need to predetermine the results. To run this operation, you need the:
218220

@@ -236,7 +238,7 @@ If validation passes, you see:
236238

237239
If validation fails, you see an error message describing why the resources can't be moved.
238240

239-
### Move
241+
#### Move
240242

241243
To move existing resources to another resource group or subscription, use the [az resource move](/cli/azure/resource#az-resource-move) command. In the `--ids` parameter, provide a space-separated list of the resource IDs to move.
242244

@@ -258,9 +260,9 @@ az resource move --destination-group newgroup --ids $webapp $plan
258260

259261
To move to a new subscription, provide the `--destination-subscription-id` parameter.
260262

261-
## Use Python
263+
### Use Python
262264

263-
### Validate
265+
#### Validate
264266

265267
To test your move scenario without actually moving the resources, use the [ResourceManagementClient.resources.begin_validate_move_resources](/python/api/azure-mgmt-resource/azure.mgmt.resource.resources.v2022_09_01.operations.resourcesoperations#azure-mgmt-resource-resources-v2022-09-01-operations-resourcesoperations-begin-validate-move-resources) method. Use this method only when you need to predetermine the results.
266268

@@ -302,7 +304,7 @@ If validation passes, you see no output.
302304

303305
If validation fails, you see an error message describing why the resources can't be moved.
304306

305-
### Move
307+
#### Move
306308

307309
To move existing resources to another resource group or subscription, use the [ResourceManagementClient.resources.begin_move_resources](/python/api/azure-mgmt-resource/azure.mgmt.resource.resources.v2022_09_01.operations.resourcesoperations#azure-mgmt-resource-resources-v2022-09-01-operations-resourcesoperations-begin-move-resources) method. The following example shows how to move several resources to a new resource group.
308310

@@ -338,9 +340,9 @@ resource_client.resources.begin_move_resources(
338340
)
339341
```
340342

341-
## Use REST API
343+
### Use REST API
342344

343-
### Validate
345+
#### Validate
344346

345347
The [validate move operation](/rest/api/resources/resources/validate-move-resources) lets you test your move scenario without actually moving the resources. Use this operation to check if the move succeeds. Validation is automatically called when you send a move request. Use this operation only when you need to predetermine the results. To run this operation, you need the:
346348

@@ -393,7 +395,7 @@ While the operation is still running, you continue to receive the 202 status cod
393395
{"error":{"code":"ResourceMoveProviderValidationFailed","message":"<message>"...}}
394396
```
395397

396-
### Move
398+
#### Move
397399

398400
To move existing resources to another resource group or subscription, use the [Move resources](/rest/api/resources/resources/moveresources) operation.
399401

@@ -412,19 +414,19 @@ In the request body, you specify the target resource group and the resources to
412414

413415
## Frequently asked questions
414416

415-
### My resource move operation, which usually takes a few minutes, has been running for almost an hour. Is there something wrong?
417+
**My resource move operation, which usually takes a few minutes, has been running for almost an hour. Is there something wrong?**
416418

417419
Moving a resource is a complex operation that has different phases. It can involve more than just the resource provider of the resource you're trying to move. Because of the dependencies between resource providers, Azure Resource Manager allows 4 hours for the operation to complete. This time period gives resource providers a chance to recover from transient issues. If your move request is within the four-hour period, the operation keeps trying to complete and may still succeed. The source and destination resource groups are locked during this time to avoid consistency issues.
418420

419-
### Why is my resource group locked for four hours during resource move?
421+
**Why is my resource group locked for four hours during resource move?**
420422

421423
A move request is allowed a maximum of four hours to complete. To prevent modifications on the resources being moved, both the source and destination resource groups are locked during the resource move.
422424

423425
There are two phases in a move request. In the first phase, the resource is moved. In the second phase, notifications are sent to other resource providers that are dependent on the resource being moved. A resource group can be locked for the entire four hours when a resource provider fails either phase. During the allowed time, Resource Manager retries the failed step.
424426

425427
If a resource can't be moved within four hours, Resource Manager unlocks both resource groups. Resources that were successfully moved are in the destination resource group. Resources that failed to move are left the source resource group.
426428

427-
### What are the implications of the source and destination resource groups being locked during the resource move?
429+
**What are the implications of the source and destination resource groups being locked during the resource move?**
428430

429431
The lock prevents you from deleting either resource group. Secondly, within each resource group, the lock prevents you from creating a new resource, deleting a resource, or updating a resource’s properties (for example, changing the size of a VM).
430432

@@ -436,9 +438,9 @@ In the image below, the VM resource belongs to a resource group ("TestB") that i
436438

437439
:::image type="content" source="./media/move-resource-group-and-subscription/move-error-delete-2.png" alt-text="Screenshot of the Azure portal showing an error message when a user tries to update a property (VM size) of the VM.":::
438440

439-
Additionally, during a resource move, neither the source nor the destination resource group can participate in other move operations simultaneously. For example, if resources are being moved from Resource Group A to Resource Group B, neither Group A nor Group B can be involved in another move operation, such as moving resources to or from Resource Group C, at the same time. This restriction ensures that resource groups are not locked by multiple conflicting operations during the move process.
441+
Additionally, during a resource move, neither the source nor the destination resource group can participate in other move operations simultaneously. For example, if resources are being moved from Resource Group A to Resource Group B, neither Group A nor Group B can be involved in another move operation, such as moving resources to or from Resource Group C, at the same time. This restriction ensures that resource groups aren't locked by multiple conflicting operations during the move process.
440442

441-
### What does the error code "MissingMoveDependentResources" mean?
443+
**What does the error code "MissingMoveDependentResources" mean?**
442444

443445
When you move a resource, its dependent resources must either exist in the destination resource group or subscription, or be included in the move request. You get the MissingMoveDependentResources error code when a dependent resource doesn't meet this requirement. The error message has details about the dependent resource that needs to be included in the move request.
444446

@@ -459,29 +461,29 @@ For example, moving a virtual machine could require moving seven resource types
459461
Another common example involves moving a virtual network. You may have to move several other resources associated with that virtual network. The move request could require moving public IP addresses, route tables, virtual network gateways, network security groups, and others.
460462
In general, a virtual network gateway must always be in the same resource group as its virtual network, they can't be moved separately.
461463

462-
### What does the error code "RequestDisallowedByPolicy" mean?
464+
**What does the error code "RequestDisallowedByPolicy" mean?**
463465

464466
Resource Manager validates your move request before attempting the move. This validation includes checking policies defined on the resources involved in the move. For example, if you're attempting to move a key vault but your organization has a policy to deny the creation of a key vault in the target resource group, validation fails and the move is blocked. The returned error code is **RequestDisallowedByPolicy**.
465467

466468
For more information about policies, see [What is Azure Policy?](../../governance/policy/overview.md).
467469

468-
### Why can't I move some resources in Azure?
470+
**Why can't I move some resources in Azure?**
469471

470472
Currently, not all resources in Azure support move. For a list of resources that support move, see [Move operation support for resources](move-support-resources.md).
471473

472-
### How many resources can I move in a single operation?
474+
**How many resources can I move in a single operation?**
473475

474476
When possible, break large moves into separate move operations. Resource Manager immediately returns an error when there are more than 800 resources in a single operation. However, moving less than 800 resources may also fail by timing out.
475477

476-
### What is the meaning of the error that a resource isn't in succeeded state?
478+
**What is the meaning of the error that a resource isn't in succeeded state?**
477479

478480
When you get an error message that indicates a resource can't be moved because it isn't in a succeeded state, it may actually be a dependent resource that is blocking the move. Typically, the error code is **MoveCannotProceedWithResourcesNotInSucceededState**.
479481

480482
If the source or target resource group contains a virtual network, the states of all dependent resources for the virtual network are checked during the move. The check includes those resources directly and indirectly dependent on the virtual network. If any of those resources are in a failed state, the move is blocked. For example, if a virtual machine that uses the virtual network has failed, the move is blocked. The move is blocked even when the virtual machine isn't one of the resources being moved and isn't in one of the resource groups for the move.
481483

482484
When you receive this error, you have two options. Either move your resources to a resource group that doesn't have a virtual network, or [contact support](/azure/azure-portal/supportability/how-to-create-azure-support-request).
483485

484-
### Can I move a resource group to a different subscription?
486+
**Can I move a resource group to a different subscription?**
485487

486488
No, you can't move a resource group to a new subscription. But, you can move all of the resources in the resource group to a resource group in another subscription. Settings such as tags, role assignments, and policies aren't automatically transferred from the original resource group to the destination resource group. You need to reapply these settings to the new resource group. For more information, see [Move resources to new resource group or subscription](./move-support-resources.md).
487489

0 commit comments

Comments
 (0)