Accessing multiple repos in Azure DevOps from a pipeline task

Had a problem today where I needed to access multiple repos from a build script so that I could run some powershell that is stored locally (using YAML).

Unfortunately, the checkout statement doesn't yet allow a template to checkout multiple repos (though this will hopefully change soon).

In an Azure DevOps pipeline there is an OAuth token that gives some access to repos at run time.

I had tried multiple combinations of this, this and this which pointed me in several different directions.

Thanks to this post for helping me out.

the final working definition was to use this accesstoken in the build like this:

name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
    variables:
        system_accesstoken: $(System.AccessToken)
trigger:
- feature/pipelines-checkout

pool:
  name: 'Default'

steps:
- task: [email protected]
  inputs:
    targetType: 'inline'
    script: |
      git clone https://$(system_accesstoken)@dev.azure.com/organisation/project/_git/firstrepo
      git clone https://$(system_accesstoken)@dev.azure.com/organisation/project/_git/secondrepo