Skip to content

Latest commit

 

History

History
70 lines (48 loc) · 1.92 KB

azure-devops-cli-in-release-pipeline.md

File metadata and controls

70 lines (48 loc) · 1.92 KB
title titleSuffix description ms.topic ms.subservice ms.manager ms.author author monikerRange ms.date
Azure DevOps CLI in a release pipeline
Azure DevOps
Learn how to create a release pipeline using Azure DevOps CLI
how-to
azure-devops-reference
mijacobs
chcomley
chcomley
azure-devops
08/17/2020

Azure DevOps CLI in a release pipeline

[!INCLUDE version-eq-azure-devops]

To use the Azure DevOps CLI in a hosted agent using a Release Pipeline, execute the following steps:

  1. Create a release pipeline.

    [!div class="mx-imgBorder"]
    new release pipeline

  2. Choose Empty job.

    [!div class="mx-imgBorder"]
    select template

  3. Choose Stage 1 to configure the stage.

    [!div class="mx-imgBorder"]
    Stage 1

  4. Choose the Tasks page, and configure the job to use Hosted macOS in Agent Pools.

    [!div class="mx-imgBorder"]
    Agent Job Configuration

  5. Choose the :::image type="icon" source="../media/icons/blue-add.png" border="false"::: plus icon to add another task and configure it as a PowerShell task. Enter Power into the search box to filter the list.

    [!div class="mx-imgBorder"]
    PowerShell

  6. Add the script, either via file or inline. For the example, the script has been included inline.

    [!div class="mx-imgBorder"]
    Add script

For reference, here is the inline script:

$extensions = az extension list -o json | ConvertFrom-Json

$devopsFound = $False
foreach($extension in $extensions)
{
    if($extension.name -eq 'azure-devops'){
        $devopsFound = $True
    }
}

if ($devopsFound -eq $False){
    az extension add -n azure-devops
}