2

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.

TPL
  • 43
  • 1
  • 1
  • 5

1 Answers1

2

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

Joy Wang
  • 39,905
  • 3
  • 30
  • 54
  • Awesome, thanks. Do you know where the field name list for these kind of filter requests is stored? This because the attribute name from the GraphExplorer is different. Thanks again! – TPL Aug 15 '19 at 18:18
  • @TPL Because the command calls AAD Graph, not MS Graph, See - https://learn.microsoft.com/en-us/previous-versions/azure/ad/graph/api/entity-and-complex-type-reference#device-entity – Joy Wang Aug 16 '19 at 01:01
  • Awesome, thanks. I had known this a while ago, but then promptly forgot it. Thanks again, big help. – TPL Aug 19 '19 at 14:01