Blog/Automation

A daily migration status report with Azure Automation

Run the in-progress report every morning with a managed identity, with no stored password, and send it to the project channel.

AutomationMigrations
Azure AutomationExchange OnlineTeam1Schedule 09:00Daily2Managed identityNo password3Read migration usersStatus, errors4Build CSVSplit by status5Report deliveredChannel or email

Before you start

RequirementWhy
Azure Automation account with PowerShell 7.4 runtimeRuns the script on a schedule.
System-assigned managed identitySigns in without a stored password.
Exchange.ManageAsApp permission and an Exchange role for the identityLets the identity read migration batches.
ExchangeOnlineManagement module in the runtimeProvides Connect-ExchangeOnline.
  1. 1

    Turn on the managed identity

    Azure

    On the Automation account, switch the system-assigned identity on and note its object ID.

  2. 2

    Grant Exchange access

    Target

    Give the identity the Exchange.ManageAsApp application permission on Office 365 Exchange Online, and assign it an Exchange admin role in Entra ID.

  3. 3

    Write the runbook

    Azure

    Connect with the managed identity, read every user in the batch, and export the result.

    PowerShell · Azure
    Connect-ExchangeOnline -ManagedIdentity -Organization "harbor.onmicrosoft.com"
    $rows = Get-MigrationUser -BatchId $BatchName -ResultSize Unlimited | ForEach-Object {
      Get-MigrationUserStatistics $_.Identity | Select Identity, Status, PercentageComplete, ErrorSummary }
    $rows | Export-Csv "$env:TEMP\status.csv" -NoTypeInformation
  4. 4

    Schedule and deliver

    Azure

    Link a daily schedule, then send the CSV to the project channel or mailbox.

    Expected result: The report arrives at 09:00 with a row per user.

Get the next guide by email

The Cutover is a monthly email with new guides and what we learned on recent waves.

Related

GuideMigrationsExchange

Cross-tenant mailbox migration, end to end

The native Exchange Online path from trust setup to cutover, with every step, the PowerShell behind it and the checks that stop a wave failing on the night.

24 Nov 202618 min read
GuideMigrationsSharePoint & OneDrive

Moving OneDrive between tenants with the native tool

Trust, identity map, the move itself and the one rule that decides whether a user goes native or to a third-party tool.

17 Nov 202614 min read
GuideMigrationsIntune

Device migration between tenants: three paths and when to use each

There is no native button to move an Intune device to another tenant. How to choose between a reset, an Autopilot re-registration and a profile move, and the exact steps for each.

10 Nov 202612 min read