foreach ($line in $userlist) {
$upn = $line.UserPrincipalName
Get-AzureADUser -Filter “userPrincipalName eq ‘$upn’”
}
then don’t work, what is the reason, compilation says that
Get-AzureADUser : Error occurred while executing GetUsers
Code: Request_UnsupportedQuery
Message: Unsupported or invalid query filter clause specified for property ‘userPrincipalName’ of resource ‘User’.
RequestId: 28632614-1c12-4cba-8f2c-5a838783cf5d
DateTimeStamp: Wed, 11 Oct 2023 11:31:44 GMT
HttpStatusCode: BadRequest
HttpStatusDescription: Bad Request
HttpResponseStatus: Completed
At line:4 char:1
It is hard to distinguish between text, code and error message because you did not format your code as code.
So please when you post code, sample data, console output or error messages format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
Sure, I saw that. But if the column name isn’t actually called ‘UserPrincipalName’ then you will get that error. That’s why I asked you to validate the data.
the idea is that i create csv file with info that i want enter automatically into the AzureAD, in Azure AD is users but they don’t have some information that i want add from csv file. like department, mobilephone, and csv file basically has column names and data.