Typical Environment Variables in Azure DevOps Pipeline

This an an example of many of the environmental variables available to the build pipeline. The following YAML step…

- powershell: |
    gci 'env:' | sort name
  displayName: 'List environment variables'

…created the following (excerpted) list.

Name                           Value                                                                                   
----                           -----                                                                                   
agent.jobstatus                Succeeded                                                                               
AGENT_BUILDDIRECTORY           C:\agent\_work\10                                                                       
BUILD_ARTIFACTSTAGINGDIRECTORY C:\agent\_work\10\a                                                                     
BUILD_BINARIESDIRECTORY        C:\agent\_work\10\b                                                                     
BUILD_DEFINITIONNAME           (the pipeline name)                                                                                                         
BUILD_REASON                   ("Manual", "IndividualCI", etc.)                                                                                              
BUILD_REPOSITORY_LOCALPATH     C:\agent\_work\10\s                                                                     
BUILD_REPOSITORY_NAME          (the repository name)                                                                        
BUILD_REPOSITORY_PROVIDER      TfsGit                                                                                  
BUILD_REPOSITORY_URI           https://CheetahWheelies@dev.azure.com/xxx/ccc/_git/ProductX
BUILD_SOURCEBRANCH             refs/heads/master                                                                       
BUILD_SOURCEBRANCHNAME         master                                                                                  
BUILD_SOURCESDIRECTORY         C:\agent\_work\10\s                                                                                                                                            
BUILD_SOURCEVERSIONMESSAGE     Update azure-pipelines.yml for Azure Pipelines                                          
BUILD_STAGINGDIRECTORY         C:\agent\_work\10\a                                                                     
BUILDCONFIGURATION             43Dbg                                                                                   
BUILDPLATFORM                  Any CPU                                                                                                                                                                                              
COMMON_TESTRESULTSDIRECTORY    C:\agent\_work\10\TestResults                                                           
SOLUTION                       ./CheetahWheelies/ProductX.sln                                                 
SYSTEM                         build                                                                                   
SYSTEM_ARTIFACTSDIRECTORY      C:\agent\_work\10\a                                                                     
SYSTEM_COLLECTIONID            841d2c11-9578-420b-aaaa-9da4fc60d85a                                                          
SYSTEM_DEFAULTWORKINGDIRECTORY C:\agent\_work\10\s                                                                     
SYSTEM_DEFINITIONNAME          (the pipeline name)                                                       
SYSTEM_TASKDISPLAYNAME         List environment variables                                                              
TASK_DISPLAYNAME               List environment variables                                                              

Variables are treated in different ways depending on the type it is and how it is references in the YAML file. See Azure Pipeline Variables article for more information.