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.
- 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
.
- 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"]
}
}
}
}
- 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).
- 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"
}
]
}
- 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.
Filter Devices by Available Space
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