Search code examples
azure-devopsazure-devops-hosted-agent

Explore file system on hosted agent


I have an Azure DevOps build that fails with an error that no files are found in a particular folder. If this build had run on-prem I would logon to the build server and explore the files and folder structure created by the build, in order to figure out what went wrong.

Is there a way to explore the build folder structure for a hosted agent?


Solution

  • The Work folder is the root for all of your Pipeline tasks whether it be artifact staging, repo, copy-files etc.

    Run an in-line Powershell step with the following commands:

    Set-Location $env:AGENT_WORKFOLDER
    Get-ChildItem -Recurse
    

    Check out this link for some other common locations. Just search for c:\agent_work for all of the predefined variables that contain your files.