1
votes

In my Azure Pipelines YAML file, I'm using a Bash task to run a Python script that caches CocoaPods libraries on Azure Artifacts (Universal Packages). I assumed that the Azure command-line tools on the Azure DevOps virtual machines would have the latest Azure extensions installed. I was wrong.

My Python script invokes commands such as az artifacts universal download and az artifacts universal publish. This works great on my Mac. Not so much on Microsofts VMs.

Any advice would be appreciated.

##[section]Starting: Bash
==============================================================================
Task         : Bash
Description  : Run a Bash script on macOS, Linux, or Windows
Version      : 3.159.3
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
==============================================================================
Generating script.
Script contents:
./cache_pods.py Debug
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /Users/runner/runners/2.160.1/work/_temp/d0fd889d-a201-42ac-aad6-45ee3eca0532.sh
ERROR: az: 'artifacts' is not in the 'az' command group. See 'az --help'.
2

2 Answers

6
votes

ERROR: az: 'artifacts' is not in the 'az' command group. See 'az --help'.

You need to install Azure DevOps Extension first then use the az artifacts command. Please refer to Azure DevOps CLI in Azure Pipeline YAML for more information.

steps:
- script: az extension add -n azure-devops
  displayName: 'Install Azure DevOps Extension'

Please add this to your yaml and try again. Hope this would work.

0
votes

Get same issue After spending an hour get solution : Without extension, it can't work so try to follow below step:

First try to hit the below command to find the extension

az extension add --name azure-devops

and then check that extensions is available or not :

Eg. For Pipelines:

az extension add --name azure-devops

And the run that command