Uredi

Deli z drugimi prek


Change user profile photos and settings

Check out Microsoft 365 small business help on YouTube.

This article explains how to manage profile photos and photo update settings on user accounts and Microsoft 365 Groups.

Tip

If you need help with the steps in this article, consider working with a Microsoft small business specialist. With Business Assist, you and your employees get around-the-clock access to small business specialists as you grow your business, from onboarding to everyday use.

Before you begin

You must be a Global Administrator to complete these steps.

Important

Microsoft recommends that you use roles with the fewest permissions. Using lower permissioned accounts helps improve security for your organization. Global Administrator is a highly privileged role that should be limited to emergency scenarios when you can't use an existing role.

You can't remove existing user photos using the Microsoft 365 admin center. You can only use Microsoft Graph PowerShell.

You can't manage user photos for Microsoft 365 Groups using the Microsoft 365 admin center. You can only use Microsoft Graph PowerShell.

The maximum supported size of a photo is 4 MB.

User profile photo updates don't affect other user account properties. Configuration of the environment where new updates can be performed doesn't affect existing user profile photos in the cloud or in on-premises environments. 

Use the Microsoft 365 admin center to change a user's profile photo

  1. In the Microsoft 365 admin center, go to the Users > Active users page.

  2. On the Active users page, select the user by clicking anywhere in the row other than the check box. In the details flyout that opens, select Change photo under their existing photo placeholder or photo at the top of the flyout.

    The Change user action in the properties of the user account in the Microsoft 365 admin center.

  3. In the Change photo flyout that opens, select Choose photo.

  4. In the File upload dialog that opens, find and select the photo, and then select Open.

  5. Back on the Change photo flyout, select Save changes, and then select Back to return to the details flyout, or Close to return to the Active users page

Tip

In the user details flyout or the Change photo flyout, you can download an existing photo by right-clicking on the photo and selecting Save image as.

Manage user photos in Microsoft Graph PowerShell

After you install the Microsoft Graph PowerShell SDK, use the Connect-MgGraph cmdlet to sign in with the required scopes. You need to sign in with an admin account to consent to the required scopes.

  • Users only:

    Connect-MgGraph -Scopes "User.ReadWrite.All"
    
  • Microsoft 365 Groups only:

    Connect-MgGraph -Scopes "Group.ReadWrite.All"
    
  • Users and Microsoft 365 groups:

    Connect-MgGraph -Scopes "User.ReadWrite.All","Group.ReadWrite.All"
    

Add user photos in Microsoft Graph PowerShell

  • Users:

    Set-MgUserPhotoContent -UserId <UPN> -InFile "<PhotoPathAndFileName>"
    

    For example:

    Set-MgUserPhotoContent -UserId albertas@contoso.onmicrosoft.com -InFile "C:\Upload\Alberta Sanchez.png"
    

    For detailed syntax and parameter information, see Set-MgUserPhotoContent.

  • Microsoft 365 Groups:

    Set-MgGroupPhotoContent -GroupId <ID> -InFile "<PhotoPathAndFileName>"
    

    You get the ID GUID value of the Microsoft 365 Group from the output of a Get-MgGroup command.

    For example:

    Set-MgGroupPhotoContent -GroupId 173cd812-5563-439c-9da4-bc2715fa2aee -InFile "C:\Upload\Sales Department.png"
    

    For detailed syntax and parameter information, see Set-MgGroupPhotoContent.

Get information about user photos in Microsoft Graph PowerShell

The commands return the following information about the existing photo:

  • Id: The value is Default.
  • Height: In pixels.
  • Width: In pixels.

If the user has no photo, the commands return the error: Exception of type 'Microsoft.Fast.Profile.Core.Exception.ImageNotFoundException' was thrown..

  • Users:

    Get-MgUserPhoto -UserId <UPN>
    

    For example:

    Get-MgUserPhoto -UserId albertas@contoso.onmicrosoft.com
    

    For detailed syntax and parameter information, see Get-MgUserPhoto.

  • Microsoft 365 Groups:

    Get-MgGroupPhoto -GroupId <ID>
    

    You get the ID GUID value of the Microsoft 365 Group from the output of a Get-MgGroup command.

    For example:

    Get-MgGroupPhoto -GroupId 173cd812-5563-439c-9da4-bc2715fa2aee
    

    For detailed syntax and parameter information, see Get-MgGroupPhoto.

Download user photos in Microsoft Graph PowerShell

  • Users:

    Get-MgUserPhotoContent -UserId <UPN> -OutFile "<PhotoPathAndFileName>
    

    For example:

    Get-MgUserPhotoContent -UserId albertas@contoso.onmicrosoft.com -OutFile "C:\Download\Alberta Sanchez.png"
    

    For detailed syntax and parameter information, see Get-MgUserPhotoContent.

  • Microsoft 365 Groups:

    Get-MgGroupPhotoContent -GroupId <ID> -OutFile "<PhotoPathAndFileName>
    

    You get the ID GUID value of the Microsoft 365 Group from the output of a Get-MgGroup command.

    For example:

    Get-MgGroupPhotoContent -GroupId 173cd812-5563-439c-9da4-bc2715fa2aee -OutFile "C:\Download\Sales Department.png"
    

    For detailed syntax and parameter information, see Get-MgGroupPhotoContent.

Remove user photos in Microsoft Graph PowerShell

  • Users:

    Remove-MgUserPhoto -UserId <UPN>
    

    For example:

    Remove-MgUserPhoto -UserId albertas@contoso.onmicrosoft.com
    

    For detailed syntax and parameter information, see Remove-MgUserPhoto.

  • Microsoft 365 Groups:

    Remove-MgGroupPhoto -GroupId <ID>
    

    You get the ID GUID value of the Microsoft 365 Group from the output of a Get-MgGroup command.

    For example:

    Remove-MgGroupPhoto -GroupId 173cd812-5563-439c-9da4-bc2715fa2aee
    

    For detailed syntax and parameter information, see Remove-MgGroupPhoto.

Configure photo update settings in your Microsoft 365 organization

Photo update settings in your organization include controlling the environment where user profile photos can be updated and which roles are required.

Important

When you change photo update settings, it can take up to 24 hours for the changes to reflect throughout Microsoft 365. For example, if you block cloud user profile photo updates, it can take up to 24 hours before the users are blocked from making updates.

Select where user profile photos can be edited using Microsoft Graph

Currently, you can configure the photo update settings using Microsoft Graph only. For more information, see Manage user profile photo settings in Microsoft 365 using Microsoft Graph.