'Azure DevOps REST API, how to allow Azure Function to create workitems in DevOps project?

I'm creating a schedule-triggered Azure Function which will run tests once a day. If during the run any test fails, I want it to create a bug on a Azure DevOps project which includes a log of the failed tests.

I know I could create a PAT so that it can authenticates with the DevOps REST API but I don't like its downsides:

  • it can be valid for 1 year at maximum, I will need to remember to extend its expiration period
  • every bug created like this will have me as its creator

Edit: I found out I could use a MS Flow - there's a DevOps connector that can create workitems, still it has a downside of having me as workitem's creator but it's not such a pain...

Still would much appreciate to learn about other options...

Is there any better way I can let my Azure Function to create bugs on my DevOps project?



Solution 1:[1]

An alternate option would be the use azure logic app along with azure function.

Here the azure function would directly call a azure logic app and the logic app would create a bug workitem .

Refer the following article by Stefan stranger

On how to create logic app which will create the bug. Here we will be using azure webhooks for the creating of bugs.

Now you can either send the data to a storage account where the logic app using some trigger to get the data and then use it to create bug, or you can directly connect to the logic app .

Refer the following article by Laura KokKarinen for this .

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MohitGanorkar-MT