question

NathanB-1057 avatar image
0 Votes"
NathanB-1057 asked

Powershell AzureAD Get-AzureADUser

Im trying to use Get-AzureADUser to get a list of users that dont and do have alternate email set.

The API endpoint for this is

https://graph.microsoft.com/v1.0/users?$count=true&$filter=otherMails/$count eq 0

How do I do this in Powershell?

Thanks

azure-active-directoryazure-ad-authentication
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

michev avatar image
0 Votes"
michev answered NathanB-1057 commented

This query only works with ConsistencyLevel=eventual, and I'm not aware of any way to pass this via the Azure AD module. Use client-side filtering instead?

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for getting back to me. B y client side filtering do you mean take the result of get all users and filter via bash or another language?

I would be happy to use the graph api with https://graph.microsoft.com/v1.0/users?$count=true&$filter=otherMails/$count eq 0

However I get an error when using the graph explorer.

"message": "Unsupported or invalid query filter clause specified for property 'otherMails' of resource 'User'.",

0 Votes 0 ·

Did you add the header?

113887-image.png


0 Votes 0 ·
image.png (12.8 KiB)

Thank you I was missing this header. Request now working as expected.

0 Votes 0 ·