Custom MacOS Client Inventory Data – Reporting Series Part 5

Inspired by the cool blog article about collecting custom MacOS inventory data to an Log Analytics Workspace:
https://ugurkoc.de/collecting-customized-inventory-data-on-macos-devices-using-intune/
I modified his script to upload the data using our Azure Function App from Part 1 of our Reporting Series to our existing Cosmos DB. If you haven’t seen it, check it out now: Part 1

Architecture

As a short reminder, how this will all fit in the whole architecture of our reporting, we built an Azure Function App that will take the inventory data from our (windows) clients and now also from our macOS Clients and writes it into our centralized Cosmos DB, which we will query from Power BI.

Azure Cosmos DB

Let’s start with adding the new Container for our MacOS Data to our Cosmos DB. The new Container id will be “MacOSInventoryContainer” and the Partition key is “/id” which contains the Intune managed device id as in all of our other Containers, so we can easily build the relationships in PowerBI later.

Microsoft Intune

Before we can use the new script, we have to modify the script from GitHub, to point to our Azure Function App. https://github.com/mmeierm/Scripts/blob/main/Inventory/MacOS_ClientInventory_CosmosDB_AzureFunction.sh
Simply add the Function App URL in Line 93 to your environment:

Now that we have configured everything that we need, we can deploy the bash script via Intune by using the Shell Scripts option.

Give it a name:

Upload the script, set it to run silent and set the Script frequency to your needs.

Once you assign it to your devices, at the next check-in you should be able to see data in the database:

Power Bi

Now that we have our custom inventory available in the Cosmos DB, we can leverage this data in our Power Bi Reports as well. Simply add the new container:

Select transform data and expand our columns as needed:

Once the data is loaded to Power Bi, we can check the relationships, that should be automatically created and should basically be a 1:1 relationship between the id fields, as mentions above contains the Intune managed device id, which is unique.

If everything went right, you should be able to add the new fields like members of local admin groups to your reports:


Posted

in

by

Comments

One response to “Custom MacOS Client Inventory Data – Reporting Series Part 5”

  1. […] Custom MacOS Client Inventory Data – Reporting Series Part 5 […]

Leave a Reply

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