Using Power Platform and Graph for Office 365 Reporting – Part 3 – Data Cleansing

By | August 18, 2020

As per Part 1 – The need here was to create a completely airgapped – i.e. no admin accounts for logging into reporting dashboards – reporting mechanisms for managers across a tenant shared between 20 or more business units. The reporting was primarily to monitor licenses and how they were assigned, what usage the business unit was getting from that and other metrics which are useful to report on.

Part 1 – Using Power Platform and Graph for Office 365 Reporting – Users
Part 2 – Using Power Platform and Graph for Office 365 Reporting – License Assignments
Part 3 -Using Power Platform and Graph for Office 365 Reporting – Data Cleansing
Part 4 – Using Power Platform and Graph for Office 365 Reporting – Summary and History

The two flows we have will keep our data up to date for our users but it wont get rid of data for users who leave. I don’t want to keep a load of detail about people who have left so anyone we dont update for a day is going to be removed from the common data service along with their licenses.

We dont need any new Graph queries or CDS entities, just a flow.

Flow

This flow is set to run every day, it doesn’t really matter is it is comparatively extremely fast.

So after the recurrence trigger we then just se a List Users to grab all of the users who havent been updated for a full day:

That filter looks like:

crf11_m365_reporting_currentusers_seen lt @{addDays(utcNow(), -1)}

we are filtering for users who have a value inn the “Seen” field of -1 days from now.

Next we open a For Each loop based on the values:

Then we grab the licenses for the identified stale user, matching on the user object id:

Then we can delete the license assignments we found:

And finally delete the user object:

Our licensing reporting is pretty much functional now, we have a pretty decent daily synopsis of our licenses, who has them and how they are assigned.

Next we need some aggregate data which flow manages to make a pretty painful process so its a whole new post…

Loading

Leave a Reply

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