Unable to update managers name in Azure AD

Viewed 30

I followed through.

Set-AzureADUserManager -ObjectId "df19e8e6-2ad7-453e-87f5-037f6529ae16" -RefObjectId "df19e8e6-2ad7-453e-87f5-037f6529ae16".

No Luck. Through script also unable to do.

Get-AzureADUser : Cannot bind argument to parameter 'ObjectId' because it is null.
At line:7 char:61
+ ... ger -ObjectId (Get-AzureADUser -ObjectId $row.'User Username').Object ...
+                                              ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Get-AzureADUser], ParameterBindingValidationExcep 
   tion
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Open.Azure 
   AD16.PowerShell.GetUser.
1 Answers

The error message means that $row.'User Username' does not have a value.

As a test to confirm this you could add a line to your code to write the value to the console such as Write-Host $row.'User Username'

The value expected by the Get-AzureADUser cmdlet is in fact the ObjectId so the line does not make much sense to me anyways. Why would you run a cmdlet to get the ObjectId when you already have it in $row.'User Username'.

You should either confirm that $row.'User Username' is not $null and contains the ObjectId or use one of the other alternatives outlined in the examples here.

Related