Forum Discussion
Azure AD extension attributes from AD Connect
juliansperling
Thank you, that has gotten me most of the way there. I can see the value of the property using the code you helpfully provided. Now I'm trying to figure out how to change the property value.
update-mguser -userid $user -additionalproperties @{$extensionValue="yyyyyyyyy"}
is what I've been working with, but it doesn't seem to be doing what I want.
Related question, with
$user | select Displayname, AdditionalProperties
the Additional Properties is cut off; is there an easy way to get it to display the whole hash table?
- juliansperlingDec 08, 2023Brass Contributor
EStrong9 Hi, I happen to have used this as a jump off point for a full blog Post - https://sparrowte.ch/index.php/en/2023/12/07/391/
However your follow up question will lead me to make a few edits since I recognize I could extend the Documentation a bit 🙂I also have how to update them in there, but I can't recommend doing that if you are synchronising them from OnPremises - you might run into conflicts with your Entra ID (AAD) connect sync down the line, that should be done by manipulating the base Properties in Active Directory
To the related note (and why I should work on my Naming and Documentation):
$extensionValue is not the Value of the extension, it defines a custom Property in Select-Object to handle exactly the issue you described - it tells select-Object to Take the Value from Additionalproperties, so the select statement you are looking for is
$extensionValue = @{Name = "$($extension.Name)"; Expression = {$_.AdditionalProperties.$($extension.Name)}} $user | select Displayname, $extensionValue | ft
If you have multiple Values in $AdditionalProperties you can define more Custom Expressions for Select - see https://learn.microsoft.com/en-us/powershell/scripting/samples/selecting-parts-of-objects--select-object-?view=powershell-7.4 for example.
- EStrong9Dec 19, 2023Copper Contributor
Short version: no love, scrapping this part of the project.
Slightly longer version: I looked at your site and pulled the part about building out the param array and assigning it. Ran it on my test user, got some errors. Modified things, got it to run without errors. Went to check for the value. No value in the property. Went back and did more checking. With the previous background of the SSO that keys off the property value works and continues to work, I ran the select statement as you provided earlier, and it continued to return the correct value... for my account. On all other accounts I tested, not a single one returned a value at all. When I dug down into it, and checked the Additional Properties on all those accounts, all of them had the default context and that's it.
I don't know why. They can sign in, so the information contained within the additional properties field of my account of that extension value is there, somewhere, but I can't find it.
But all this was primarily to be a short workaround for an more onerous way of getting a service account access, and it is providing to be less short and straightforward than is probably worth it.- juliansperlingDec 19, 2023Brass ContributorMy condolences! To me the issue sounds like you did not have permissions to view the other users - How did you connect to Microsoft Graph and did you use Get-MgContext to check whether you had the required permissions? Either way, I wish you the best of luck on any further endeavours.
- juliansperlingDec 17, 2023Brass ContributorHi, if there are no further issues would you be so kind as to mark one of my Replys as the best Answer? This will help people with a similar issue finding the solution in future.