GithubHelp home page GithubHelp logo

backup_azure_devops_repos's Introduction

Backup Azure Devops Repos

Introduction

Azure devops formerly known as visual studio team service is a SAAS for devops. It is a good practice to back up the source code regularly or even, it may be required by the company. However, there is no out of box solution according to microsoft.

Although Microsoft does commit to keep data safe:

But we have no control over the backup mentioned above. Here I recommend several ways to do the backup:

  1. use Backrightup and integrate using its plugin into azure devops. Very easy and it can backup not only source code but also pipelines. Good service good price. The cost is per repo, therefore if you have many repositories, the price might be high.
  2. use cron job on vm use git clone to copy the repo. The drawback is that every time when there is a new repo, you have to change the cron job.
  3. use azure devops rest api to programmably backup the source code.

Option 1 and 2 are pretty obvious. Let us check how we could backup the repo based on the third option.

Backup Azure Devops Repos

This solution is based on python, so that it could be used in either windows or linux environment.

1. Get an Azure DevOps API personal access token(PAT)

  • go to right upper corner click personal access tokens.

  • specify required fields in following picture to create a pat and copy it. (make sure the pat has code reading right)

2. Clone the backup code based on python

The source code could be found at here at github. Clone it and replace the organization and PAT with your own data.

The code uses azure devops rest api to get project list and then all repos url based on project list. At last, the code calls git cmd to clone the repo.

3. Run Backup Code as Cron or Scheduler Jobs

Depending on ur environment, you could run the backup code in windows as a scheduler job or in linux as cron job. Or you could even run it as function app in azure.

backup_azure_devops_repos's People

Watchers

 avatar

Forkers

leffen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.