I set my az account to current subscription. And I am trying to fetch the resource name ending with (example "***kafka" ). How can i do it.

I tried with az group list -n '***kafka'

validation error: Parameter 'resource_group_name' must conform to the following pattern: '^[-\w\._\(\)]+$'.

1 Answer 1


There are at least two ways to achieve this.

First is to go with transforming json output to proper object for PowerShell as described in this thread:

Second it to use --query global parameter for Azure CLI:

az group list --query "[?contains(name,'kafka')].name"

But remember to use at least PowerShell 6.2 as previous versions have an issue:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.