Warning
/photoUpdateSettings is available only in the Microsoft Graph beta endpoint, not in the v1.0 endpoint. The beta endpoint may change without notice, and its use in production is not supported.
As described in Manage user profile photo settings in Microsoft 365 by using Microsoft Graph, you can use Microsoft Graph’s /photoUpdateSettings to prevent users from changing their profile photos.
Because this setting uses Microsoft Graph, Graph Explorer is a simple way to configure it.
Open Graph Explorer, sign in as a Global Administrator by selecting [Sign in] in the upper-right corner.
Select your profile photo in the upper-right corner, then select [Consent to permissions].
Find
PeopleSettings.ReadWrite.Alland select [Consent].Review the consent prompt and grant consent.
Return to Graph Explorer and select [x] in the upper-right corner to close the Permissions pane.
Select [PATCH] from the drop-down list that currently shows [Get].
Select [beta] from the drop-down list that currently shows [v1.0].
In the text box to the right, enter
https://graph.microsoft.com/beta/admin/people/photoupdatesettings.Enter the following JSON in [Request body]. This example allows only User Administrators to change profile photos. To allow only Global Administrators and User Administrators, set
allowedRolesto the following two IDs. Other values were not available when this article was written.1
2
3
4{
"source": "cloud",
"allowedRoles": ["fe930be7-5e62-47db-91af-98c3a49a38b1"]
}1
2
3
4{
"source": "cloud",
"allowedRoles": ["62e90394-69f5-4237-9190-012177145e10", "fe930be7-5e62-47db-91af-98c3a49a38b1"]
}Select [Run query].
Confirm that [Success] appears.
The current Microsoft Learn documentation also lists the People Administrator role as a role that can be allowed to change profile photos. For example, it includes a configuration for Global Administrators, User Administrators, and People Administrators. Check the linked documentation for the latest values.
The configuration is complete. Wait for it to take effect, then try to set a profile photo as a user who isn’t a User Administrator. The change fails. To see the details, inspect the network trace in your browser’s developer tools (F12) or use Fiddler. Microsoft Graph returns an error with the code ForbiddenByAdmindEditPolicy. Outlook on the web and the Azure portal also use Microsoft Graph when setting profile photos (the Azure portal uses a batch request). The network trace shows the same error code.
Profile photo changes also fail in Delve and Teams, which don’t use Microsoft Graph directly. However, the error details in the network traffic vary by service.