JMESPath support comes to azd JSON output
Now you can filter and transform azd JSON output using JMESPath queries
What’s new?
The Azure Developer CLI (azd) now supports JMESPath queries on JSON output, including error messages. Pass --query to extract exactly what you need.
Why it matters
Being able to filter and transform JSON output directly in your terminal reduces the need for external tools or manual parsing, enhancing developer productivity. Whether you’re building scripts, automation, or need to inspect a specific part of your noisy config, JMESPath queries offer a simple solution right within the azd toolset.
How to use it
In azd versions 1.23.4 or later, --query can be used alongside -o json, but only with commands that return JSON output.
Examples
- Show a subsection of the configuration:
azd config show -o json --query "template.sources"Output:
{ "awesome-azd": { "key": "awesome-azd", "location": "https://aka.ms/awesome-azd/templates.json", "name": "Awesome AZD", "type": "awesome-azd" } } - Get the default environment name in a script:
ENV_NAME=$(azd env list -o json --query "[?IsDefault].Name | [0]") echo "Deploying to $ENV_NAME"Output:
production - In
azdversions 1.23.5 or later, you can extract error messages in automation. For example, when not authenticated and running this command:azd auth token -o json --query "data.message"Output:
"\nERROR: not logged in, run `azd auth login` to login\n"
Explore more query options in the JMESPath documentation.
Feedback
Questions or ideas? File an issue or start a discussion. Want to help shape azd? Sign up for user research.
0 comments
Be the first to start the discussion.