I have two ADO repositories named private2 and public2. private2 references public2 as a submodule:

I also added a yaml file (vsts-cicd.yml) for build as follows:
resources:
repositories:
- repository: test
type: git
name: <ProjectName>/public2
ref: master
stages:
- template: build1.yml@test
parameters:
repoToCheckout: test
checkoutPath: '$(Build.BuildNumber)'
- template: build2.yml@test
parameters:
repoToCheckout: test
checkoutPath: '$(Build.BuildNumber)'
- template: yaml/build3.yml
On running the build, I see the first two templates completed successfully. On reaching - template: yaml/build3.yml it fails with the following error:

What am I missing?
UPDATE:
I followed this article (https://www.timschaeps.be/post/dealing-with-error-tf401019-submodules-azure-pipelines/) to fix the issue however I don’t see this option in project settings: ‘Limit job authorization scope to referenced Azure DevOps repositories’. What am I missing?

As you mention in your update, the project consuming the Repo needs to have the setting Limit job authorization scope to current project for non-release pipelines disabled in the Project Settings.
NOTE: Please bear in mind that this changes the build identity to collection-scoped. This could cause issues with using Auzure DevOps Artifacts. See Scoped build identities.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With