Skip to Main Content

How to build insightful M365 Analytics Dashboards with SquaredUp and Microsoft Graph API (Part 1)

Ruben Zimmermann
Infrastructure Architect, SIG

It’s incredibly helpful to be able to visualize the data produced by your organization’s M365 tenant so you can manage licenses, usage, capacity, and more. SquaredUp Dashboard Server is ideal for this. And it's free.

You can use the Web API Tile in SquaredUp to connect to the Microsoft Graph API, which offers a broad set of functionalities for working with Azure via code. Microsoft 365 sits on top of Azure and can be managed via Graph API, too.

The reports section of Graph API exposes usage insights of your M365 tenant and, with the latest release of SquaredUp, those can be easily consumed and nicely presented.

In this blog post, I’ll walk you through how to create the initial connection in Azure portal and SquaredUp. In part two, I’ll demonstrate SquaredUp’s new, version 5 capabilities with the Web API Tile for building powerful dashboards.

Setting the stage

To allow Graph API queries and display them in SquaredUp, you’ll need to complete a few steps in the Azure portal.

Creating the App Registration

Navigate to the Azure portal, launch Azure Active Directory, choose App registrations, and click +New registration.

  1. Give the registration a name, e.g. SquaredUp, that will help you find it in your tenant later. For the most secure access, choose Accounts in this organization directory only.
  2. Don’t worry about filling in the Redirect URI You can always come back and add it later if you want to.
  3. If you do fill it in, keep Web in the dropdown and type in the FQDN of your SquaredUp server followed by /ext-core-webapi/callback/.
  4. Then, the red underlined part of the URL, as shown in the image, needs to match the name you choose for the WebAPI provider in SquaredUp.

5. Complete the registration of your application by clicking on Register.

Within Authentication in the left-hand menu, grant Access tokens and ID tokens for implicit granting and hybrid flows:

Next, head to Certificates & secrets to add a new client secret (like a usual password).

As we will use READ only permissions later, I believe setting Expirations to Never with a name that shows it is ‘read only’ should be fine.

Copy the key into your clipboard – and I also suggest copying it into your password safe for further lookups. We’ll paste this into SquaredUp later when we set up a new provider.

Next, navigate to API permissions and click on Add a permission.

Keep the default choice, Microsoft Graph.

Then select Application permissions so they do not depend on the requesting user’s permissions.

Below that, start typing the permissions that are needed, e.g. directory reading, and select the relevant ones.

After selecting all required permissions, click on Grant admin consent for your tenant and confirm your action with Yes.

After completing all permissions, the orange triangles will turn to green check marks.

Creating the WebAPI Provider in SquaredUp

Now we can move to SquaredUp and set up the WebAPI connection there.

In SquaredUp, expand the hamburger-menu, choose System, and click on WEB API.

Add a new provider, choose Azure Active Directory, and fill in the information required in the form.

  1. AzureGraph, the same as the name we mentioned in the App registration in Azure.
  2. Base URL: https://graph.microsoft.com/beta
  3. Azure Active Directory tenant id: Your tenant ID (highlighted below in yellow)
  4. Resource URL: https://graph.microsoft.com
  5. Active Directory Application id: The ID of the previously created app registration (highlighted below in turquoise)
  6. Application key: The client secret you created and stored in a password safe

7. Finish by clicking Add provider. A browser window may appear which asks you to approve the access.

When you have entered all values correctly, the newly added provider will appear with a green check mark:

And that’s you connected to the Microsoft Graph API. Now we’re ready to build a dashboard to start reporting on the metrics so you can closely monitor your M365 tenant. I’ll show you exactly how to build that dashboard, step by step, in the next blog.

Get SquaredUp Dashboard Server for free so you can try it out yourself!