Jan 3, 2019 2 min read

How does the Microsoft Graph access its data?

Learn which APIs the Microsoft Graph uses to deliver a response for each request, using the $whatif parameter.

How does the Microsoft Graph access its data?

Microsoft Graph, the one endpoint to rule them all, the one API in front of all the other API's in the Microsoft Cloud. I didn't really know how it worked (does it aggregate data, pass through to other API's, or a combination of both), until it didn't work and I had to troubleshoot.

At SharePoint Conference 2018 in Las Vegas I had the honor to have a sit down with Yina Arenas, the Principal Program Manager & allround Microsoft Graph mastermind. I wanted to provide some feedback on how I perceived the (lack of) support for developers having issues working with the Graph. She listened and noted, AND she took a look at my StackOverflow issues. That's when she pulled a trick that I never saw before, nor found documented anywhere...

You can see whatever happens with each request by appending $whatif to the end of the URL as a query string parameter! It shows how the Graph would handle your request, without actually executing it!

You can use the Microsoft Graph Explorer to test this out. A simple request to get "My profile" (GET https://graph.microsoft.com/v1.0/me) returns:

    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
    "businessPhones": [
        "+1 412 555 0109"
    "displayName": "Megan Bowen",
    "givenName": "Megan",
    "jobTitle": "Auditor",
    "mail": "MeganB@M365x214355.onmicrosoft.com",
    "mobilePhone": null,
    "officeLocation": "12/1110",
    "preferredLanguage": "en-US",
    "surname": "Bowen",
    "userPrincipalName": "MeganB@M365x214355.onmicrosoft.com",
    "id": "48d31887-5fad-4d73-a9f5-3c356e68a038"

Now, appending $whatif to the request (GET https://graph.microsoft.com/v1.0/me?$whatif) the result changes to:

    "Description":"Execute HTTP request",

This shows that a request for "My profile" gets passed on to the Azure AD Graph to return the results. You can add $whatif to any request, finally showing you where all the information in the Graph is coming from!

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Yannick Reekmans.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.