Closed ozbillwang closed 1 week ago
Hi @ozbillwang Could you please change the script type from PowerShell to PowerShell Core as PowerShell script doesnt work with Linux agents. Please refer the doc for more info: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-cli-v2?view=azure-pipelines&viewFallbackFrom=azure-devops#task-inputs
Same issue.
Currently I run a test.
with Microsoft managed agent (default agent pool), it works fine. I check its ubuntu release, it is 22.04. The task AzureCLI@2
works fine directly
mine is private agent pool, built on ubuntu 18.04 and the task is failed recently.
I am going to upgrade the private agent poool to 22.04, and will update the result
@ozbillwang Could you please update if your task works fine after upgrading the agent (ubuntu) version to 22.04?
@ozbillwang Please share the latest updates?
@ozbillwang Please share the latest updates?
No difference.
Finally, I figured it out. The AzureCLI@2
task doesn't handle the installation of the Azure CLI. It assumes that the Azure CLI is already installed.
After adding a new task (show code below) before it, the AzureCLI@2 task runs fine now.
- task: Bash@3
displayName: InstallAzureCLI
inputs:
targetType: "inline"
script: |
sudo apt-get -y install build-essential
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
az --version
my recommend is to update the related document https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-cli-v2?view=azure-pipelines and mention azure cli should be already installed on the Azure devops agent (if private agent), then you can use this task
Hi @ozbillwang Please check this doc, here it is mentioned to install Azure CLI on the self hosted agent machine. https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/AzureCLIV2/Readme.md
New issue checklist
Task name
AzureCLI@2
Task version
2
Issue Description
This task works fine last month. But when today I run a pipeline with it, I got error
Use the sample code from the official document https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-cli-v2?view=azure-pipelines#examples
i got the error
Environment type (Please select at least one enviroment where you face this issue)
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
ubuntu 18.04
Relevant log output