Unauthorized - 401 on powershell and graph explorer #3003
Replies: 3 comments 1 reply
-
Try adding these scopes: DeviceManagementServiceConfig.ReadWrite.All, DeviceManagementServiceConfig.Read.All Source: |
Beta Was this translation helpful? Give feedback.
-
hello everyone |
Beta Was this translation helpful? Give feedback.
-
CDX tenant related issue |
Beta Was this translation helpful? Give feedback.
-
Is anyone else having issues authenticating graph API
on graph explorer
https://graph.microsoft.com/v1.0//deviceManagement/managedDevices/
logged as global admin
permissions consented
DeviceManagementManagedDevices.Read.All
DeviceManagementConfiguration.Read.All
DeviceManagementConfiguration.ReadWrite.All
DeviceManagementManagedDevices.ReadWrite.All
error
{
"error": {
"code": "UnknownError",
"message": "{"ErrorCode":"Forbidden","Message":"{\r\n \"_version\": 3,\r\n \"Message\": \"An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 69f89bd0-877a-faa4-3866-44d8d89438ca - Url: https://fef.amsua0602.manage.microsoft.com/DeviceFE/StatelessDeviceFEService/deviceManagement/managedDevices?api-version=2023-10-19\\\",\\r\\n \"CustomApiErrorPhrase\": \"\",\r\n \"RetryAfter\": null,\r\n \"ErrorSourceService\": \"\",\r\n \"HttpHeaders\": \"{\\\"WWW-Authenticate\\\":\\\"Bearer\\\"}\"\r\n}","Target":null,"Details":null,"InnerError":null,"InstanceAnnotations":[]}",
"innerError": {
"date": "2024-10-18T18:04:58",
"request-id": "8550d6dd-f6f7-4a7b-bbb2-d18a99c1c1ed",
"client-request-id": "69f89bd0-877a-faa4-3866-44d8d89438ca"
}
}
}
response headers
{
"client-request-id": "69f89bd0-877a-faa4-3866-44d8d89438ca",
"content-type": "application/json",
"request-id": "8550d6dd-f6f7-4a7b-bbb2-d18a99c1c1ed"
}
same error with
Import-Module Microsoft.Graph.DeviceManagement
Get-MgDeviceManagementManagedDevice
#powershell automation is broken
Get-MgDeviceManagementWindowsAutopilotDeviceIdentity : {"ErrorCode":"Forbidden","Message":"{\r\n "_version": 3,\r\n "Message": "An error has occurred - Operation ID (for
customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 1ae0fe62-b10a-45b2-a8ca-3952cb2c9a30 - Url:
https://fef.amsua0602.manage.microsoft.com/DeviceEnrollmentFE/StatelessDeviceEnrollmentFEService/deviceManagement/windowsAutopilotDeviceIdentities?api-version=2024-03-21\",\r\n
"CustomApiErrorPhrase": "",\r\n "RetryAfter": null,\r\n "ErrorSourceService": "",\r\n "HttpHeaders":
"{\"WWW-Authenticate\":\"Bearer\"}"\r\n}","Target":null,"Details":null,"InnerError":null,"InstanceAnnotations":[]}
Status: 401 (Unauthorized)
ErrorCode: UnknownError
Date: 2024-10-18T17:53:32
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 864f60a5-43cf-4123-87e8-734b082aeccc
client-request-id : 1ae0fe62-b10a-45b2-a8ca-3952cb2c9a30
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Canada Central","Slice":"E","Ring":"3","ScaleUnit":"000","RoleInstance":"TO1PEPF00006AD3"}}
Date : Fri, 18 Oct 2024 17:53:31 GMT
At C:\Temp\PSH\1\Scripts\Mismatch-ENTRA-ADDS-INTUNE-WinAutoPilot.ps1:26 char:5
Get-MgDeviceManagementManagedDevice : {"ErrorCode":"Forbidden","Message":"{\r\n "_version": 3,\r\n "Message": "An error has occurred - Operation ID (for customer support):
00000000-0000-0000-0000-000000000000 - Activity ID: b1939a2f-ee74-4cc6-9acb-f2c87bed9b69 - Url:
https://fef.amsua0602.manage.microsoft.com/DeviceFE/StatelessDeviceFEService/deviceManagement/managedDevices?api-version=2023-10-19\",\r\n "CustomApiErrorPhrase": "",\r\n
"RetryAfter": null,\r\n "ErrorSourceService": "",\r\n "HttpHeaders":
"{\"WWW-Authenticate\":\"Bearer\"}"\r\n}","Target":null,"Details":null,"InnerError":null,"InstanceAnnotations":[]}
Status: 401 (Unauthorized)
ErrorCode: UnknownError
Date: 2024-10-18T17:53:33
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : b71f6590-7150-4d29-9d64-c07775597e0b
client-request-id : b1939a2f-ee74-4cc6-9acb-f2c87bed9b69
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Canada Central","Slice":"E","Ring":"3","ScaleUnit":"000","RoleInstance":"TO1PEPF00006AD3"}}
Date : Fri, 18 Oct 2024 17:53:32 GMT
At C:\Temp\PSH\1\Scripts\Mismatch-ENTRA-ADDS-INTUNE-WinAutoPilot.ps1:29 char:5
started 10/18/2025 past 12:15 AM EST
Beta Was this translation helpful? Give feedback.
All reactions