msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Add other operating system to disable device from update-mgdevice command

Open freestyll opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? Please describe the problem.

I try to disable a device with the command : update-mgdevice -deviceid "IDofTheDevice" -AccountEnabled:$false

But I get that answer when I tried for an Android or iOS device : Update-MgDevice_UpdateExpanded: Properties other than ExtendedAttribute1..15 can be modified only on windows devices.

For a windows device : success

Describe the solution you'd like.

Add android and iOS capabilities for that update-device command, we should have the same capabilities between shell command and from azure portal.

Additional context?

No response

freestyll avatar May 07 '24 12:05 freestyll

Hi @freestyll ,

Could you please execute the cmdlet in a debug mode (-debug) and share the log? Thanks!

petrhollayms avatar May 17 '24 15:05 petrhollayms

Hello, Yes I got that answer :

`DEBUG: [CmdletBeginProcessing]: - Update-MgDevice begin processing with parameterSet 'Update'. DEBUG: [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientSecret', ContextScope: 'Process', AppName: '***************'. DEBUG: [Authentication]: - Scopes: [Device.ReadWrite.All, WindowsUpdates.ReadWrite.All, User.Read.All, DeviceManagementServiceConfig.ReadWrite.All, DeviceManagementManagedDevices.ReadWrite.All, DeviceManagementConfiguration.ReadWrite.All].

Confirm Are you sure you want to perform this action? Performing the operation "Update-MgDevice_Update" 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"): Y DEBUG: ============================ HTTP REQUEST ============================

HTTP Method: PATCH

Absolute Uri: https://graph.microsoft.com/v1.0/devices/************************

Headers: FeatureFlag : 00000043 Cache-Control : no-store, no-cache User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22631; fr-CA),PowerShell/2024.2.1 Accept-Encoding : gzip SdkVersion : graph-powershell/2.15.0 client-request-id : *************************

Body: { "accountEnabled": false }

DEBUG: ============================ HTTP RESPONSE ============================

Status Code: BadRequest

Headers: Cache-Control : no-cache Vary : Accept-Encoding Strict-Transport-Security : max-age=31536000 request-id : ************************** client-request-id : ************************** x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Canada East","Slice":"E","Ring":"3","ScaleUnit":"002","RoleInstance":"QB1PEPF00001143"}} x-ms-resource-unit : 1 Date : Fri, 17 May 2024 15:49:49 GMT

Body: { "error": { "code": "Request_BadRequest", "message": "Properties other than ExtendedAttribute1..15 can be modified only on windows devices.", "innerError": { "date": "2024-05-17T15:49:50", "request-id": "***********************", "client-request-id": "*************************" } } }

Update-MgDevice_Update: Properties other than ExtendedAttribute1..15 can be modified only on windows devices.

Status: 400 (BadRequest) ErrorCode: Request_BadRequest Date: 2024-05-17T15:49:50

Headers: Cache-Control : no-cache Vary : Accept-Encoding Strict-Transport-Security : max-age=31536000 request-id : ********************** client-request-id : ********************** x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Canada East","Slice":"E","Ring":"3","ScaleUnit":"002","RoleInstance":"QB1PEPF00001143"}} x-ms-resource-unit : 1 Date : Fri, 17 May 2024 15:49:49 GMT

DEBUG: [CmdletEndProcessing]: - Update-MgDevice end processing.`

Thank you

freestyll avatar May 17 '24 15:05 freestyll

Ok, thanks for sharing!

This appears to be an issue or limitation with the service APIs. Unfortunately, as the Microsoft Graph SDK team, we do not have ownership of the APIs that are causing you issues. We invite you to create a question about the service API to Microsoft Q&A and tagged with one of the [microsoft-graph-*] tags, that way it will get routed to the appropriate team for them to triage:

https://aka.ms/msgraphsupport or directly https://aka.ms/askgraph

petrhollayms avatar May 21 '24 14:05 petrhollayms

Yes exactly, this is a limitation, sadly what we can do from Web GUI aren't the same with API. Following your advice, I will create a question about API to Microsoft Q&A. Thank you for your helps.

freestyll avatar May 21 '24 14:05 freestyll