Export user including an extensionproperty

IRUKT 101 Reputation points
2020-12-11T17:16:36.043+00:00

I'm trying to get a full export of AzureAD users including an extension property called 'staffNo'.

If I do the following for one user, I can see that it's there.

Get-AzureADUser -ObjectId ******@domain.com | select -ExpandProperty extensionproperty

However, I haven't been able to work out how I can select the staffNo object to be exported for all users when I do the following.

Get-AzureADUser -All $true |  Select-Object givenname,surname,mail,mobile,staffNo | export-csv C:\export.csv

The staffNo is blank. How do I include the staffNo extensionproperty in the output?

Thanks

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

Accepted answer
  1. IRUKT 101 Reputation points
    2020-12-14T21:01:23.653+00:00

    I worked it out. I just needed to add the extension propery into the selected attributes for the output in the format below.

     Get-AzureADUser -All $true |  Select-Object givenname,surname,mail,mobile,{$_.ExtensionProperty["staffNo"]}| export-csv C:\export.csv
    
    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Andreas Baumgarten 123.5K Reputation points MVP Volunteer Moderator
    2020-12-11T17:49:14.017+00:00

    Maybe this helps?

    https://learn.microsoft.com/en-us/powershell/module/azuread/get-azureaduserextension?view=azureadps-2.0
    https://learn.microsoft.com/de-de/schooldatasync/locate-extension-attributes-for-users#viewing-extension-attributes (Example 2)

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    2 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.