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

How to remove duplicates in the az command output using --query #88

Open
praveenambati1233 opened this issue Aug 11, 2021 · 2 comments
Open

Comments

@praveenambati1233
Copy link

Command -
az resource list --resource-group MYRG --query "[].{type:type}"
output -
[
{
"type": "Microsoft.Network/networkInterfaces"
},
{
"type": "Microsoft.Network/networkInterfaces"
},
{
"type": "Microsoft.Network/networkSecurityGroups"
},
{
"type": "Microsoft.Network/networkSecurityGroups"
}
]

@abeelan
Copy link

abeelan commented Dec 2, 2021

mark

@Didjacome
Copy link

Case #88 - Solution

Hi, hope you are well

  • if you are using powershell follow this command
az resource list -g MYRG --query  "[].{Type:type}" -o tsv | get-unique -AsString 
  • if you are using az cli in linux "Bash"
az resource list -g MYRG --query  "[].{Type:type}" -o tsv | sort | uniq

I hope I could help you, if you have any doubts, please let me know

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

No branches or pull requests

3 participants