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)
        system_accesstoken: $(System.AccessToken)
- feature/pipelines-checkout

  name: 'Default'

- task: [email protected]
    targetType: 'inline'
    script: |
      git clone https://$(system_accesstoken)
      git clone https://$(system_accesstoken)