Migrate Azure AD PowerShell scripts to Microsoft Graph

Published · Updated

Save

Map each legacy AzureAD or MSOnline cmdlet to its supported Graph equivalent, then verify permissions and returned properties. The migration is a behavior change for the script, even when the command names look similar.

Inventory actual usage

List read operations, writes and exported fields separately. Identify the tenant and whether the existing job signs in interactively or runs unattended. Use Microsoft's mapping to find the corresponding Graph cmdlets and mark operations without direct equivalents.

Test an equivalent read

For a user lookup, start with Get-MgUser -UserId using the intended identifier in a test tenant. Select the properties needed by the report explicitly. Compare user IDs, null values, filters and pagination with a trusted baseline.

Migrate writes separately

Choose the documented delegated or application permissions for the operation and test least privilege. Keep authentication and secrets in the approved deployment configuration. Stage any write in a test tenant before moving production automation.

References

Microsoft Graph PowerShell migration guide

AzureAD and MSOnline cmdlet map

Discuss this answer