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

Get-MgDevice accepted parameter DeviceId is not relevant

Open Sumanjit092 opened this issue 1 year ago • 1 comments

Get-MgDevice -DeviceId <String> is quite confusing. As parameter accept Object Id instead of Device Id. When I query a device, Object Id output is Id.

image

I feel this is a design related issue. Accepted parameter requires a change. Command should be like Get-MgDevice -Id <String>

Sumanjit092 avatar May 24 '24 16:05 Sumanjit092

@Ndiritu The ID parameter name as composed from the entity name and "id" is confusing in this case as the device entity does also contain "deviceId" parameter and the API does allow getting it by this parameter, too. See https://learn.microsoft.com/en-us/graph/api/device-get?view=graph-rest-1.0&tabs=powershell#http-request

We're currently hiding the second request as there is no option to get the device by a real "deviceid" parameter as opposed to by ID.

CC @andrueastman

petrhollayms avatar May 27 '24 10:05 petrhollayms