Daily Intune Device Reports via Logic Apps, Email & Teams

Daily Intune Device Reports via Logic Apps, Email & Teams

This step-by-step guide shows how to send daily Intune device reports via Logic Apps, email and Teams. The flow combines Microsoft Graph queries, Azure Logic Apps, and your existing Microsoft 365 channels — no third-party reporting tool needed, and the whole pipeline runs on the Azure consumption plan for a few cents per month.

For an Intune admin it is always helpful to get an overview of the current status of their tenant and an overview of the count of devices in the field. In this blog I would like to explain how you can use Logic Apps to send you a detailed daily report.

Azure Logic Apps workflow for daily Intune device report
Azure Logic Apps workflow for daily Intune device report

What is Logic Apps

Microsoft Azure Logic App Services is a SaaS solution (Software as a Service) that offers many possibilities to automate processes, workflows and tasks through low code and integration of different services.

Create Logic App instance

  • Click + Add
  • Select the Subscription
  • Select or create a Resource Group
  • Enter a unique name of the logic app
  • Select a region
  • Select no for log analytics unless you want to activate this
  • Select Consumption as plan type
  • Select Disabled for Zone redundancy
  • Click Review + create
  • Add tags if you want and click Review + create
  • Click Create

Create an Azure Key Vault

  • Search for Key Vault
  • Click + Create
  • Select the Subscription
  • Select or create a Resource Group
  • Enter a unique name of the key vault
  • Select a region
  • Select Standard as price tier
  • Click Review + create

Create an App Registration

  • Search for Microsoft Entra ID
  • Select App registration
Daily Intune Device Reports via Logic Apps, Email & Teams
  • Select +New registration
  • Enter a Name and click Register
  • Click API permissions and +Add a permission
  • Select Microsoft Graph
  • Select Application permissions
  • Search for DeviceManagementManagedDevices.Read.All
  • Select Certificates & secrets and click +New client secret
  • Enter a Description and select an Expires time
  • Click Add
  • Copy and save the Value and the Secret ID
  • Open the previously created Key Vault
  • Add the Secret to the Vault
  • Click Grant admin consent for *** and approve with Yes

Build the Logic app

  • Start the flow with a Recurrence trigger. Set the schedule to once a day.
  • Add an Azure Key Vault Get Secret action
  • Enter the name of the Key Vault and sign in
  • Select the previously created secret
  • Add a HTTP Action
  • Fill in the following attributes:
    • Method: GET
    • URI: https://graph.microsoft.com/v1.0/deviceManagement/managedDeviceOverview
  • Click add new Parameter and select Authentication
  • Select Authentication Type as Active Directory OAuth
  • Add your TenantId. You can find this ID in Microsoft Entra ID.
  • Select the Secret as dynamic content (Value)
  • Run the first test
Daily Intune Device Reports via Logic Apps, Email & Teams
  • Check the body if you can see device data
  • Add a Parse JSON Action
  • Select Body as Content and add the following content as Schema:
{
    "type": "object",
    "properties": {
        "@@odata.context": {
            "type": "string"
        },
        "id": {
            "type": "string"
        },
        "enrolledDeviceCount": {
            "type": "integer"
        },
        "mdmEnrolledCount": {
            "type": "integer"
        },
        "dualEnrolledDeviceCount": {
            "type": "integer"
        },
        "deviceOperatingSystemSummary": {
            "type": "object",
            "properties": {
                "androidCount": {
                    "type": "integer"
                },
                "iosCount": {
                    "type": "integer"
                },
                "macOSCount": {
                    "type": "integer"
                },
                "windowsMobileCount": {
                    "type": "integer"
                },
                "windowsCount": {
                    "type": "integer"
                },
                "unknownCount": {
                    "type": "integer"
                }
            }
        },
        "deviceExchangeAccessStateSummary": {
            "type": "object",
            "properties": {
                "allowedDeviceCount": {
                    "type": "integer"
                },
                "blockedDeviceCount": {
                    "type": "integer"
                },
                "quarantinedDeviceCount": {
                    "type": "integer"
                },
                "unknownDeviceCount": {
                    "type": "integer"
                },
                "unavailableDeviceCount": {
                    "type": "integer"
                }
            }
        }
    }
}

Send status via Email

  • Add an Outlook Send an Email (V2) action
  • Add the Receiver in the To column
  • Add a Subject
  • If you want to add a date to the subject add the following expression:
string(utcNow('yyyyMMdd'))
  • Add the following in the Body column. (You can modify the text as you want)
Dear MDM Team,

attached your daily report:
- Total devices: @{body('Parse_JSON')?['enrolledDeviceCount']}
- Mdm enrolled: @{body('Parse_JSON')?['mdmEnrolledCount']}
- Hybrid enrolled: @{body('Parse_JSON')?['dualEnrolledDeviceCount']}

Per device group:
- Windows: @{body('Parse_JSON')?['deviceOperatingSystemSummary']?['windowsCount']}
- Android: @{body('Parse_JSON')?['deviceOperatingSystemSummary']?['androidCount']}
- iOS: @{body('Parse_JSON')?['deviceOperatingSystemSummary']?['iosCount']}
- MacOS: @{body('Parse_JSON')?['deviceOperatingSystemSummary']?['macOSCount']}


Best regards and have a nice day without troubles
Your logic app
  • Now we can make a test run to check if everything works
Daily Intune Device Reports via Logic Apps, Email & Teams
  • Check your inbox
Daily Intune Device Reports via Logic Apps, Email & Teams

Send status via Teams

  • Create a Microsoft Teams channel and add the webhook connector
  • Daily Intune Device Reports via Logic Apps, Email & Teams
  • Daily Intune Device Reports via Logic Apps, Email & Teams
  • Daily Intune Device Reports via Logic Apps, Email & Teams
  • Daily Intune Device Reports via Logic Apps, Email & Teams
  • Daily Intune Device Reports via Logic Apps, Email & Teams
  • Daily Intune Device Reports via Logic Apps, Email & Teams
  • Daily Intune Device Reports via Logic Apps, Email & Teams
  • Daily Intune Device Reports via Logic Apps, Email & Teams
  • Daily Intune Device Reports via Logic Apps, Email & Teams
  • Daily Intune Device Reports via Logic Apps, Email & Teams
  • Daily Intune Device Reports via Logic Apps, Email & Teams
  • Daily Intune Device Reports via Logic Apps, Email & Teams
  • Copy the WebHook URL
  • Add an HTTP activity to the flow
  • Select POST as Method
  • Enter the URL as URI
  • Add Content-Type as key and application/json as value in the header
  • Enter the following body
  • Add
{
  "text": "Dear MDM Team, nn attached your daily report:n- Total devices: @{body('Parse_JSON')?['enrolledDeviceCount']}n- Mdm enrolled: @{body('Parse_JSON')?['mdmEnrolledCount']}n- Hybrid enrolled: @{body('Parse_JSON')?['dualEnrolledDeviceCount']}nnPer device group:n- Windows: @{body('Parse_JSON')?['deviceOperatingSystemSummary']?['windowsCount']}n- Android: @{body('Parse_JSON')?['deviceOperatingSystemSummary']?['androidCount']}n- iOS: @{body('Parse_JSON')?['deviceOperatingSystemSummary']?['iosCount']}n- MacOS: @{body('Parse_JSON')?['deviceOperatingSystemSummary']?['macOSCount']}"
}
  • Now we can make a test run to check if everything works
Daily Intune Device Reports via Logic Apps, Email & Teams
Daily Intune Device Reports via Logic Apps, Email & Teams

Conclusion

In this blog, I’ve shown you the basics of how to create a Logic App to query the Intune Graph API. You can extend my example as you like and e.g. include the current service health status or add the status of the windows update deployment. If you want a more detailed and updated version, check out my V2 step-by-step guide to get a daily device report via email or Teams with Logic Apps.

Stay healthy, Cheers
Jannik