Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Execute Commit-AzResourceMoverMove via PowerShell on Windows

In this article, we will explore how to execute the Commit-AzResourceMoverMove cmdlet using PowerShell on a Windows environment. This cmdlet is part of the Azure Resource Mover service, which allows you to move resources across Azure regions. The Commit-AzResourceMoverMove cmdlet finalizes the move of resources that have been prepared and initiated.

Examples:

  1. Prerequisites:

    Before you can use the Commit-AzResourceMoverMove cmdlet, ensure that you have the Azure PowerShell module installed. You can install it using the following command:

    Install-Module -Name Az -AllowClobber -Force

    Also, make sure you are authenticated to your Azure account:

    Connect-AzAccount
  2. Preparing the Move:

    To commit a move, you must first have a move collection and move resources prepared. Here’s how you can prepare a move:

    # Create a new move collection
    $moveCollection = New-AzResourceMoverMoveCollection -ResourceGroupName "MyResourceGroup" -Name "MyMoveCollection" -TargetRegion "EastUS"
    
    # Add resources to the move collection
    $moveResource = New-AzResourceMoverMoveResource -ResourceId "/subscriptions/{subscription-id}/resourceGroups/{source-rg}/providers/Microsoft.Compute/virtualMachines/{vm-name}" -MoveCollection $moveCollection
    
    # Initiate the move
    Start-AzResourceMoverMove -MoveCollection $moveCollection
  3. Committing the Move:

    After the move has been prepared and initiated, you can commit the move using the Commit-AzResourceMoverMove cmdlet:

    # Commit the move
    Commit-AzResourceMoverMove -MoveCollection $moveCollection

    This command will finalize the move of the resources to the target region specified in the move collection.

  4. Verifying the Move:

    To ensure that the resources have been moved successfully, you can check the status of the move collection:

    # Get the move collection
    $moveCollectionStatus = Get-AzResourceMoverMoveCollection -ResourceGroupName "MyResourceGroup" -Name "MyMoveCollection"
    
    # Check the status
    $moveCollectionStatus.Status

    The status should indicate that the move has been completed.

By following these steps, you can successfully execute the Commit-AzResourceMoverMove cmdlet in a Windows environment using PowerShell, ensuring that your Azure resources are moved to the desired region.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.