Overview
The Azure PowerShell Migration Module provides a set of cmdlets to help you transition resources and configurations from older Azure PowerShell versions to the latest Az module. It automates common migration tasks, validates compatibility, and offers remediation guidance.
Description
Features
This module is designed for administrators, DevOps engineers, and developers who need to upgrade scripts and automation pipelines without service interruption.
- Automated cmdlet mapping from
AzureRMtoAz - Resource compatibility checks
- Bulk migration support for ARM templates
- Detailed migration reports
- Rollback capabilities
Prerequisites
- PowerShell 7.x or later
- Azure PowerShell Az module
Install-Module -Name Az -AllowClobber -Scope CurrentUser - Administrator privileges on the machine
- An active Azure subscription
Installation
Install the migration module from the PowerShell Gallery:
Install-Module -Name Az.Migration -Repository PSGallery -Scope CurrentUser
After installation, import the module:
Import-Module Az.Migration
Cmdlet Reference
| Cmdlet | Description |
|---|---|
Start-AzMigration |
Initiates a migration session for a given scope. |
Get-AzMigrationReport |
Retrieves the detailed migration report. |
Invoke-AzMigrationRemediation |
Applies suggested remediation steps. |
Export-AzMigrationTemplate |
Exports an ARM template compatible with the Az module. |
Reset-AzMigrationSession |
Rolls back a migration session to its original state. |
Examples
1. Migrate a Resource Group
# Start migration
$session = Start-AzMigration -ResourceGroupName "MyRG"
# Review the report
Get-AzMigrationReport -SessionId $session.Id
# Apply remediation
Invoke-AzMigrationRemediation -SessionId $session.Id
2. Export a Migration‑Ready Template
Export-AzMigrationTemplate -ResourceGroupName "MyRG" -OutputPath "C:\Templates\MyRG-Az.json"
Migration Guide
- Assess: Run
Start-AzMigrationwith the-WhatIfflag to see potential changes. - Plan: Review the generated
Get-AzMigrationReportfor compatibility issues. - Execute: Apply remediation with
Invoke-AzMigrationRemediation. - Validate: Test the migrated scripts in a non‑production environment.
- Rollback (if needed): Use
Reset-AzMigrationSessionto revert changes.