<p>I also use the classic editor, and I have implemented this for our builds. My use case was that I have a set of common set of build/release scripts stored in their own repository, and I want the ability to bring them into the application builds that I am executing.</p>

<p>I created a custom <strong>Task Group</strong> with an <strong>Inline PowerShell script</strong> to do this:</p>

<pre><code># Reference: https://blog.rsuter.com/script-to-clone-all-git-repositories-from-your-vsts-collection/
Write-Host "Cloning MyRepo from Azure DevOps..."

$sourcesDir = $env:SYSTEM_DEFAULTWORKINGDIRECTORY
Write-Host "Source directory: $sourcesDir"
$repoDir = Join-Path -Path "$sourcesDir" -ChildPath "MyRepo"
Write-Host "Target directory: $repoDir"

$url = "https://dev.azure.com/my_org/my_team_project/_git/MyRepo"

# Since using PAT, don't need real username, just non-empty username. Use "x".
$username = "x"
$pat = $env:PAT # passed into inline script as environment variable
$credentials = ("{0}:{1}" -f  $username, $pat)
$urlWithCreds = $url -Replace "://", ("://{0}@" -f $credentials)
Write-Host "Clone URL: $urlWithCreds"

git --version
git clone --progress $urlWithCreds
Set-Location "$repoDir"
git checkout master
git log -1 # show the latest commit
</code></pre>

<p>You will have to create a PAT with code permissions and pass it into the script as an environment variable. This task will clone the repository to a directory of the same name <em>within</em> your existing repo.</p>

<p>Putting it in a task group allows me to manage it in one place, and then all my more complicated build scripts can be under version control.</p>

<p>There is an active feature request for the capability to source from multiple repos. It looks like it is in the roadmap: <a href="https://developercommunity.visualstudio.com/idea/365522/allow-tfs-build-to-depend-on-multiple-repositories.html" rel="noreferrer">https://developercommunity.visualstudio.com/idea/365522/allow-tfs-build-to-depend-on-multiple-repositories.html</a></p>

CC BY-SA 4.0
2019-10-07T15:00:06.757Z
2019-10-07T15:00:06.757Z
AHaleIII
<p>I created a Build pipeline in Azure using classic editor and selected empty job instead of using any template. This way provides option to connect only one repository at once. My requirement is to connect two repositories at once in the build pipeline and bring files from both of them to run some testing. 
There are so many templates available to chose from but I am not sure which is the right one to select, with which I can connect two repositories at the same time. I did Google for help and found that I could use Artifact with the combination of NuGet or nmp. I don't know how does that work. </p>

CC BY-SA 4.0
2019-09-12T00:35:14.293Z
Why do you have to do that at the build process?  A release pipeline can consume multiple build artifacts and deploy them to the same location.
Erik Philips
CC BY-SA 4.0
2019-09-12T12:38:17.943Z
I would like to run testing during the build pipeline.
Alex Raj Kaliamoorthy
<azure-devops><azure><build-pipeline><azure-pipelines><artifacts>
Reading two Repos in Azure Build pipeline
Alex Raj Kaliamoorthy
# Reading two Repos in Azure Build pipeline

(Asked by: username_0 on 2019-09-11)

I created a Build pipeline in Azure using classic editor and selected empty job instead of using any template. This way provides option to connect only one repository at once. My requirement is to connect two repositories at once in the build pipeline and bring files from both of them to run some testing.
There are so many templates available to chose from but I am not sure which is the right one to select, with which I can connect two repositories at the same time. I did Google for help and found that I could use Artifact with the combination of NuGet or nmp. I don't know how does that work.

**Tags:** azure-devops, azure, build-pipeline, azure-pipelines, artifacts

> **Comments:**
> **username_1**: Why do you have to do that at the build process?  A release pipeline can consume multiple build artifacts and deploy them to the same location.  
> **username_0**: I would like to run testing during the build pipeline.  

---

## 1 answers

### Answer by username_2 on 2019-10-07. Score: 5

I also use the classic editor, and I have implemented this for our builds. My use case was that I have a set of common set of build/release scripts stored in their own repository, and I want the ability to bring them into the application builds that I am executing.
I created a custom Task Group with an Inline PowerShell script to do this:
# Reference: https://blog.rsuter.com/script-to-clone-all-git-repositories-from-your-vsts-collection/
Write-Host "Cloning MyRepo from Azure DevOps..."

$sourcesDir = $env:SYSTEM_DEFAULTWORKINGDIRECTORY
Write-Host "Source directory: $sourcesDir"
$repoDir = Join-Path -Path "$sourcesDir" -ChildPath "MyRepo"
Write-Host "Target directory: $repoDir"

$url = "https://dev.azure.com/my_org/my_team_project/_git/MyRepo"

# Since using PAT, don't need real username, just non-empty username. Use "x".
$username = "x"
$pat = $env:PAT # passed into inline script as environment variable
$credentials = ("{0}:{1}" -f  $username, $pat)
$urlWithCreds = $url -Replace "://", ("://{0}@" -f $credentials)
Write-Host "Clone URL: $urlWithCreds"

git --version
git clone --progress $urlWithCreds
Set-Location "$repoDir"
git checkout master
git log -1 # show the latest commit

You will have to create a PAT with code permissions and pass it into the script as an environment variable. This task will clone the repository to a directory of the same name within your existing repo.
Putting it in a task group allows me to manage it in one place, and then all my more complicated build scripts can be under version control.
There is an active feature request for the capability to source from multiple repos. It looks like it is in the roadmap: https://developercommunity.visualstudio.com/idea/365522/allow-tfs-build-to-depend-on-multiple-repositories.html


---

