Iterating Over AzureAD Extention Propeties

I’m trying to update my company’s employee’s ID numbers in Azure. We’re cloud only so it’s all through Microsoft 365. I’m specifically trying to update this attribute:

Azure AD cmdlts | Microsoft Docs

Set-AzureADUserExtension (AzureAD) | Microsoft Docs

I’m not the best with writing loops so I came up with this:

Import-CSV D:\Documents\EmployeeID.csv | % { Set-AzureADUserExtension -ObjectId $_.Email.ObjectId -ExtensionName employeeId -ExtensionValue $_.employeeID }

It’s not quite working out, I think I’m missing something obvious…

My .csv has two columns; email & employeeID.

@Dan_Golden Welcome to forums.

$_.Email.ObjectId might be causing the problem. Email is the columns in your CSV and you don’t need to use anything else like ObjectId, just use $_.Email.

That doesn’t quite work. I’m returned with “Cannot run a document in the middle of a pipeline.”

Set-AzureADUserExtension is requiring .ObjectID to verify the user principle name. I’m just confused how to properly store it as a variable I guess so this cmdlet understands what I’m trying to do lol

Import-Csv is missing in the second execution.

I need to get some sleep. Thank you.

You are a gentleman and a scholar.