How can I download the pipeline logs as a pipeline task? I need it to upload it somewhere. Thanks. [1]: https://i.stack.imgur.com/pPkyU.png
Asked
Active
Viewed 1,351 times
0
-
refer https://stackoverflow.com/questions/67534289/azure-devops-pipeline-logs-for-a-specific-task – lokanath das Apr 28 '22 at 06:48
1 Answers
0
As per my knowledge there is no such way(may be there i am not sure) you might be looking something like this. Rest Api are there to fetch the single step logs / list of logs. Refer below MSDN docs
https://learn.microsoft.com/en-us/rest/api/azure/devops/pipelines/logs?view=azure-devops-rest-6.0
https://learn.microsoft.com/en-us/rest/api/azure/devops/pipelines/logs/get?view=azure-devops-rest-6.0
To call these apis from Azure pipeline you can use InvokeRESTAPI@1
task, as shown in the below doc.
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/http-rest-api?view=azure-devops

lokanath das
- 736
- 1
- 10
- 35
-
According to docs, `InvokeRESTAPI@1` can only be used on agentless job which I don't. I am using self-hosted agent. Any other way for me to download logs? – Jess Apr 28 '22 at 08:12
-
then instead of using InvokeRESTAPI@1 use Inline Powershell script to call the Rest Api. There seems no straight way to get through the logs. But not sure about type of Task you use, if it's related to Msbuild then this might help. https://learn.microsoft.com/en-us/visualstudio/msbuild/obtaining-build-logs-with-msbuild?view=vs-2022 – lokanath das Apr 28 '22 at 10:05