Forum Discussion
Acidrs
Jul 01, 2020Copper Contributor
Wildcards using get-azureaduser
Hello, I am having a little trouble trying to query my azuread instance using powershell. I am running the follow command Get-AzureADUser -Filter "userPrincipalName eq '*@someemail....
VasilMichev
MVP
Filtering in the Graph/Azure AD is crap, no other way of putting it. They recently added few minor improvements, but there's a looooong way to go still.
Anyway, for your specific scenario, it's probably best to use the Get-AzureADDomainNameReference cmdlet, which will return a list of object "matching" given domain. You can filter the results client-side to get just the users:
Get-AzureADDomainNameReference -Name michev.info | ? {$_.ObjectType -eq "User"}
mderooij
Oct 26, 2020MVP
Get-AzureADDomainNameReference doesn't work for federated domains, so might need to resort to dumb get|where construct