How do I get all the details of an Azure AD computer object?

TPL picture TPL · Aug 14, 2019 · Viewed 9.3k times · Source

Calling Get-AzureADDevice gets me three attributes. How can I get the full list of attributes for the object? Specifically, when I use the GraphApi:

https://graph.microsoft.com/v1.0/devices?$filter=startswith(operatingSystem,'Windows')`

How can I achieve the same thing in Powershell?

$aadDevices = Get-AzureADDevice -All 1 gets me the object ID, DeviceID and display name. So a filter clause on operatingSystem excepts.

What I am looking for is a list of all the computer objects in AzureAD so that I can do some automated processing.

Answer

Joy Wang picture Joy Wang · Aug 15, 2019

You need to use the -Filter "startswith(DeviceOSType,'Windows')", try the command as below.

Get-AzureADDevice -All 1 -Filter "startswith(DeviceOSType,'Windows')"

My test sample:

Get-AzureADDevice -All 0 -Top 5 -Filter "startswith(DeviceOSType,'Windows')" | ConvertTo-Json

enter image description here