This project provides automation scripts for setting up and managing an Azure Migrate lab environment, focusing on automating the migration process for VMware, Hyper-V, or physical servers (including AWS/GCP EC2 instances) to Azure.
Before using these scripts, ensure you have the following prerequisites:
-
Azure CLI: Install the Azure CLI by following the official documentation
# macOS (using Homebrew) brew update && brew install azure-cli # Ubuntu/Debian curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash # Windows # Download and run the MSI installer from: https://aka.ms/installazurecliwindows
-
Azure Subscription: You need an active Azure subscription with sufficient permissions to create resources.
-
Source Environment: Access to one of the following environments:
- VMware vSphere
- Microsoft Hyper-V
- AWS EC2 instances (discovered using the Physical server method)
- GCP instances (discovered using the Physical server method)
- On-premises physical servers
-
Appliance Server Requirements (for Physical/AWS/GCP discovery):
- Windows Server 2022 (recommended) or Windows Server 2019
- 16 GB RAM, 8 vCPUs, approximately 80 GB of disk storage
- Static or dynamic IP address with internet access (direct or via proxy)
- Outbound internet connectivity to required Azure endpoints
-
Copy the environment template file to create a local configuration:
cp config/env.template .env
-
Edit the
.env
file and provide your specific configuration values:SUBSCRIPTION_ID
: Your Azure Subscription IDRESOURCE_GROUP
: Name for the resource group (default: AzureMigrateLab-RG)LOCATION
: Azure region for deployment (default: eastus)MIGRATE_PROJECT_NAME
: Name for your Azure Migrate projectVNET_NAME
: Name for the target virtual networkVNET_ADDRESS_PREFIX
: Address space for the virtual networkSUBNET_NAME
: Name for the target subnetSUBNET_ADDRESS_PREFIX
: Address range for the subnetSOURCE_TYPE
: Type of source environment (VMware, Hyper-V, or Physical)- Use "Physical" for AWS EC2 instances, GCP VMs, or on-premises physical servers
Run the following script to create an Azure Migrate project and the necessary infrastructure:
# Make the script executable
chmod +x scripts/create-migrate-project.sh
# Run with default values from .env file
./scripts/create-migrate-project.sh
# OR specify parameters directly
./scripts/create-migrate-project.sh \
--subscription-id "your-subscription-id" \
--resource-group "YourResourceGroup" \
--location "westus2" \
--project-name "YourMigrateProject" \
--vnet-name "YourVNet" \
--vnet-prefix "10.1.0.0/16" \
--subnet-name "YourSubnet" \
--subnet-prefix "10.1.0.0/24" \
--source-type "Physical" # Use "Physical" for AWS EC2 instances
This script performs the following actions:
- Logs in to Azure (if not already logged in)
- Sets the subscription context
- Creates a resource group (if it doesn't exist)
- Creates an Azure Migrate project using ARM templates
- Includes assessment and migration solution components
- Creates a virtual network and subnet for the target environment
- Provides information about the next steps
After running the create-migrate-project script, follow these steps to import server inventory via CSV:
-
Access the Azure Migrate Project:
- Use the portal URL provided by the script. The URL follows this format:
portal.azure.com/#view/Microsoft_Azure_Migrate/AmhResourceMenuBlade/~/serverGoal/resourceId/%2Fsubscriptions%2F{SUBSCRIPTION_ID}%2FresourceGroups%2F{RESOURCE_GROUP}%2Fproviders%2FMicrosoft.Migrate%2FMigrateProjects%2F{MIGRATE_PROJECT_NAME}
Where:
{SUBSCRIPTION_ID}
: Your Azure Subscription ID{RESOURCE_GROUP}
: Your Resource Group name{MIGRATE_PROJECT_NAME}
: Your Azure Migrate project name
-
Add Assessment Tool:
- In the Azure Migrate project page, find the "Add more assessment tools?" question
- Click "Click here" to add a new assessment tool
- Select "Azure Migrate: Discovery and assessment"
-
Import Server Inventory:
- In "Migration goals" > "Servers, databases and web apps" > "Azure Migrate: Discovery and assessment", select "Discover"
- Choose "Server Inventory (CSV)" as the File type
- In step 3 of the wizard, import the sample CSV file from
./samples/AzureMigrateimporttemplate.csv
-
View Imported Servers:
- Return to the Azure Migrate project
- Navigate to "Migration Goals" > "Servers, databases and web apps"
- Under "Azure Migrate: Discovery and assessment", you should see 10 servers that were imported
- Click the "10" to see the detailed list of imported servers under the "Import based" tab