DEV Community

loading...

Create a repo in Azure DevOps using the CLI and PowerShell

aidapsibr profile image AIDA ・1 min read

This is a part of a series on using VM images in Azure compute to build lightweight application deployment options as opposed to PaaS options such as App Services and more complex IaaS such as Azure Kubernetes Service.


Prerequisites

First, ensure you are logged into Azure CLI (az login) to the correct account, if you have the DevOps extension, this will authenticate there as well.

To keep this work separate from any of our product code and backlogs, let's start by creating a new Azure DevOps project. In this snippet I use my organization: "psibrorg", replace that with your own and choose if you want to leave the project public or make it private.

az devops project create --name "Azure IaaS Series" --org https://dev.azure.com/psibrorg --visibility public

When we create a new project it creates a default git repository of the same name which works great for us.

mkdir "Azure IaaS Series"
git init

# Create a readme file
"#Azure IaaS Series" > readme.md

git add .
git commit -m "Initial commit"

# Add the default repo as the upstream origin
git remote add origin (az repos list --project "Azure IaaS Series" --org https://dev.azure.com/psibrorg --query [0].webUrl)

git push -u origin master

Discussion (0)

pic
Editor guide