Cannot add or remove Registered Device Owner despite global admin and Device.ReadWrite.All
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 30/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- powershell
調査の方向性
まず、レポートに示されている POST および DELETE の registeredOwners/$ref エンドポイントに対して、記載されている委任スコープを使用して New-MgDeviceRegisteredOwnerByRef と Remove-MgDeviceRegisteredOwnerDirectoryObjectByRef の呼び出しを再現します。必要なアクセス許可を 403 応答と比較します。所有者を追加および削除できるか、エラーによって不足しているアクセス許可が特定されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
I am trying to add and remove device owners using New-MgDeviceRegisteredOwnerByRef and Remove-MgDeviceRegisteredOwnerDirectoryObjectByRef. But I am getting "Insufficient privileges to complete the operation."
This is despite confirming that I am Global Administrator and have the Device.ReadWrite.All and Directory.ReadWrite.All scopes.
(I can read the device owner fine.)
Expected behavior
I expect the owner of the device to actually change.
Secondly, I want the error message to point to what permission is needed so I can activate that.
How to reproduce
$ownermg = Get-MgUser -UserId "[email protected]"
$devicemg = Get-MgDevice -Filter "displayName eq 'win11'"
(Get-MgUser -UserId (Get-MgDeviceRegisteredOwner -DeviceId $devicemg.id).id) | Select-Object DisplayName, UserPrincipalName
New-MgDeviceRegisteredOwnerByRef -DeviceId $devicemg.id -BodyParameter @{ "@odata.id" = "https://graph.microsoft.com/v1.0/users/$($ownermg.id)" } -Debug
{error insufficient privileges}
Remove-MgDeviceRegisteredOwnerDirectoryObjectByRef -DeviceId $devicemg.id -DirectoryObjectId $ownermg.id -Debug
{error insufficient privileges}
SDK Version
2.25.0 and 2.28.0
Latest version known to work for scenario above?
n/a
Known Workarounds
none
Debug output
Click to expand log for "add/new"
DEBUG: [CmdletBeginProcessing]: - New-MgDeviceRegisteredOwnerByRef begin processing with parameterSet 'Create'.
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [AdministrativeUnit.Read.All, AdministrativeUnit.ReadWrite.All, Device.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All, Group.Read.All, Group.ReadWrite.All, IdentityRiskEvent.Read.All, IdentityRiskyUser.ReadWrite.All, openid, Policy.Read.All, PrivilegedAccess.ReadWrite.AzureADGroup, PrivilegedAssignmentSchedule.ReadWrite.AzureADGroup, profile, RoleAssignmentSchedule.ReadWrite.Directory, RoleEligibilitySchedule.ReadWrite.Directory, RoleManagement.ReadWrite.Directory, RoleManagementPolicy.Read.AzureADGroup, RoleManagementPolicy.ReadWrite.AzureADGroup, Team.ReadBasic.All, TeamMember.Read.All, User.Read, User.Read.All, User.ReadWrite.All, email].
Confirm
Are you sure you want to perform this action?
Performing the operation "New-MgDeviceRegisteredOwnerByRef_Create" on target "Call remote 'POST /devices/{device-id}/registeredOwners/$ref' operation".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST
Absolute Uri:
https://graph.microsoft.com/v1.0/devices/{guid}/registeredOwners/$ref
Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22631; en-US),PowerShell/2025.0.0
SdkVersion : graph-powershell/2.28.0
client-request-id : {guid}
Accept-Encoding : gzip,deflate,br
Body:
{
"@odata.id": "https://graph.microsoft.com/v1.0/users/{guid}"
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
Forbidden
Headers:
Cache-Control : no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : {guid}
client-request-id : {guid}
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"US","Slice":"E","Ring":"4","ScaleUnit":"002","RoleInstance":"CH01"}}
x-ms-resource-unit : 1
Date : Wed, 21 May 2025 16:58:02 GMT
Body:
{
"error": {
"code": "Authorization_RequestDenied",
"message": "Insufficient privileges to complete the operation.",
"innerError": {
"date": "2025-05-21T16:58:02",
"request-id": "{guid}",
"client-request-id": "{guid}"
}
}
}
New-MgDeviceRegisteredOwnerByRef_Create: Insufficient privileges to complete the operation.
Status: 403 (Forbidden)
ErrorCode: Authorization_RequestDenied
Date: 2025-05-21T16:58:02
Headers:
Cache-Control : no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : {guid}
client-request-id : {guid}
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"US","Slice":"E","Ring":"4","ScaleUnit":"002","RoleInstance":"CH01"}}
x-ms-resource-unit : 1
Date : Wed, 21 May 2025 16:58:02 GMT
Recommendation: See service error codes: https://learn.microsoft.com/graph/errors
DEBUG: [CmdletEndProcessing]: - New-MgDeviceRegisteredOwnerByRef end processing.
Click to expand log for "remove"
DEBUG: [CmdletBeginProcessing]: - Remove-MgDeviceRegisteredOwnerDirectoryObjectByRef begin processing with parameterSet 'Delete'.
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [AdministrativeUnit.Read.All, AdministrativeUnit.ReadWrite.All, Device.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All, Group.Read.All, Group.ReadWrite.All, IdentityRiskEvent.Read.All, IdentityRiskyUser.ReadWrite.All, openid, Policy.Read.All, PrivilegedAccess.ReadWrite.AzureADGroup, PrivilegedAssignmentSchedule.ReadWrite.AzureADGroup, profile, RoleAssignmentSchedule.ReadWrite.Directory, RoleEligibilitySchedule.ReadWrite.Directory, RoleManagement.ReadWrite.Directory, RoleManagementPolicy.Read.AzureADGroup, RoleManagementPolicy.ReadWrite.AzureADGroup, Team.ReadBasic.All, TeamMember.Read.All, User.Read, User.Read.All, User.ReadWrite.All, email].
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-MgDeviceRegisteredOwnerDirectoryObjectByRef_Delete" on target "Call remote 'DELETE /devices/{device-id}/registeredOwners/{directoryObject-id}/$ref' operation".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
DELETE
Absolute Uri:
https://graph.microsoft.com/v1.0/devices/{guid}/registeredOwners/{guid}/$ref
Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22631; en-US),PowerShell/2025.0.0
SdkVersion : graph-powershell/2.28.0
client-request-id : {guid}
Accept-Encoding : gzip,deflate,br
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
Forbidden
Headers:
Cache-Control : no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : {guid}
client-request-id : {guid}
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"US","Slice":"E","Ring":"4","ScaleUnit":"002","RoleInstance":"CH01"}}
x-ms-resource-unit : 1
Date : Wed, 21 May 2025 16:58:09 GMT
Body:
{
"error": {
"code": "Authorization_RequestDenied",
"message": "Insufficient privileges to complete the operation.",
"innerError": {
"date": "2025-05-21T16:58:10",
"request-id": "{guid}",
"client-request-id": "{guid}"
}
}
}
Remove-MgDeviceRegisteredOwnerDirectoryObjectByRef_Delete: Insufficient privileges to complete the operation.
Status: 403 (Forbidden)
ErrorCode: Authorization_RequestDenied
Date: 2025-05-21T16:58:10
Headers:
Cache-Control : no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : {guid}
client-request-id : {guid}
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"US","Slice":"E","Ring":"4","ScaleUnit":"002","RoleInstance":"CH01"}}
x-ms-resource-unit : 1
Date : Wed, 21 May 2025 16:58:09 GMT
Recommendation: See service error codes: https://learn.microsoft.com/graph/errors
DEBUG: [CmdletEndProcessing]: - Remove-MgDeviceRegisteredOwnerDirectoryObjectByRef end processing.
Configuration
- OS: Windows 11 x64
- no docker
- PSVersion 7.5.1
- PSEdition Core
- GitCommitId 7.5.1
- OS Microsoft Windows 10.0.22631
- Platform Win32NT
- PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
- PSRemotingProtocolVersion 2.3
- SerializationVersion 1.1.0.1
- WSManStackVersion 3.0
Other information
No response
- 主要言語
- C#
- スター
- 901
- フォーク
- 232
- 平均マージ
- 2日 1時間
- マージ済み PR(30日)
- 26
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoftgraph/msgraph-sdk-powershell のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoftgraph/msgraph-sdk-powershell#3752 ·
メンテナーはふだん 2 日以内に返信
-
status:waiting-for-triage type:feature
難易度 5/5 1週間以上 初心者へのやさしさ 8/100
microsoftgraph/msgraph-sdk-powershell#3827 ·
メンテナーはふだん 2 日以内に返信
-
status:waiting-for-triage type:bug
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
microsoftgraph/msgraph-sdk-powershell#3822 ·
メンテナーはふだん 2 日以内に返信
-
Microsoft.Graph.Authentication dependency Microsoft.Graph.Authentication.Loader.dll is unsignedオープンstatus:waiting-for-triage type:bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
microsoftgraph/msgraph-sdk-powershell#3819 ·
メンテナーはふだん 2 日以内に返信
-
Connect-MgGraph on 2.41 crashes when making a connection with cert, fixes when using 2.39 or lowerオープンstatus:waiting-for-triage type:bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
microsoftgraph/msgraph-sdk-powershell#3816 ·
メンテナーはふだん 2 日以内に返信
microsoftgraph/msgraph-sdk-powershell の issue をすべて見る
似ている issue
-
documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: Edit Bar buttons are not localized対応中かも @idumlupinar が今日担当しました。 オープンStatus: New
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
dnnsoftware/Dnn.Platform#7565 ·
メンテナーはふだん 1 日以内に返信
-
AzureBlobSnapshotStore.LoadAsync allocates the snapshot twice (growable MemoryStream + ToArray)オープンenhancement
難易度 2/5 半日 初心者へのやさしさ 72/100
-
bug ui-only
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ClickHouse/clickhouse-cs#689 ·
メンテナーはふだん 2 日以内に返信