Hello Jairo Javier Baleta Cali,
I understand you are trying to retrieve extended attribute values using Get-MgUser
, similar to how you previously used Get-AzureADUser
. Since Azure AD Graph has been deprecated, switching to Microsoft Graph is the right approach.
If you're referring to attributes like extensionAttribute1
, which are synced from your on-premises Active Directory through Microsoft Entra Connect, you can access them through the onPremisesExtensionAttributes
property.
Here's how you can retrieve those values:
(Get-MgUser -UserId "******@domain.com" -Property "onPremisesExtensionAttributes").onPremisesExtensionAttributes
This will return all extension attributes from 1 to 15, assuming they are properly configured and synced.
If you're referring to a custom attribute registered through an app as a schema extension (for example, extension_<AppId>_sampleid
), you can retrieve it like this:
$customProp = "extension_{appId}_sampleid1"
$user = Get-MgUser -UserId "******@domain.com" -Property $customProp
$user.AdditionalProperties[$customProp]
For this to work, the custom extension must exist on the user object. Let me know if you have any other questions or need any further assistance.
Hope this clarifies things a bit!
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful, which may help members with similar questions.
If you have any other questions or are still experiencing issues, feel free to ask in the "comments" section, and I'd be happy to help.