Send Teams Alerts for Top 5 Intune App Install Errors

Send Teams Alerts for Top 5 Intune App Install Errors

It is always important as an Intune admin to have an overview of the environment. Intune offers a lot of reports but as we all know you don’t look into them every day. Isn’t it easier to get a daily or weekly message in Teams and see the top failed app installations. I have already released some blogs with the topic of detecting anomalies in Intune with the help of cognitive services. In this blog I want to show you how to send a report that is already available in Intune to Teams using Azure Automation.

Teams notification showing top five app installation errors

How did we get the data

In the reports in the app menu, there is exactly this overview that we need. We can see here the top 3 failed installations.
The question is how do we get this information?

Teams notification showing top failed Intune app installations

With the help of a network trace in the browser we can see which graph endpoint is called. Since this is a POST call we still need the body that we have to send with this call. In the call we see that it called for the top 50 failed app installations but we want the top 5 so we adjust the body a bit.

This is all the information we need so let’s get started. If you want to analyze Intune data in a more data-driven way, you can also check out the easy way to make data science with Intune.

Get Teams WebHook URL

  • Create an MS Teams channel and add the webhook connector
  • Outlook inbox showing notification email
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Copy the WebHook URL

Create an App Registration

  • Search for Microsoft Entra ID
  • Select App registration
Send Teams Alerts for Top 5 Intune App Install Errors
  • Select +New registration
  • Enter a Name and click Register
  • Click API permissions and +Add a permission
  • Select Microsoft Graph
  • Select Application permissions
  • Search for DeviceManagementApps.Read.All
Send Teams Alerts for Top 5 Intune App Install Errors
  • Click Grant admin consent for *** and approve with Yes
Send Teams Alerts for Top 5 Intune App Install Errors
  • Select Certificates & secrets and click +New client secret
  • Enter a Description and select a Expires time
  • Click Add
  • Copy and save the Value and the Secret ID

Create Automation Account

  • Search for Automation Accounts
  • Click + Create
  • Select a Subscription and a Resource group
  • Enter an account name and select a Region
  • Click Next
Send Teams Alerts for Top 5 Intune App Install Errors
  • Click Next
Send Teams Alerts for Top 5 Intune App Install Errors
  • Click Next -> Next -> Create
Send Teams Alerts for Top 5 Intune App Install Errors

Create the Runbook

  • Open the Automation Account
  • Navigate to Variables and click + Add a variable
Send Teams Alerts for Top 5 Intune App Install Errors
  • Add the Secret Value, TenantId, WebHookUri and the App ID as Variable
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Send Teams Alerts for Top 5 Intune App Install Errors
  • Select Runbooks
  • Click + Create a runbook
  • Enter a Name
  • Select PowerShell as Runbook type
  • Select 5.1 as Runtime version
  • Click Create
Send Teams Alerts for Top 5 Intune App Install Errors
  • Click Publish
Send Teams Alerts for Top 5 Intune App Install Errors
  • Navigate to Schedules and click + Add a schedule
  • Click Link to schedule and add the created schedule

Conclusion

I hope I could help you with this blog to explain how you can build another monitoring for your Intune environment. If you have more ideas about monitoring capabilities then let me know and I’ll be happy to create a blog post about this. For a related troubleshooting scenario, check out how to export Intune assignment errors with PowerShell.

If you want to work more efficiently with multiple Microsoft Graph calls, you might also like my post about the Graph Batch Endpoint.

Stay healthy, Cheers
Jannik