How to install Azure DevOps Extension in Azure CLI?
Why do we need an Azure DevOps (ADO) extension in Azure CLI?
Well, you know how to manage Azure DevOps services (Pipeline, workItems, Repo, Artifacts, etc) from the portal. If you are a DevOps engineer or Automation guy then you would love to manage the ADO services with the command line (Azure CLI).
Managing ADO services with the command line is very easy and makes your work faster like managing pipelines, work items, artifacts, etc.
Pre-Requisites:
- Azure CLI Tool installed (must be above 2.10.1).
- Azure DevOps Account
Once you have Azure CLI installed, you are eligible to install the extension but make sure you have a CLI version above 2.10.1.
To check the Azure CLI version, run the below command on any terminal (PowerShell, cmd, or any other terminal).
az --version
Add Extension
To add an extension in Azure CLI, you need to use the az extension add command with the –name parameter that specifies the extension name. The extension name for devops is azure-devops.
az extension add --name azure-devops
You can check the installed extension using the below command. This will list down all the installed extensions in the tabular format.
az extension list -otable
Or you can directly search for the installed extension with the below command.
az extension show --name azure-devops -otable
Azure DevOps extension
Once you see the extension, check all the services that are offered by this extension.
az devops -h
Login to Azure DevOps
There are two ways to login to DevOps services.
- Interactive Login
- Login using PAT
For interactive login, you need to use the az login command.
az login
Once you run this command, the browser will open for the authentication and you have to enter your Azure credentials.
For login using PAT, run the below command.
az devops login --organization https://dev.azure.com/organizationName
That will ask for the PAT token.
Configure Default organization
To work on the specific project of the organization, you need to set the default organization.
az devops configure --defaults organization=https://dev.azure.com/OrganizationName project=projectName
To get more help with this extension, you need to run
az devops -h