Currently I'm using this command to query the details of the az boards,
but I only need the System.Id number 0941248
, is there a way to filter this out?
az boards query --wiql "SELECT [System.Id] FROM workitems WHERE [System.State] IN ('New') and [System.Title] = '[Test ticket] CVE found for mssql'"
and here is the output:
[
{
"fields": {
"System.Id": 0941248
},
"id": 0941248,
"relations": null,
"rev": 1,
"url": "https://dev.azure.com/PROD/_apis/wit/workItems/0941248"
}
]
You can use below powershell to get the System.Id:
$jsonOutput = az boards query --wiql "SELECT [System.Id] FROM workitems WHERE [System.State] IN ('New') and [System.Title] = '[Test ticket] CVE found for mssql'" | ConvertFrom-Json
Write-Output $jsonOutput.fields.'System.id'
On Ubuntu with Bash, you can install jq
via comamnd sudo apt-get install jq
, then get the target id:
az boards query --wiql "SELECT [System.Id] FROM workitems WHERE [System.State] IN ('New') and [System.Title] = '[Test ticket] CVE found for mssql'" | jq '.[].fields."System.Id"'