I am trying to query a response from the following az command:
az provider operation show --namespace Microsoft.KeyVault
I want to query all operations that relate to secrets to be able to build a custom role for a RBAC enabled key vault. This is a short excerpt from the entire response:
{
"displayName": "Microsoft Key Vault",
"id": "/providers/Microsoft.Authorization/providerOperations/Microsoft.KeyVault",
"name": "Microsoft.KeyVault",
"operations": [
{
"description": "Registers a subscription",
"displayName": "Register Subscription",
"isDataAction": false,
"name": "Microsoft.KeyVault/register/action",
"origin": null,
"properties": null
},
{
"description": "Unregisters a subscription",
"displayName": "Unregister Subscription",
"isDataAction": false,
"name": "Microsoft.KeyVault/unregister/action",
"origin": null,
"properties": null
}
],
"resourceTypes": [
{
"displayName": "Secret",
"name": "vaults/secrets",
"operations": [
{
"description": "View the properties of a secret, but not its value.",
"displayName": "Read Secret Properties",
"isDataAction": false,
"name": "Microsoft.KeyVault/vaults/secrets/read",
"origin": null,
"properties": null
},
{
"description": "Creates a new secret or updates the value of an existing secret.",
"displayName": "Write Secret",
"isDataAction": false,
"name": "Microsoft.KeyVault/vaults/secrets/write",
"origin": null,
"properties": null
}
]
}
],
"type": "Microsoft.Authorization/providerOperations"
}
I would like to extract the description as well as the name from the object in the array resourceTypes
where resourceTypes.name=="vaults/secrets"
.
I am trying to build this gradually, but I am stuck on even filtering out this object. This is where I'm at, and I've derived this from the JMESPath documentation on filtering arrays:
az provider operation show --namespace Microsoft.KeyVault --query "[?resourceTypes.name=='vaults/secrets']"
This is just empty however.
The end result I am after is a tabular output with the description
and name
from each operation within the operations array.
Any help would be greatly appreciated.