I found another related question. Why does 'Get-AzureADUser -ObjectID User@domain.net' display data for MailNickname but 'Get-MgUser -UserID User@domain.net' shows the field as blank? Should I pose this as a separate question?
Using Get-MgUser to query on multiple -Search criteria
I am attempting to replicate a Get-AzureADUser command using Get-MgUser. The previous command (Get-AzureADUser -Top 5000 | Where-Object {($.AccountEnabled -eq "True") -and (($.CompanyName -eq "CompA" -or $.CompanyName -eq "CompB" -or $.CompanyName -eq "CompC" -or $_.CompanyName -eq "CompD"))} | Select UserPrincipalName) selected the desired accounts. I have gotten this far with the replacement: Get-MgUser -All -Filter "AccountEnabled eq true" -Search "CompanyName:CompA" -ConsistencyLevel: eventual | Select UserPrincipalName
I have been unsuccessful in adding more search options for the CompanyName field. How do I use the -Search option to search for multiple values?