|
2 | 2 | title: Move resources to a new subscription or resource group
|
3 | 3 | description: Use Azure Resource Manager to move resources to a new resource group or subscription.
|
4 | 4 | ms.topic: conceptual
|
5 |
| -ms.date: 08/15/2022 |
| 5 | +ms.date: 11/04/2022 |
6 | 6 | ms.custom: devx-track-azurecli, devx-track-azurepowershell
|
7 | 7 | ---
|
8 | 8 |
|
@@ -219,14 +219,24 @@ If validation fails, you see an error message describing why the resources can't
|
219 | 219 |
|
220 | 220 | ### Move
|
221 | 221 |
|
222 |
| -To move existing resources to another resource group or subscription, use the [az resource move](/cli/azure/resource#az-resource-move) command. Provide the resource IDs of the resources to move. The following example shows how to move several resources to a new resource group. In the `--ids` parameter, provide a space-separated list of the resource IDs to move. |
| 222 | +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. |
| 223 | + |
| 224 | +The following example shows how to move several resources to a new resource group. It works when using Azure CLI in a **Bash** terminal. |
223 | 225 |
|
224 | 226 | ```azurecli
|
225 | 227 | webapp=$(az resource show -g OldRG -n ExampleSite --resource-type "Microsoft.Web/sites" --query id --output tsv)
|
226 | 228 | plan=$(az resource show -g OldRG -n ExamplePlan --resource-type "Microsoft.Web/serverfarms" --query id --output tsv)
|
227 | 229 | az resource move --destination-group newgroup --ids $webapp $plan
|
228 | 230 | ```
|
229 | 231 |
|
| 232 | +The next example shows how to run the same commands in a **PowerShell** console. |
| 233 | + |
| 234 | +```azurecli |
| 235 | +$webapp=$(az resource show -g OldRG -n ExampleSite --resource-type "Microsoft.Web/sites" --query id --output tsv) |
| 236 | +$plan=$(az resource show -g OldRG -n ExamplePlan --resource-type "Microsoft.Web/serverfarms" --query id --output tsv) |
| 237 | +az resource move --destination-group newgroup --ids $webapp $plan |
| 238 | +``` |
| 239 | + |
230 | 240 | To move to a new subscription, provide the `--destination-subscription-id` parameter.
|
231 | 241 |
|
232 | 242 | ## Use REST API
|
@@ -325,7 +335,7 @@ The following image shows an error message from the Azure portal when a user tri
|
325 | 335 |
|
326 | 336 | **Question: What does the error code "MissingMoveDependentResources" mean?**
|
327 | 337 |
|
328 |
| -When moving 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. |
| 338 | +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. |
329 | 339 |
|
330 | 340 | For example, moving a virtual machine could require moving seven resource types with three different resource providers. Those resource providers and types are:
|
331 | 341 |
|
|
0 commit comments