Creating Logic App to Identify Low Storage Devices in Intune

Aran Billen 761 Reputation points
2024-07-01T14:16:05.74+00:00

Hello everyone,

I’m seeking some assistance with creating a Logic App. I need to identify devices in Intune that have 5GB or less of available space and receive an email with the details of these devices, including their names.

Is this achievable?

I’ve made some progress but am having trouble generating the sample JSON. Any guidance would be appreciated.

Screenshot 2024-07-01 at 15.11.45

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,963 questions
Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,664 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,351 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sina Salam 6,581 Reputation points
    2024-07-01T17:21:29.02+00:00

    Hello Aran Billen,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    Problem

    I understand that you are creating Logic App to Identify Low Storage Devices in Intune and having trouble generating the sample JSON.

    Solution

    Yes, it's achievable to create a Logic App that identifies devices in Intune with 5GB or less of available space and sends an email with the device details.

    1. When you create your Logic App, select a blank template to start from scratch.

    2. Add a new step and search for Intune and choose the appropriate action to list devices or get device details. Typically, you might use the action like List devices or Get device properties.

    1. Add a new step after the HTTP action, then search for and select "Parse JSON." In the content field, use the body from the previous HTTP action. Then, generate the schema by pasting a sample JSON response from the Microsoft Graph API for managed devices. This is an example of the JSON schema:
    {
      "type": "object",
      "properties": {
        "value": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": { "type": "string" },
              "deviceName": { "type": "string" },
              "freeStorageSpaceInBytes": { "type": "integer" }
            },
            "required": ["id", "deviceName", "freeStorageSpaceInBytes"]
          }
        }
      }
    }
    
    1. After retrieving the list of devices, you need to filter the devices based on their available space.
    • Add a condition to check if the available space property is 5GB or less. The available space might be represented in bytes, so you'll need to convert 5GB to bytes (5 * 1024 * 1024 * 1024).
    1. Create a JSON object to hold the device details. This will be used to generate the sample JSON.

    The below is an example how you can structure your JSON:

    {
        "devices": [
            {
                "deviceName": "Device1",
                "availableSpace": "4.5GB"
            },
            {
                "deviceName": "Device2",
                "availableSpace": "3.8GB"
            }
        ]
    }
    
    1. Lastly, add a new step to send an email to use the Office 365 Outlook connector or any other email service you prefer and compose the email body to include the device details from the filtered list.

    References

    Kindly use the below for the steps discussed above.

    Create the Logic App

    Add Intune Connector

    Filter Devices by Available Space

    Format the JSON

    Add an Email Step

    Accept Answer

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.

    ** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.

    Best Regards,

    Sina Salam