Forum Discussion

Alex69570's avatar
Alex69570
Copper Contributor
May 25, 2022

AzureAD MSGraph Add user in Administrative Unit

HI !

 

I use a powershell script to create users in my Azure environnement and I want to put each one of them in a specific Administrative unit.

 

For technical reasons I must do this with powershell core 7 and MS graph api because it's in an app.

I have all credentials to read and write with my app in Administrative Unit

 

For the moment I can read the administrative units, but whan I want to add an user in one of them I have always the same error (400) invalide request.

 

My code :

$UriAAU = https://graph.microsoft.com/v1.0/directory/administrativeUnits/{Administrative unit Id}/members/{user id}"
$AddUserAAU = Invoke-RestMethod -Uri $UriAAU -Method POST -Headers $authorization -Verbose:$false -ContentType "application/json"

 

$UriAAU return a valid Uri with Administrative unit and user id.

 

Did someone ever try that ? did it worked ?

 

Thank you !!

Alex69570

 

 

 

No RepliesBe the first to reply

Resources