Microsoft Graph user photo returned by GET /photo/$value differs from uploaded image binary

Jerry Waldorf 6 Reputation points
2026-06-09T12:11:15.8266667+00:00

We are observing a difference between the image uploaded to Microsoft Graph and the image returned by Graph after retrieval.

We update a user's profile photo using the following endpoint:

PATCH https://graph.microsoft.com/v1.0/users/{userId}/photo/$value

The request body contains the image as binary data:

Buffer.from(base64Data, "base64")

The API call succeeds and returns a successful response.

After the update, we retrieve the user's photo using:

GET https://graph.microsoft.com/beta/users/{userId}/photo/$value

with:

responseType: "arraybuffer"

We then convert the returned binary data back to Base64 using:

Buffer.from(response.data, "binary").toString("base64")

Steps to reproduce:

  1. Update a user's profile photo using: PATCH https://graph.microsoft.com/v1.0/users/{userId}/photo/$value
    Request body: - Binary image data - Content-Type: image/jpeg The update request succeeds.
  2. Retrieve the same user's photo using: GET https://graph.microsoft.com/beta/users/{userId}/photo/$value with responseType: "arraybuffer".
  3. Convert both uploaded and retrieved images to Base64 and compare them. Observation: - The uploaded and retrieved images appear visually identical. - However, the Base64 content is not identical. - The binary content returned by Graph appears to be different from the original uploaded content.

Example:
Uploaded: uploaded.txt
Retrieved: Retrieved.txt

Is there a recommended method to verify photo integrity other than comparing Base64 strings directly?

Microsoft Security | Microsoft Graph
0 comments No comments

1 answer

Sort by: Newest
  1. AI answer

    2026-06-09T12:11:42.9166667+00:00

    The behavior is expected and documented characteristics of Microsoft 365 profile photos.

    Key points from the available information:

    1. Profile photos are stored and served by Exchange Online / Microsoft Entra ID as binary image data, not as a transparent byte-for-byte store of the uploaded file.
    2. When a photo is uploaded via PATCH/PUT to /users/{id}/photo/$value, the service can process the image (for example, re-encode, normalize, or resize) before storing it. The documentation states only that the photo size is limited to 4 MB and that the data is binary, not that the original file bytes are preserved.
    3. When the photo is retrieved via GET /photo/$value, the response is the stored binary image, which may differ at the byte level from the originally uploaded file even if the visual content is the same. This is consistent with other documented photo flows (for example, EWS and profilePhoto) where images are encoded/decoded and potentially transformed.
    4. Because of this processing, comparing Base64 strings (or raw bytes) of the uploaded and downloaded images is not a reliable way to verify correctness. Only the rendered image content can be expected to match, not the exact binary.

    Given this, the observed difference between the uploaded Base64 and the retrieved Base64 is normal. To validate correctness:

    • Treat GET /photo/$value as returning the canonical stored representation, not a round-trip of the original file.
    • Compare images visually or by dimensions/format (height, width, type) rather than expecting identical Base64.

    There is no indication in the provided documentation that Microsoft Graph guarantees byte-for-byte equality between uploaded and retrieved profile photo binaries.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.