-
Notifications
You must be signed in to change notification settings - Fork 211
Closed
Labels
Description
Describe the bug
Hi,
I am trying to update user's skills with the following script in PowerShell. The account I'm using is Global Admin.
Connect-MgGraph -Scopes "User.ReadWrite.All" "User.ReadWrite" "Directory.ReadWrite.All"
Update-MgUser -UserId "[email protected]" -Skills @("Test")
I am able to update the profile of the account that I logged in. For example, when I logged in as [email protected]
, I can change the skill with Update-MgUser -UserId "[email protected]" -Skills @("Test")
.
However, I encountered the error if I want to change others' skills. The error message is as follows.
Update-MgUser : Attempted to perform an unauthorized operation.
Status: 500 (InternalServerError)
ErrorCode: -1, Microsoft.Office.Server.Directory.DirectoryObjectUnauthorizedAcc
essException
Date: 2025-03-21T05:31:56
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 7b2e96b1-a67c-4271-bb86-f07797e11ad0
client-request-id : 978498a8-a555-43bc-863d-21d3e49c875e
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Japan East","Slice
":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"TY1PEPF00014570"}}
Cache-Control : max-age=0, private
Date : Fri, 21 Mar 2025 05:31:56 GMT
位於 線路:1 字元:1
+ Update-MgUser -UserId "[email protected]" -Skill ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ({ UserId = Quin...softGraphUs
er }:<>f__AnonymousType49`3) [Update-MgUser_UpdateExpanded],Exception
+ FullyQualifiedErrorId : -1, Microsoft.Office.Server.Directory.DirectoryO
bjectUnauthorizedAccessException,Microsoft.Graph.PowerShell.Cmdlets.Update
MgUser_UpdateExpanded
Thanks you!
Expected behavior
Update user's skills with PowerShell.
How to reproduce
Connect-MgGraph -Scopes "User.ReadWrite.All" "User.ReadWrite" "Directory.ReadWrite.All"
Update-MgUser -UserId "[email protected]" -Skills @("Test")
([email protected]
should be different to the account that you log in to PowerShell.)
SDK Version
No response
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
```</details>
### Configuration
_No response_
### Other information
_No response_