Azure DevOps - Is there any way to get Task ID for tracking log page?

205 Views Asked by At

I want to generate the current step log url. I am able to get other ID's like build id, project id but not the task id(last part integer). I have searched in Azure DevOps Predefined Variables but couldn't get any. Is there any way to get this ID?

enter image description here

1

There are 1 best solutions below

0
Krzysztof Madej On BEST ANSWER

There is no variable for this and if you want to construct proper url you have to assume that GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}/logs/{logId}?api-version=7.0

logId at the end:

  • 1 returns your pipeline definition
  • 2 expressions evaluations
  • 3 initialize job
  • 4 here start your first task from pipeline

But you can use this endpoint to get all logs https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/get-build-logs?view=azure-devops-rest-7.0