Access denied error when attempting to update device ownership #3076
Labels
status:waiting-for-triage
An issue that is yet to be reviewed or assigned
type:bug
A broken experience
Describe the bug
I am trying to programatically update the device ownership from personal to corporate for some misidentified machines. To replicate the error, I am presently a global admin and running the following:
The line to update the device category works as expected. The line to update deviceownership fails with the following error:
Expected behavior
updating both the device category and the device ownership should work.
How to reproduce
I am trying to programatically update the device ownership from personal to corporate for some misidentified machines. To replicate the error, I am presently a global admin and running the following:
The line to update the device category works as expected. The line to update deviceownership fails with the following error:
SDK Version
2.25.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
``` DEBUG: [CmdletBeginProcessing]: - Update-MgDevice begin processing with parameterSet 'UpdateExpanded'. DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'. DEBUG: [Authentication]: - Scopes: [Application.ReadWrite.All, AttackSimulation.Read.All, AttackSimulation.ReadWrite.All, ChannelMessage.Send, Chat.Create, Chat.ReadWrite, Device.ReadWrite.All, DeviceManagementManagedDevices.ReadWrite.All, DeviceManagementServiceConfig.ReadWrite.All, Directory.AccessAsUser.All, Directory.ReadWrite.All, Group.ReadWrite.All, GroupMember.ReadWrite.All, openid, profile, User.Read, User.Read.All, User.ReadWrite.All, email].Confirm
Are you sure you want to perform this action?
Performing the operation "Update-MgDevice_UpdateExpanded" on target "Call remote 'PATCH /devices/{device-id}' operation".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): a
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
PATCH
Absolute Uri:
https://graph.microsoft.com/v1.0/devices/03ef0d01-06eb-4989-929c-a4f535bdcf68
Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26100; en-US),PowerShell/2024.4.0
Accept-Encoding : gzip
SdkVersion : graph-powershell/2.25.0
client-request-id : aea8c34d-e482-4746-ab6a-dc3d9bb6a234
Body:
{
"deviceOwnership": "company"
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
Forbidden
Headers:
Cache-Control : no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : ea1a3f55-d471-4319-b98b-2026df312631
client-request-id : aea8c34d-e482-4746-ab6a-dc3d9bb6a234
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Canada Central","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"YT1PEPF00001ABB"}}
x-ms-resource-unit : 1
Date : Fri, 17 Jan 2025 20:30:34 GMT
Body:
{
"error": {
"code": "Authorization_RequestDenied",
"message": "Insufficient privileges to complete the operation.",
"innerError": {
"date": "2025-01-17T20:30:35",
"request-id": "ea1a3f55-d471-4319-b98b-2026df312631",
"client-request-id": "aea8c34d-e482-4746-ab6a-dc3d9bb6a234"
}
}
}
Update-MgDevice_UpdateExpanded: Insufficient privileges to complete the operation.
Status: 403 (Forbidden)
ErrorCode: Authorization_RequestDenied
Date: 2025-01-17T20:30:35
Headers:
Cache-Control : no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : ea1a3f55-d471-4319-b98b-2026df312631
client-request-id : aea8c34d-e482-4746-ab6a-dc3d9bb6a234
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Canada Central","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"YT1PEPF00001ABB"}}
x-ms-resource-unit : 1
Date : Fri, 17 Jan 2025 20:30:34 GMT
DEBUG: [CmdletEndProcessing]: - Update-MgDevice end processing.
The text was updated successfully, but these errors were encountered: