Trying to parse a url using query params using Microsoft.Graph.Intune module

Copper Contributor

 

Invoke-MSGraphRequest -Url 'https://graph.microsoft.com/beta/deviceManagement/managedDevices?$select=id,imei,operatingSystem,ownerType,managedDeviceOwnerType&$filter=(operatingSystem eq ''iOS'')' -HttpMethod GET 

 

I would like to retrieve this data and the URL works in Postman, but when I run it in VS i get "Cannot validate argument on parameter 'Url'. The provided URL is not valid - the URL may be a relative URL" Any ideas on how I can retrieve this data and use it? Mainly make this request work with Connect-MSGraph

4 Replies
Hi Matthew,

Have you thought about using PowerAutomate? It’s easier than using powershell or Postman, then you can parse the results and use them.

Here is a good guide:

https://www.petervanderwoude.nl/post/using-a-custom-connector-for-device-management-actions-in-micro...

Moe

@Moe_Kinani You could also store the output from https://graph.microsoft.com/beta/deviceManagement/managedDevices in a variable and query from there?

 

$devices=https://graph.microsoft.com/beta/deviceManagement/managedDevices
$devices.value | Where-Object operatingSystem -Contains 'iOS'

Did you manage to get a report?