Deprecation of Exchange Online PowerShell UserPhoto cmdlets
Published Oct 16 2023 06:42 AM 23K Views

As announced via Message Center (MC678855) on the 2nd October 2023, we are deprecating the Exchange Online PowerShell UserPhoto cmdlets and transitioning customers to the Microsoft Graph PowerShell SDK.  This deprecation is a part of a broader initiative to streamline a coherent user profile image experience by consolidating user profile photo requests to the Microsoft Graph service, allowing a more reliable profile photo experience, addressing issues with inconsistent sizes and formats, and enabling faster refresh of profile photos across the Microsoft 365 product suite.

Starting in April 2024, tenant admins will no longer be able to use the Exchange Online PowerShell UserPhoto cmdlets to Get, Set, and Remove user profile photos. Note that these cmdlets will remain functional in Exchange Server (on-premises).

Tenant admins can perform the same actions through the Microsoft Graph PowerShell SDK to Get, Set, and Remove user profile photos, or alternatively can administer the user photos through Azure Active Directory or the Microsoft 365 admin center as detailed in this article.

Refer to the table below, containing both Exchange Online PowerShell and Microsoft Graph cmdlets to locate the ones you need in Microsoft Graph PowerShell SDK.

Exchange Online cmdlet you might use today

Microsoft Graph cmdlet you should start using

Microsoft Graph cmdlet notes

Import-Module ExchangeOnlineManagement

Install-Module Microsoft.Graph

Documentation

Connect-ExchangeOnline -UserPrincipalName <userId>

Connect-MgGraph

For authentication info see documentation

Set-UserPhoto -Identity <userId> -PictureData <pictureData>

Set-MgUserPhotoContent -UserId <userId> -InFile <inFile>

UserId: OID/SMTP/UPN

Permissions: owner calls (User.ReadWrite), non-owner calls (User.ReadWrite.All)

InFile: string path to the file to upload

Documentation

Set-UserPhoto -Identity <groupId> -PictureData <pictureData> -GroupMailbox

Set-MgGroupPhotoContent -GroupId <groupId> -InFile <inFile>

GroupId: OID

Permissions: owner calls (Group.ReadWrite), non-owner calls (Group.ReadWrite.All)

InFile: string path to the file to upload

Documentation

Get-UserPhoto -Identity <userId>

Get-MgUserPhoto -UserId <id>

UserId: OID/SMTP/UPN

Permissions: owner calls (User.Read), non-owner calls (User.Read.All)

Documentation

Get-UserPhoto -Identity <userId> -GroupMailbox

Get-MgGroupPhoto -GroupId <id>

GroupId: OID

Permissions: owner calls (Group.Read), non-owner calls (Group.Read.All)

Documentation

$pict = Get-UserPhoto <userId>

$pict.PictureData | Set-Content <outFileId> -Encoding byte

Get-MgUserPhotoContent -UserId <id> -OutFile <outFileId>

UserId: OID/SMTP/UPN

Permissions: owner calls (User.Read), non-owner calls (User.Read.All)

OutFile: string path to the file, which image will be saved to

Documentation

$pict = Get-UserPhoto <userId> -GroupMailbox

$pict.PictureData | Set-Content <outFileId> -Encoding byte

Get-MgGroupPhotoContent -GroupId <id> -OutFile <outFileId>

GroupId: OID

Permissions: owner calls (Group.Read), non-owner calls (Group.Read.All)

OutFile: string path to the file, which image will be saved to

Documentation

Remove-UserPhoto -Identity <userId>

Remove-MgUserPhoto -UserId <id>

UserId: OID/SMTP/UPN

Permissions: owner calls (User.ReadWrite), non-owner calls (User.ReadWrite.All)

Documentation

Remove-UserPhoto -Identity <userId> -GroupMailbox

Remove-MgGroupPhoto -GroupId <id>

GroupId: OID

Permissions: owner calls (Group.ReadWrite), non-owner calls (Group.ReadWrite.All)

Documentation

We appreciate your patience as we work towards ensuring a unified profile photo experience are here to assist you through this transition. Reach out to the team at profile-photo-pm@microsoft.com with any feedback around this change.

Microsoft 365 Profile Photo Team

9 Comments
Co-Authors
Version history
Last update:
‎Oct 16 2023 06:42 AM
Updated by: