Hello Lukas Priwitzer,
Thank you for reaching out to Microsoft!!
A 500 internal server error usually referred as server-side issues. Try testing the respective Graph API in the Graph Explorer or try executing the request after some wait time which might help in fixing such issues.
For the query is there a better way than a script i.e. configuring the EntraID Sync to always sync the photo, please find the below workaround which might help resolve the issue.
If you prefer to manage user photos centrally and locally, you can configure EntraID Sync to synchronize user photos from Active Directory. Here's a high-level overview of the process:
- Sign in to the Microsoft Entra Admin Center as a Hybrid Administrator.
- Navigate to Identity>Hybrid Management>Microsoft Entra Connect>Cloud Sync.
- Select New configuration and choose AD to Microsoft Entra ID sync.
- Map the
thumbnailPhoto
attribute from Active Directory to the corresponding attribute in Microsoft Entra ID. - Test your configuration before deploying it.
- Enable your configuration once everything is setup.
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.