PreferredDataLocation and AzureAD cmdlets

It looks like the AzureAD cmdlets don’t show all the attributes available to a user. And unlike on-prem AD cmdlets there’s no switch to specify additional properties you are interested in so it can pull those.

Case in hand, I was interested in viewing the PreferredDataLocation attribute. This is used for multi-geo configurations. You can transform an on-prem attribute to this one, or in the case of Server 2019 and later use the msDS-preferredDataLocation attribute to map to this. Thing is, I was doing some OneDrive geo moves and getting errors about this attribute not being set. Initially I thought I’d have to look in the extended attributes section:

But that didn’t return anything. Then a colleague pointed out this is a regular Azure AD attribute and so I tried to find there but had no luck. Graph API v1.0 too didn’t return anything (https://graph.microsoft.com/v1.0/users/<user>?$select=PreferredDataLocation)… so naturally I started Googling. :)

That’s when I realized you can see this via the MSOnline cmdlets. Thus the following works:

Sounds like this is intentional behaviour maybe and that the AzureAD cmdlets don’t return all attributes? I found another post where someone was asking for the Manager attribute.

In terms of Graph it turns out the Beta API returns this attribute. Heck, the Beta API returns more attributes by default without you even having to ask for it. Weird.

It’s so irritating when things are half-baked.

Update: There’s even Microsoft documentation that suggest the Graph v1.0 API returns this!

No, this does not work:

But the Beta API works: