1

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\._\(\)]+$'.

Rocky Hai
  • 287
  • 1
  • 6

1 Answers1

2

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:

Paweł Tajs
  • 221
  • 1
  • 5