Azure DevOps is here to stay. The process of managing your application or your infrastructure-as-a-code in Microsoft Azure is similar across platforms, including Mac, Linux and, of course, Microsoft Windows. In this article, we are going to prepare our macOS to support the necessary tooling required to work with Azure DevOps. By the end of this article, you can head out to Starbucks, and you will be ready to manage your Azure application/infrastructure using Azure DevOps in your macOS as you sip your favorite latte.
Installing Visual Studio Code and additional support
The first step is to download the tool you need, and we can download it for free here. Select Mac and a ZIP file will be downloaded to your computer.
Extract the content of the ZIP file and move the Visual Studio Code file to the Applications folder. The installation process is that simple. You can click on F4 (aka Launchpad), and a list of all applications will be displayed. The Visual Studio Code is going to be there; click on it.
Note: you may have more than one page on the Launchpad.
The first run may require your confirmation to run the tool. If you receive a message like this, Visual Studio Code is an app downloaded from the Internet. Are you sure you want to open it?, click on Open.
The welcome file will be open automatically. If you have used Visual Studio Code in a PC, it is the same experience.
Our next step is to install the Azure Repos. Click on the Extensions icon located on the left side. Type repos, and select Azure Repos from the list. In the right page, click on Install
Connecting to Azure DevOps
Now that we have all the required tools installed on our macOS, our next step is to open the Azure DevOps portal and select a repository that we want to clone and work on with our macOS,
Logged on to the Azure DevOps Portal, click on Repos (Item 1), select the desired repo from the list of available repos (Item 2), and after selecting it, click on Clone (Item 3).
In the new blade, click on Get Git Credentials and copy the content of the Password. Click on Clone in VS Code.
A new page will open in the web browser of your preference. Click on Open Visual Studio Code option. The VS Code will ask for a local folder to synchronize the repo. Select the folder of your choice. My recommendation is to have a parent folder matching the name of your Azure DevOps Project, and a subfolder that matches the name of the current repo.
Select the destination and click on Select Repository Location. That folder will be synchronized with the Azure DevOps Repo, and a notification in Visual Studio Code will inform you about the synchronization.
When the synchronization is complete, you will see the notification in the screenshot below. Click on Open in New Window.
A password will be required. Type in the password that we gathered previously from the Azure DevOps Portal.
The result will be a new session of Visual Studio Code with some integrations with Azure DevOps. In Item 1, we can see the Azure repo being synchronized locally in our macOS. In Item 2, we see the Azure DevOps organization. When we click on that area, we will be redirected automatically to the Azure DevOps Portal; click on it.
If a message saying Do you want Code to open the external website? appears, click on Configure Trusted Domains button. From the list, click on Trust azure.com and all its subdomains. After that, the Azure DevOps organization open automatically in your default browser.
Local commit and push to the Azure Repos
The beauty of Visual Studio Code is the source control integrated with Azure DevOps, meaning any local changes are committed locally and then pushed to Azure DevOps. From there, they can be shared among peers or trigger an Azure pipeline to build a solution.
To demonstrate how the integration works, we are going to perform some changes in the file README.md, and we are going to save it. If we click on the Source Control icon in the VS Code Editor, we will see all changes since the last commit.
Click on the Commit button (the check icon) and type a comment for the current commit and hit enter.
In the bottom bar, we will have an indicator that synchronization is required. In the current scenario, there is one change to be uploaded to the repo. To synchronize both sides, click on that area, and the process will start automatically.
Note: In the beginning, Visual Studio Code will be a little bit noisy and ask several questions. Most of the time you have the option to say something like Yes, and don’t ask me again.
Signing in to your Azure DevOps
When you are using a local folder that has version control, enable it. It can be easily checked by validating the existence of the hidden folder .git on the local folder. You may be prompted to authenticate with Azure DevOps.
Visual Studio Code has a fantastic feature called Command Palette… and it is accessible at all times. Just hit Fn + F1 keys in your keyboard. Type Team: Signin and from the dropdown list, click on Authenticate and get an access token automatically (new experience). A code will be generated for the current session; copy the value and hit <enter> key.
A new page will be displayed, and you need to enter the code provided in the Visual Studio Code. In case you have forgotten or misplaced the code, don’t worry, it is still visible at the bottom of the Visual Studio Code.
If you are not authenticated on Azure DevOps, your authentication process will be required. As soon as you get authenticated, the connection between the machine and Azure DevOps will be established, and all synchronization will occur as usual.
macOS with AzureDevops: You are up and running
In this article, we covered the basic steps to get your macOS up and running with the tools needed to integrate and use Azure DevOps.
More Azure DevOps articles
- How to change the current process in an Azure DevOps project
- Azure DevOps: Boost your skills managing tasks and connecting features
- Using Azure DevOps status badges to plan and track your projects
- Creating status badges in Azure DevOps pipelines
- Azure DevOps: Ultimate tool to manage infrastructure-as-a-code