How to migrate using automated scripts?

Muniraj Devaraj 0 Reputation points
2025-01-06T07:35:51.3166667+00:00

How to migrate using automated scripts? I have gone through the manual steps but I want automated scripts to do it for generic all clients.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,331 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Pinaki Ghatak 5,565 Reputation points Microsoft Employee
    2025-01-06T09:11:43.5+00:00

    Hello @Muniraj Devaraj

    To migrate a large number of virtual machines (VMs) using automated scripts, you can use Azure Site Recovery. Site Recovery scripts are available for download at the Azure PowerShell Samples repo on GitHub.

    The scripts can be used to migrate VMware, AWS, GCP VMs, and physical servers to managed disks in Azure. You can also use these scripts to migrate Hyper-V VMs if you migrate the VMs as physical servers.

    To get started, you need to complete the following prerequisites:

    • Ensure that the Site Recovery vault is created in your Azure subscription.
    • Ensure that the Configuration Server and Process Server are installed in the source environment and the vault can discover the environment.
    • Ensure that a Replication Policy is created and associated with the Configuration Server. - Ensure that you have added the VM admin account to the config server (that will be used to replicate the on premises VMs).
    • Ensure that the following target artifacts in Azure are created:
    • Target Resource Group
    • Cache Storage Account (and its Resource Group)
    • Create a standard storage account in the same region as the vault
    • Target Virtual Network for failover (and its Resource Group)
    • Target Subnet
    • Target Virtual Network for Test failover (and its Resource Group)
    • Availability Set (if needed)
    • Target Network Security Group and its Resource Group

    Once you have completed all the prerequisites, you need to create a CSV file that has data of each source VM that you want to migrate. All the scripts are designed to work on the same CSV file. A sample CSV template is available in the scripts folder for your reference. Once the CSV is ready, you can execute the following steps to perform migration of the on-premises VMs:

    1. asr_startmigration.ps1: Enable replications for all the VMs listed in the csv, the script creates a CSV output with the job details for each VM
    2. asr_replicationstatus.ps1: Check the status of replication, the script creates a csv with the status for each VM
    3. asr_updateproperties.ps1: Once the VMs are replicated/protected, use this script to update the target properties of the VM (Compute and Network properties)
    4. asr_propertiescheck.ps1: Verify if the properties are appropriately updated
    5. asr_testmigration.ps1: Start the test failover of the VMs listed in the csv, the script creates a CSV output.

    I hope that this response has addressed your query and helped you overcome your challenges. If so, please mark this response as Answered. This will not only acknowledge our efforts but also assist other community members who may be looking for similar solutions.


  2. Khadeer Ali 2,285 Reputation points Microsoft Vendor
    2025-01-06T14:26:26.8533333+00:00

    @Muniraj Devaraj ,

    You are absolutely correct that Microsoft strongly advises migrating from Azure Functions Proxies to Azure API Management (APIM) for comprehensive API lifecycle management.

    To assist with this migration, you can use an OpenAPI (Swagger) specification to define your existing API routes and configurations. Once the OpenAPI file is prepared, it can be imported into APIM using Azure CLI or Azure Portal.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.