Clearing the AssignedTo field on an Azure DevOps Work items with the AZ CLI
In the past I have written most of my Azure DevOps scripts calling the Azure DevOps REST API from PowerShell. This has worked, but did involve a lot of JSON payload handling.
A better option these days is to look at the AZ CLI and specifically the azure-devops
extension, as this does much of the heavy lifting for you.
This does not mean that everything is plain sailing though. Today I hit a problem that took me a while to solve.
Today, I wanted to use the AZ CLI to remove assigned identity from a work item.
There is a parameter to assign the WI owner on the az boards work-item update
command
az boards work-item update --id 123 --assigned-to myname
But I could not find a way to pass a null/empty/unassigned to clear this value.
In the end I found the answer was to use the following form, editing the field by name
az boards work-item update --id 123 --fields "System.AssignedTo="
Note, that there is nothing after the =
, no space, null or empty quotes (and yes I had tried all of those first)
Hope this post means someone gets to this solution quicker than I did.