Getting Started with Git and Azure DevOps Using Visual Studio Code

45 minutes
  • 4 Learning Objectives

About this Hands-on Lab

Azure DevOps Repos (Azure Repos) facilitates developer collaboration, by allowing you to host your own fully managed Git repository within Azure. Within this hands-on lab, we’ll look at how you can setup your own Azure Repo, and use Visual Studio Code to commit changes.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Get Started with Azure DevOps
  1. Login at the Azure DevOps Portal.
  2. Follow the Getting Started wizard, and create a project called Lab Project (private visibility).
  3. Create and Initialize new Repo called IT Ops Repo (tick the box to include a README.md file).
Get Started with VS Code

Connect to the VM (Optional)

  1. Connect to the VM using RDP (the public IP is provided for you for VM1, on the lab instructions page).
  2. Log in using the credentials provided for you.

Note: This step is entirely optional, as you can run this on your own PC if desired, rather than connecting to the VM. You can refer to this Microsoft article for more information on using an RDP client.

Get Started with Visual Studio Code

  1. Open Visual Studio Code.
  2. Start a new terminal in Visual Studio Code and set up your identity (see the ‘Your Identity’ section in this article for more information) on how to use git config --global user.name and git config --global user.email.
Clone the Repository in VS Code
  1. Navigate to the IT Ops repo we created earlier within Azure DevOps Repos.
  2. Retrieve the repository HTTPS URL (through the Clone Repository button).
  3. Navigate back to Visual Studio Code, and clone the repo using the details you captured above, authenticating with your lab credentials (see this Microsoft article for more details about using Git).
Commit Changes
  1. Open the repo within Visual Studio Code when prompted to do so (after cloning the repo in the previous objective).
  2. Make changes to the README.md file.
  3. Commit the changes locally with a comment.
  4. Push/sync the changes to Azure DevOps.

Note: You can now go back to the Azure DevOps Repo and refresh the page. You should see the updated changes to README.md and be able to view its history.

Additional Resources

Scenario

To help walk through the lab, we'll consider the following scenario:

You have been hired as a senior cloud administrator, and the company you now work for does not use centralized source/version control.

Several junior cloud administrators have basic Azure scripts and files they would like to better manage centrally with Azure Repos.

Your manager has asked you to run a workshop and walk through how the junior cloud administrators could use Azure Repos, as well as some basic setup and functionality.

Lab Setup

This lab will make use of two main resources: 1) The Azure DevOps portal, and 2) A virtual machine with Visual Studio Code installed.

The Azure DevOps portal can be accessed by opening a new private broswer window in your browser. Then, you can navigate to https://dev.azure.com. See the objectives for more information about getting started.

To help make the lab as easy to use as possible, a virtual machine has been configured with Visual Studio Code for you. You may use your own computer, if desired, or the virtual machine. To access the virtual machine, use an RDP Client on your computer (see this Microsoft article for some possible options).

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?