Skip to content

codingsteff/azure-devops-backup-repos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure DevOps - Backup Repositories

Powershell Script to download all Azure DevOps Git repositories using Git clone or pull.

Requirements

Azure DevOps Extension for Azure CLI

# login interactive
az devops login

# login with Personal Access Token
az devops login --organization https://dev.azure.com/[ORGANIZATION]

Usage

Back up main branch only

.\backup-repos.ps1 
    -organization "organization"
    -downloadLocation "/repos"
    -personalAccessToken "[personal-access-token]"

Back up all branches

.\backup-repos.ps1 
    -organization "organization"
    -downloadLocation "/repos"
    -personalAccessToken "[personal-access-token]"
    -backupAllBranches

Back up specific branches

.\backup-repos.ps1 
    -organization "organization"
    -downloadLocation "/repos"
    -personalAccessToken "[personal-access-token]"
    -backupAllBranches
    -branchNameRegex "^main$|^release\/"

Personal access token is optional, otherwise it uses system configured git credentials.

Run as docker container

docker run /
-e AZURE_DEVOPS_EXT_ORG=contoso /
-e AZURE_DEVOPS_EXT_PAT=xxxxxxxx /
-v /repos:/repos /
codingsteff/azure-devops-backup-repos

Dev

Build local docker container

docker build --pull -t azure-devops-backup-repos .

Create Tags

git tag 1.0.x
git push origin --tags

Docker hub

Build Rules

Type Source becomes => Docker Tag
Branch master latest
Tag /([0-9]+)?(\.[0-9]+)?(\.[0-9]+)/ {\1},{\1}{\2},{sourceref}

Multiple docker tags: Regex with capture groups {\1} for major, {\2} for minor, {soureref} for full tag name

Regexes and automated builds

About

Backs up all Azure DevOps git repositories

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •