How can i import the Extension Attributes from Azure Active Directory from Powershell?

Marcos Nahuel Espínola 20 Reputation points
2023-12-20T18:22:01.49+00:00

When i do the connection with portal Azure in portal in powershell for Import de data users as csv i do this:

C:\Users\Get-AzADUser

Then, the powershell perform de download of a large ammount of attributes for each user.

"AccountEnabled","AgeGroup","ApproximateLastSignInDateTime","BusinessPhone","City","CompanyName","ComplianceExpirationDateTime","ConsentProvidedForMinor","Country","CreatedDateTime","CreationType","DeletedDateTime","Department","DeviceVersion","DisplayName","EmployeeHireDate","EmployeeId","EmployeeOrgData","EmployeeType","ExternalUserState","ExternalUserStateChangeDateTime","FaxNumber","GivenName","Id","Identity","ImAddress","IsResourceAccount","JobTitle","LastPasswordChangeDateTime","LegalAgeGroupClassification","Mail","MailNickname","Manager","MobilePhone","OdataId","OdataType","OfficeLocation","OnPremisesImmutableId","OnPremisesLastSyncDateTime","OnPremisesSyncEnabled","OperatingSystem","OperatingSystemVersion","OtherMail","PasswordPolicy","PasswordProfile","PhysicalId","PostalCode","PreferredLanguage","ProxyAddress","ShowInAddressList","SignInSessionsValidFromDateTime","State","StreetAddress","Surname","TrustType","UsageLocation","UserPrincipalName","UserType","AdditionalProperties"

However, I don't see the AD "Extension attributes" being imported into the csv.

ejemploAAD

How can I extract the information from the "extension attributes" part and attach it to the other columns that are imported? Exists any method in powershell for performs what i want?

Windows for business | Windows Server | User experience | PowerShell
Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

Accepted answer
  1. Thameur-BOURBITA 36,261 Reputation points Moderator
    2023-12-20T21:28:10.41+00:00

    Hi @Marcos Nahuel Espínola

    Did you try with this command :

    Get-AzureADUser -ObjectId $UserId | Select -ExpandProperty ExtensionProperty
    

    You can also try with this command Get-MgUser :

    Get-MgUser -UserId $UserId -Property onPremisesExtensionAttributes | select -ExpandProperty onPremisesExtensionAttributes
    

    The link below will help you to install and load Graph module

    Get-MgUser: Get and Export Azure AD users properties with Graph Modules


    Please don't forget to accept helpful answer


1 additional answer

Sort by: Most helpful
  1. Givary-MSFT 35,621 Reputation points Microsoft Employee Moderator
    2023-12-21T04:06:48.6833333+00:00

    @Marcos Nahuel Espínola Adding to the above answer, there are few examples shared in this article - https://learn.microsoft.com/en-us/powershell/azure/active-directory/using-extension-attributes-sample?view=azureadps-2.0 where we can retrieve the extension attributes defined for the user account.

    Let me know if you have further questions, feel free to post back.

    0 comments No comments

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.