microsoftgraph / msgraph-sdk-powershell

Powershell SDK for Microsoft Graph
https://www.powershellgallery.com/packages/Microsoft.Graph
Other
678 stars 157 forks source link

Get-MgDeviceManagementManagedDevice -All -Filter "OperatingSystem in ('Windows','MacOs')" returning internal server error. #2766

Open Sumanjit092 opened 1 month ago

Sumanjit092 commented 1 month ago

Describe the bug

Get-MgDeviceManagementManagedDevice -All -Filter "OperatingSystem in ('Windows','MacOs')" and Get-MgDeviceManagementManagedDevice -All -Filter "Manufacturer in ('HP','Dell Inc.')" is returning below error. It seems to be an issue from Graph API side. In Microsoft Intune GUI, Device filter works well. Not with PowerShell module.

Example -1

Get-MgDeviceManagementManagedDevice_List: { "_version": 3, "Message": "An internal server error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 6d2a95f1-0383-4ded-b1bc-faaa9d41dcaf - Url: https://fef.amsua0502.manage.microsoft.com/DeviceFE/StatelessDeviceFEService/deviceManagement/managedDevices?api-version=2023-10-19&$filter=manufacturer+in+(%27HP%27%2c%27Dell+Inc.%27)", "CustomApiErrorPhrase": "", "RetryAfter": null, "ErrorSourceService": "", "HttpHeaders": "{}" }

Status: 500 (InternalServerError) ErrorCode: InternalServerError Date: 2024-05-30T12:28:26

Headers: Vary : Accept-Encoding Strict-Transport-Security : max-age=31536000 request-id : 1350bd1e-cbd8-4f77-9ff0-45a484c5f2cf client-request-id : 6d2a95f1-0383-4ded-b1bc-faaa9d41dcaf x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Central India","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"PN3PEPF000002A8"}} Date : Thu, 30 May 2024 12:28:25 GMT

Example 2

Get-MgDeviceManagementManagedDevice_List: { "_version": 3, "Message": "An internal server error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: f7376c98-b937-4646-a867-8a280f9f57d6 - Url: https://fef.amsua0502.manage.microsoft.com/DeviceFE/StatelessDeviceFEService/deviceManagement/managedDevices?api-version=2023-10-19&$filter=operatingSystem+in+(%27Windows%27%2c%27MacOS%27)", "CustomApiErrorPhrase": "", "RetryAfter": null, "ErrorSourceService": "", "HttpHeaders": "{}" }

Status: 500 (InternalServerError) ErrorCode: InternalServerError Date: 2024-05-30T12:27:25

Headers: Vary : Accept-Encoding Strict-Transport-Security : max-age=31536000 request-id : d8ce7af9-4e82-408d-8258-327359178b5e client-request-id : f7376c98-b937-4646-a867-8a280f9f57d6 x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Central India","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"PN3PEPF00000321"}} Date : Thu, 30 May 2024 12:27:25 GMT

Screenshot 2024-05-30 175756 Screenshot 2024-05-30 175845

Expected behavior

Get-MgDeviceManagementManagedDevice -All -Filter "OperatingSystem in ('Windows','MacOs')" should return all Microsoft Intune enrolled Windows and Mac Devices. Get-MgDeviceManagementManagedDevice -All -Filter "Manufacturer in ('HP','Dell Inc.')" should return all Microsoft Intune enrolled "Dell Inc. and HP" devices.

How to reproduce

Get-MgDeviceManagementManagedDevice -All -Filter "OperatingSystem in ('Windows','MacOs')" or Get-MgDeviceManagementManagedDevice -All -Filter "Manufacturer in ('HP','Dell Inc.')"

SDK Version

2.19.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ``` ```

Configuration

No response

Other information

No response

petrhollayms commented 1 month ago

Hi @Sumanjit092 ,

Could you please try to reproduce the issue in Graph Explorer - do you also get 500 there or do you get the data? Can you call the endpoint using the Invoke-MgGraphRequest and see if you get the same result? We're trying to understand to which extent is the issue caused by the data in your tenant, for us to see how to reproduce it.

Also, could you please try using the -Debug parameter when executing the cmdlets and share the output? Error handling and troubleshooting cmdlets | Microsoft Learn

Last question- was it working before or is it the 1st time you are trying to get the data here?

Sumanjit092 commented 1 month ago

Graph Explorer

Screenshot 2024-06-03 154534

Debug

Screenshot 2024-06-03 164200 Screenshot 2024-06-03 164228 Screenshot 2024-06-03 164253

Invoke-MgGraphRequest

image

When I extract value, I saw iOS devices in the result. Where, I have used filter only for Windows and MacOS devices

Answer:

I am using this for first time. Earlier, I was using command "Get-IntuneManagedDevice" command. If I run command as Get-MgDeviceManagementManagedDevice -All -Filter "OperatingSystem eq 'Windows' and Manufacturer eq 'HP'", it gives me intended output.

timayabi2020 commented 2 weeks ago

@Sumanjit092 thank you for logging this issue and from the screenshots you've shared (tried both on Graph explorer and the SDK itself), it seems this is an API related issue. Unfortunately for API related issues/questions we are not best placed to give an answer. Kindly raise an issue here https://developer.microsoft.com/en-us/graph/support so that the API owner can respond to it.

Sumanjit092 commented 1 week ago

I've already raised a support case. Had a several call with Microsoft Engineer and problem is not solved. TrackingID#2406030030006338