Clone Azure Repository

Action ID: azure:repository:clone
NPM Package:

@backstage-community/plugin-scaffolder-backend-module-azure-devops

Description

Clone an Azure repository into the workspace directory.

Input Schema

PropertyTypeDescriptionRequired
tokenstring-
branchstring-
remoteUrlstring-
cloneDepthnumber-
targetPathstring-

Output Schema

PropertyTypeDescriptionRequired
cloneFullPathstring-

Usage Examples

Clone the default branch into a vendor directory

Clone a public Azure DevOps repository into a subdirectory under the workspace. Use this after fetching your base template with fetch:template to bring in shared code.

Copy
steps:
  - id: cloneSharedLibs
    action: azure:repository:clone
    input:
      remoteUrl: https://dev.azure.com/contoso/Platform/_git/shared-libraries
      targetPath: vendor/shared-libraries

Shallow clone a specific branch for faster builds

Clone only the latest commit from a non-default branch to reduce clone time and workspace size. Use when you only need current sources for a build or code generation step.

Copy
steps:
  - id: cloneClientSdk
    action: azure:repository:clone
    input:
      remoteUrl: https://dev.azure.com/contoso/Payments/_git/client-sdk
      branch: develop
      cloneDepth: 1
      targetPath: src/vendor/client-sdk

Clone a private repository using a token

Clone a private Azure DevOps repository by passing a token from template parameters. Use when the integration does not provide credentials and you need explicit authentication.

Copy
steps:
  - id: clonePrivateInfra
    action: azure:repository:clone
    input:
      remoteUrl: https://dev.azure.com/contoso/Infra/_git/deployment-scripts
      branch: main
      targetPath: tools/deployment-scripts
      token: ${{ parameters.azurePat }}

Build the remote URL from parameters

Construct the remote URL dynamically from user input and clone into a path that uses the repository name. Use this pattern when targeting different orgs/projects/repos from a single template.

Copy
steps:
  - id: cloneDynamicRepo
    action: azure:repository:clone
    input:
      remoteUrl: https://dev.azure.com/${{ parameters.azureOrg }}/${{ parameters.project }}/_git/${{ parameters.repoName }}
      branch: release/2025.10
      targetPath: deps/${{ parameters.repoName }}

Clone with extended history for tooling that needs commits

Clone a repository with deeper history to support tools that read commit metadata, then work from a stable branch. Use when generating changelogs or computing diffs.

Copy
steps:
  - id: cloneWithHistory
    action: azure:repository:clone
    input:
      remoteUrl: https://dev.azure.com/contoso/Platform/_git/service-template
      branch: main
      cloneDepth: 50
      targetPath: .cache/service-template