Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az ad user list --upn should support starts_with functionality like --display-name does #9216

Closed
lukasmrtvy opened this issue Apr 26, 2019 · 5 comments
Assignees

Comments

@lukasmrtvy
Copy link

I am not quite sure if its feature request or bug...

az ad user list --display-name "John Doe (Exter"

Will quckly find all users starting with "displayName" :"John Doe (Exter"

-> It will find John Doe (External) in this case, which is OK.

I suppose that:

az ad user list --upn "John.Doe@exa"

should do the same with "userPrincipalName" attribute

-> It will not find anyting, unless You supply full --upn name.

I understand that this is neccessary for az ad user show --upn-or-object-id to output only single result.

Is possible to use something like this:

az ad user list --query "[?starts_with(userPrincipalName,'John.Do')]"

but it takes almost 1,5 min in our environment, instead of almost instant output with az ad user list --upn "John.Doe@exa"

Thanks

@yugangw-msft
Copy link
Contributor

yugangw-msft commented Apr 26, 2019

You can use the --filter argument, e.g.

 az ad user list --filter "startswith(userPrincipalName, 'John.Doe')"

For full reference of the filter synatx, check out https://docs.microsoft.com/en-us/graph/query-parameters#filter-parameter

@yugangw-msft
Copy link
Contributor

I am pretty sure I have addressed this question, so I am closing it. Feel free to reactivate if you are still blocked

@dshamanthreddy
Copy link

Hello @yugangw-msft need help I need to list all user in AAD with displayname and email,

I m trying this way
az ad user list –query “[].{ name:displayName,mail:mail}” -o tsv

it is not display anything

can you help

@yonzhan
Copy link
Collaborator

yonzhan commented Jan 31, 2021

@jiasli could you help with above?

@jiasli
Copy link
Member

jiasli commented Feb 1, 2021

@dshamanthreddy, your command looks good to me. Projecting displayName and mail requires MultiSelect Hash expression.

The command is working fine in my test:

> az ad user list --query "[].{name:displayName,mail:mail}" --output tsv
Admin06 admin06@xxx.onmicroosft.com
Admin07 admin07@xxx.onmicroosft.com

Things you may check:

  • Does the command return anything without --query and --output?
    az ad user list
    
  • Does CLI receive the correct argument? Make sure arguments are not parsed by the shell.
    > az ad user list --query "[].{name:displayName,mail:mail}" --output tsv --debug
    cli.knack.cli: Command arguments: ['ad', 'user', 'list', '--query', '[].{name:displayName,mail:mail}', '--output', 'tsv', '--debug']
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants