Skip to content

Invoke-MgGraphRequest -Method GET ... Not returning all records. #2992

@gjhardie

Description

@gjhardie

Describe the bug

I'm trying to get all the device configuration profiles from Intune.
I've tried both of these with Microsoft.Graph and Microsoft.Beta:

  1. $response = Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/v1.0/deviceManagement/deviceConfigurations"
  2. $response = Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/beta/deviceManagement/deviceConfigurations"

The first returns 54 items then second 80. However, there are in fact 91Device Configuration policies.

Expected behavior

Expected either 1 or 2:

  1. $response.value.count return a value of 91
  2. $response.value.count return a value less than 91 and $response.'@odata.nextLink' to provide a link for the next items.

Neither of these happened.

How to reproduce

  1. In this instance there are 91 Device Configuration profiles in Intune. Given the most items were returned by URI: "https://graph.microsoft.com/beta/deviceManagement/deviceConfigurations" at least -gt 80 items are required to reproduce this.
  2. Microsoft.Graph or Microsoft.Beta module is installed.
  3. Connect-MgGraph -Scopes "DeviceManagementConfiguration.Read.All"
  4. $response = Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/v1.0/deviceManagement/deviceConfigurations"
  5. $response.value.count

SDK Version

2.23.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

VERBOSE: GET https://graph.microsoft.com/beta/deviceManagement/deviceConfigurations with 0-byte payload
DEBUG: GET /beta/deviceManagement/deviceConfigurations HTTP/1.1
HTTP: graph.microsoft.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Microsoft Windows 10.0.22631; en-GB) PowerShell/5.1.22621.4111 Invoke-MgGraphRequest

VERBOSE: received 393337-byte response of content type application/json
DEBUG: GET https://graph.microsoft.com/beta/deviceManagement/deviceConfigurations
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Vary: Accept-Encoding
Strict-Transport-Security: max-age=31536000
request-id: ee554cd3-3516-4e1a-a039-e4a62b3b2791
client-request-id: 65043a5f-6d0c-4680-9ba5-94c4e35655f4
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"UK South","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"LN2PEPF000114DC"}}
OData-Version: 4.0
Date: Tue, 08 Oct 2024 16:02:10 GMT
Content-Encoding: gzip
Content-Type: application/json; odata.metadata=minimal; odata.streaming=true; IEEE754Compatible=false; charset=utf-8

{"@odata.context":"https://graph.microsoft.com/beta/$metadata#deviceManagement/deviceConfigurations","value":[{"@odata.type":"#microsoft.graph.iosCustomConfiguration","id":"d3a0db21-d423-4ae4-a5ac-ec17d4284687",
"lastModifiedDateTime":"2022-06-08T09:55:44.7654192Z","roleScopeTagIds": REDACTED}]}

Configuration

-OS: Windows 11
-Architecture x64
Name Value


PSVersion 5.1.22621.4111
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.4111
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Other information

If one:
$response= Get-MgDeviceManagementDeviceConfiguration -All
$response.Count returns 54

This is the same count for:
$response = Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/v1.0/deviceManagement/deviceConfigurations"

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions