How to set Microsoft Entra ID users' photos using Set-MgUserPhotoContent

Setting Microsoft Entra ID users' photos

Adding user photos in Microsoft Entra ID makes it easier to recognize colleagues, improves teamwork, and collaboration across Microsoft 365 apps. It also helps IT teams manage users and enhances security. Additionally, ADManager Plus, an IGA solution with Microsoft 365 management and reporting capabilities allows admins to set up user photos instantly with its smart templates. While both ADManager Plus and Graph PowerShell can be used to update users' photos, ADManager Plus stands apart with its intuitive and script-free interface, allowing administrators to effortlessly update and manage user photos in bulk without using scripts. Its user-friendly design eliminates the need for complex scripting, making it the ideal choice for organizations seeking a streamlined and efficient solution.

  • ADManager Plus
  • PowerShell
 

Configure Microsoft Entra ID users' photos using ADManager Plus

  1. Log in to ADManager Plus and navigate to Management tab.
  2. In the User Management tab, under User Templates, click > User Creation Templates.
  3. Click +Create New Template.
  4. Provide a name and description for the template.
  5. Select the domain where this template must be used in the Select Domain field.
  6. Select the Microsoft 365 checkbox.
  7. Click the Enable Drag-and-drop button.
  8. Drag and drop the User Photo field from the General section of the Field Tray onto the Microsoft 365 tab.
  9. In the Edit User Photo pop up, enter the Field Name, select the Photo Attribute type, and make the field Mandatory, if required, and click Done.
  10. Click Save Template to save this template.
  11. While creating Entra ID user(s), apply this template and upload the user photo.
Set Microsoft Entra ID users photos using ADManager Plus' smart templates
 
 

Modify the template to add or remove fields as needed

 
 

Holds attributes that you can easily drag and drop.

 
 

Click the Edit icon to make this field mandatory.

Set Microsoft Entra ID users' photos using Microsoft Graph PowerShell

Prerequisites

Before using the Set-MgUserPhotoContent cmdlet, ensure the following:

  • The Microsoft Graph PowerShell module is installed. If not, install it using this script:
    Install-Module Microsoft.Graph -Scope CurrentUser
  • Connect to Microsoft Graph PowerShell with the required permissions to set Microsoft Entra ID users' photos.
    Connect-MgGraph -Scopes "User.ReadWrite.All"

Using the Set-MgUserPhotoContent command

The Set-MgUserPhotoContent cmdlet can be used in Microsoft Graph PowerShell to configure Microsoft Entra ID users' photos. Here's the syntax:

Set-MgUserPhotoContent
-UserId <String>
[-Data <Stream>]
[-ResponseHeadersVariable <String>]
-InFile <String>
[-ContentType <String>]
[-Headers <IDictionary>]
[-PassThru]
[-ProgressAction <ActionPreference>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]

Example: Uploading a user photo

Set-MgUserPhotoContent -UserId user@yourdomain.com -InFile C:\Photos\userphoto.jpg

Supported parameters

The following are some essential parameters that can be used along with the Set-MgUserPhotoContent command:

Parameters Description
-UserId This parameter is used to specify the UserPrincipalName or Object ID of the user whose photo you want to update.
-InFile This parameter defines the local file path of the image to be uploaded.
-Confirm This parameter helps prevent accidental changes by prompting for confirmation before executing the command
-WhatIf This parameter simulates the command without executing it.

Limitations of using Graph PowerShell scripts to set users photos in Entra ID

  • Graph PowerShell requires admins to be familiar with scripting, PowerShell commands, and the Graph API to execute commands.
  • Large-scale updates may be throttled or temporarily blocked, affecting bulk operations.
  • Graph PowerShell lacks an intuitive interface, making photo management less user-friendly.
  • There is no built-in status indicator for uploads, making it difficult to track success or failure.

Benefits of using ADManager Plus to set photos for Microsoft Entra ID users

  • Provides an intuitive interface for easy photo management, eliminating the need for PowerShell scripting.
  • Photos can be uploaded in a few clicks, reducing manual efforts.
  • Provides a status update after uploads, unlike Graph PowerShell which requires an extra parameter.

In addition to managing users, ADManager Plus also provides comprehensive management capabilities for various Microsoft Entra ID (formerly Azure AD) entities, including contacts, groups, and mailboxes. It also offers a wide range of Micrsosft Entra ID reports that provide valuable insights into Entra ID objects and activities. These reports help administrators track user logins, group memberships, inactive accounts, license assignments, and more.

Upload Entra ID user photos using ADManager Plus

 
  • Setting Microsoft Entra ID users' photo
  • Configuring Microsoft Entra ID users' photos using ADManager Plus
  • Set Microsoft Entra ID users' photo using Microsoft Graph PowerShell
  • Limitations of using Graph PowerShell scripts to manage Microsoft Entra ID users
  • Highlights of using ADManager Plus to manage Microsoft Entra ID users
The one-stop solution to Active Directory Management and Reporting
Email Download Link