I need your help, I’m trying to create a powershell script that will create a task directly in Azure Devops (Azure Boards -> Work Items).
The problem is that after much research, I haven’t found the corresponding module to do this, nor the method to connect to the module, if one exists.
I had the idea of generating a token and using it to connect.
For the moment, I’ve tried to use the generate token to connect, but it’s blocked because I don’t know the module for connecting directly to Azure DevOps.
2
Answers
You can use the Azure DevOps API, and if it’s running as a Powershell script in the build you should use the predefined variables. Example:
You can reference the PowerShell script sample below to call Azure DevOps REST API to create a
Task
type work item.The value of variable "
$body
" (request body) also can directly set to be a JSON string like as below.