Create a Real Time Interactive Dashboard for Office 365 Using PowerShell Universal Dashboard

Create a Real Time Interactive Dashboard for Office 365 Using PowerShell Universal Dashboard

If you have never heard of PowerShell Universal Dashboard you need to head on over to PoshUD right now and check out this awesome PowerShell Module. Using PowerShell Core, Material Design, ReactJS and ASP.NET Core, Universal Dashboard takes advantage of cutting-edge technology to provide cross-platform, cross-device dashboards that looks sleek and modern.1

While reading over some other posts about what other people have done with PowerShell Universal Dashboard, I wondered if there was a way to create a interactive dashboard that would hook into Office 365 and gather data from it. At first, I attempted to create a dashboard that would create a PSSession to Office 365 but it presented some problems and overall was quite slow. I then decided to use the Microsoft Graph REST API to connect to Office 365. This allows it to refresh the data within in the dashboard quickly and takes seconds to connect.

One of the great things about PowerShell Universal Dashboard is you can specify refresh amounts for each data set. You can make it refresh less often, or more often, whichever fits your needs. While running my dashboard I added users and created new groups (as you can see from the graph), but I also made users change their passwords at next logon, and several seconds later I saw their account name on the dashboard. When I changed licenses, I saw the license graph change as well. One thing I wanted to add to this dashboard was a “un-used license” value, which shows me licenses that I am paying for but are not assigned to anything. This allows me to make sure I clean up licenses in my tenant so I’m not paying for a license that’s not in use.

Using the API, the Dashboard with automatically update it’s data when you make changes in Office 365

Pre-Requisites

I followed the following guide to connect to the Microsoft Graph API.

  1. Download/copy the New-GraphToken function
  2. The only thing we need is our Office 365 tenant name, in my case its bwya77.onmicrosoft.com
  3. The Function requires the module AzureRM, to install it simply run:
  4. PowerShell Universal Dashboard module, to install it simply run:

     

The tenant name will be stored in a variable called $TenantName

As we see pictured above I added the New-GraphToken function to the beginning of my script, and then added my tenant to the TenantName variable. My next step is to request a Graph token which is then stored in a variable called GraphToken.

New-GraphToken Function:

When you run the script it will request credentials to get the GraphToken

Creating and Customizing the Dashboard

Creating the dashboard took me a little bit of time. I tested with a lot of different component types, data sets, and groupings. PowerShell Universal Dashboard has quite a bit of customization options and also a little bit of a learning curve, but once you get the hang of things you will be making dashboards quickly and easily.

I did a lot of testing and customization off of Adam’s sample dashboard code which is hosted on GitHub. I recommend you first start off playing around with it and the test data.

If we take a look of my formatting, you can see I have two rows for my dashboard. The first row contains 3 columns, and my second row contains 2 columns. The “Total Users” component, and the “Total Groups” is a UDMonitor, while the “Domains” and “Users Forced to Change Password at Next Logon” is a UDGrid. The “License” component is a UDChart. UDMonitor, UDGrid and UDChart are all components. Dashboards are composed of components. some components can be:

  • UDChart
  • UDColumn
  • UDGrid
  • UDInput
  • UDMonitor
  • UDLayout
  • UDPage
  • UDTable
  • UDRow

Interactive Dashboard

The dashboard will allow you to interact with it. As we see pictured below, I can hover over different components to get more info on the data set. In the Domains component I can even filter my results.

 

Data Sets

In my Dashboard I wanted to display information about Users, Groups, Licenses, and Domains. The Microsoft Graph API connects to the data that drives productivity – mail, calendar, contacts, documents, directory, devices, and more so this dashboard just scratches the surface. My “Total Users” component monitors the total user count in my tenant, similar to “Total Groups”. The “Licenses” Component displays each license type and its assigned count, total count, and un-assigned count. “Domains” displays all my verified domains, dropping the default “.onmicrosoft” sub-domain. And lastly, the “Users Forced to Change Password at Next Logon” component parses all users, and grabs those that are required to change their password at next logon. Since I made this dashboard fairly quickly, I plan to keep adding different data sets to it to really make this dashboard valuable. In the future I hope to monitor spam flow, mail flow, and more.

Help

To learn more about PowerShell Universal Dashboard I urge you to read Adam’s GitHub gitbook

Price

Universal Dashboard is currently $99 which is a bargain since Adam keeps updating it with great features. It will allow you to use it for an hour unpaid as you trial it. The pricing can be found here.

 

PowerShell Script


Sources
1 – https://www.poshud.com/Home

6 thoughts on “Create a Real Time Interactive Dashboard for Office 365 Using PowerShell Universal Dashboard

  1. Do you think there is a way to pull all data for every tenant in your partner portal?

    Would be awesome to use this to aggregate data across all your clients?

    1. This is something I want to investigate more into. I think it would be very valuable to make a graph that can report on multiple tenants easily.

    1. I haven’t looked into PowerBI much so I can’t speak on it, but it sounds like a good thing for me to look over and make a write up about. I would assume PowerBI can make similar graphs for you.

  2. Start-UDDashboard is throwing an error. what are the prerequistes other than .net 4.7
    error: Start-UDDashboard : Error -4092 EACCES permission denied

Leave a Reply

Your email address will not be published. Required fields are marked *