The new advanced endpoint analytics, available as add-on to Intune or available in Intune Suite allows us to get a really deep dive into the health of our devices with a lot of fresh data. However, the visual representation in the portal is in my opinion currently a little bit limited and can be enhanced by leveraging for example Power Bi to create more advanced reports. So, let’s start exporting the data so we can use it in our Power Bi Reports.
Azure Cosmos DB
First thing I would create, is an Azure Cosmos DB, which will store the exported elevation information, to be used in Power Bi. If you already have a working Cosmos DB from one of our previous parts, you can skip to the creation of the new containers here: New Containers
New Cosmos DB
To create a new Cosmos DB in an Azure Subscription of our choice, is to search for “cosmosdb” in the Azure Marketplace:

On the next page, we will select “Azure Cosmos DB for NoSQL”:

In the creation wizard, we will select the region in which it should be deployed and give it a name:

In the other pages of the wizard, you can verify some settings, for this demo, I went with the default values and created the DB:

Once, the deployment is done, you can create the first Database “InventoryDatabase” and the first needed Container “IntuneEABatteryHealthContainer”

New Containers
If you are using the existing Database from the earlier parts of our reporting series, we just have to create the additional Containers in the existing DB, starting with the “IntuneEABatteryHealthContainer”:

Since I also want to export data for the Resource and Remoting Performance of my Windows 365 Machines, I will also export this into the Container “IntuneEAResourcePerformanceContainer” and “IntuneEARemotingPerformanceContainer”. If you don’t need this, you can skip this and exclude this later in the script.


Once created, it should look something like this:

Azure Automation
Next thing, that we need is an Azure Automation Account to export the data from Intune into our Cosmos DB. Again, if you already have a working Azure Automation Account from earlier, you can skip ahead to the creation of the Runbook here: Runbook
Azure Automation Account
To create the needed Azure Automation Account, we again need to go to the Azure Marketplace and search for the “Automation”

Give it a name and select the region:

And make sure to enable the system managed identity:

Azure Automation Runbook
Once the Automation Account is created, we can assign the needed Permissions to the System Managed Identity. Just replace the ID from the Identity Tab of the Automation Account in the Script.

You can find the needed Script to assign the Permissions here: https://github.com/mmeierm/Scripts/blob/main/Inventory/Add-Permission-EPM.ps1
The Script will add the following read permissions:
- DeviceManagementConfiguration.Read.Alll
- DeviceManagementManagedDevices.Read.All

Now that we have all prerequisites, we can create the actual Runbook in our Automation Account:

Give it a name and select PowerShell as Runbook type:

In the actual Runbook, copy the code from: https://github.com/mmeierm/Scripts/blob/main/Inventory/EA-Report-Runbook.ps1

And modify the parameters to match your Cosmos DB:

You get these info’s from the Keys page of the Cosmos DB:

Once Published, you can run it for the first time, and you should see entries for all your devices that are available in Endpoint Analytics:

If everything worked as expected, you can link the Runbook to a schedule, to automatically export the data.


Configure the new schedule to run recurring with an interval of your needs.

Power Bi
Last but not least, we can now finally create our reports in Power Bi. Let’s start with a new Report and select as data source “Azure Cosmos DB v1”:

You will find the needed connection information again in the Keys section of the Cosmos DB. Here we can use a Read-only Key, since we won’t change data from PowerBI.



Once we are connected, we can select the needed Tables in Power Bi and select Transform Data, to read in all reported data:

In the Power Query Editor, we can expand the Table to reveal all data:


Once everything is there, we can close and apply the Power Query Editor, to load the data in our report.

Now that everything is available, we can build our visuals like Battery Health or age:

Conclusion
Having all the data available in Intune is super cool, however it can get a little bit complicated using this data, when it is all just numbers:

However, if we use this data to create more advanced reports in e.g. Power Bi, we can really start using this amazing data to create really helpful reports:

Leave a Reply