SOLVED

MS Graph and AzureADUserExtension

Copper Contributor

Migration from Azure AD to MS Graph documentation, maps Set-AzureADUserExtension to Update-MgUserExtension.

 

I used to use the following command to set user's ExtensionAttribute:

 

Set-AzureADUserExtension -ObjectId <email> -ExtensionName 'extensionAttribute1' -ExtensionValue 'Test'

 

How to do that with Update-MgUserExtension?

2 Replies
best response confirmed by Konstantinos N. Chionas (Copper Contributor)
Solution
Update-MgUserExtension is not what you need here, just Update-MgUser:

$Attributes = @{
"onPremisesExtensionAttributes" = @{
"extensionAttribute1" = "bla"
"extensionAttribute2" = "bla"
} | ConvertTo-Json

Update-MgUser -UserId blabla -BodyParameter $Attributes

@Vasil Michev This worked for me, just missing closing }. Thank you.

1 best response

Accepted Solutions
best response confirmed by Konstantinos N. Chionas (Copper Contributor)
Solution
Update-MgUserExtension is not what you need here, just Update-MgUser:

$Attributes = @{
"onPremisesExtensionAttributes" = @{
"extensionAttribute1" = "bla"
"extensionAttribute2" = "bla"
} | ConvertTo-Json

Update-MgUser -UserId blabla -BodyParameter $Attributes

View solution in original post