azure-cli: azure-cli 2.30.0 throws ERROR: {'Azure-cli-ml Version': '1.33.0', 'Error': TypeError("__init__() got an unexpected keyword argument 'async_persist'",)}

The latests version of az cli on the Ubuntu agents (2.30.0) breaks when running az ml commands.

I’m running the following

  - task: AzureCLI@1
    displayName: "Azure CLI: Install AZ ML Extension"
    inputs:
      azureSubscription: "${{ parameters.AZURE_SUBSCRIPTION }}"
      scriptLocation: inlineScript
      inlineScript: "az extension add --name azure-cli-ml --yes"
      useGlobalConfig: true

  - task: AzureCLI@1
    displayName: "Azure CLI: Update Service (${{ parameters.SERVICE_NAME }})"
    inputs:
      azureSubscription: "${{ parameters.AZURE_SUBSCRIPTION }}"
      scriptLocation: inlineScript
      useGlobalConfig: true
      inlineScript: |
        az ml service update \
        --name ${{ parameters.SERVICE_NAME }} \
        --resource-group ${{ parameters.SERVICE_RESOURCE_GROUP }} \
        --scoring-timeout-ms ${{ parameters.SERVICE_SCORING_TIMEOUT}} \
        --workspace-name ${{ parameters.SERVICE_WORKSPACE_NAME }}

This was running fine with az cli 2.29.2 and as a workaround I’ve configured my pipeline to downgrade with this

  - task: Bash@3
    displayName: "Bash: Downgrade AZ CLI to [2.29.2]"
    inputs:
      targetType: "inline"
      workingDirectory: "$(Build.SourcesDirectory)"
      script: |
        sudo add-apt-repository https://packages.microsoft.com/repos/azure-cli
        sudo apt update
        apt-cache policy azure-cli
        sudo apt install -y --allow-downgrades azure-cli=2.29.2-1~focal

Logs from the error

==============================================================================
Task         : Azure CLI
Description  : Run Azure CLI commands against an Azure subscription in a Shell script when running on Linux agent or Batch script when running on Windows agent.
Version      : 1.164.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli
==============================================================================
/usr/bin/az --version
azure-cli                         2.30.0

core                              2.30.0
telemetry                          1.0.6

Extensions:
azure-cli-ml                      1.33.0
azure-devops                      0.21.0

Python location '/opt/az/bin/python3'
Extensions directory '/opt/az/azcliextensions'

Python (Linux) 3.6.10 (default, Oct 29 2021, 10:11:58) 
[GCC 7.5.0]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Please let us know how we are doing: https://aka.ms/azureclihats
and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy
Setting active cloud to: AzureCloud
/usr/bin/az cloud set -n AzureCloud
/usr/bin/az login --service-principal -u *** --password=*** --tenant ***
[
  {
   ***** Redacted ******
    }
  }
]
/usr/bin/az account set --subscription ***** Redacted ******
/bin/bash /home/vsts/work/_temp/azureclitaskscript1636529461981.sh
ERROR: {'Azure-cli-ml Version': '1.33.0', 'Error': TypeError("__init__() got an unexpected keyword argument 'async_persist'",)}

Logs when things were working

==============================================================================
Task         : Azure CLI
Description  : Run Azure CLI commands against an Azure subscription in a Shell script when running on Linux agent or Batch script when running on Windows agent.
Version      : 1.164.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli
==============================================================================
WARNING: You have 2 updates available. Consider updating your CLI installation with 'az upgrade'

Please let us know how we are doing: https://aka.ms/azureclihats
and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy
/usr/bin/az --version
azure-cli                         2.29.2 *

core                              2.29.2 *
telemetry                          1.0.6

Extensions:
azure-cli-ml                      1.33.0
azure-devops                      0.21.0

Python location '/opt/az/bin/python3'
Extensions directory '/opt/az/azcliextensions'

Python (Linux) 3.6.10 (default, Oct 29 2021, 08:10:01) 
[GCC 7.5.0]

Legal docs and information: aka.ms/AzureCliLegal


Setting active cloud to: AzureCloud
/usr/bin/az cloud set -n AzureCloud
/usr/bin/az login --service-principal -u *** --password=*** --tenant ***
[
  {
    ***** Redacted ******
       }
  }
]
/usr/bin/az account set --subscription ***** Redacted ******
/bin/bash /home/vsts/work/_temp/azureclitaskscript1636443057305.sh
AKS service creation operation finished, operation "Succeeded"

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

When can we expect a fix? Is there a workaround right now?

As a workaround I’ve downgraded the azure-cli with this

  - task: Bash@3
    displayName: "Bash: Downgrade AZ CLI to [2.29.2]"
    inputs:
      targetType: "inline"
      workingDirectory: "$(Build.SourcesDirectory)"
      script: |
        sudo add-apt-repository https://packages.microsoft.com/repos/azure-cli
        sudo apt update
        apt-cache policy azure-cli
        sudo apt install -y --allow-downgrades azure-cli=2.29.2-1~focal

However there seems to be a new (unrelated) issue with a new azure-cli-ml version, so I’ve also downgraded/locked it with this

  - task: AzureCLI@1
    displayName: "Azure CLI: [az extension add --name azure-cli-ml --version 1.33.1]"
    inputs:
      azureSubscription: "${{ parameters.AZURE_SUBSCRIPTION }}"
      scriptLocation: inlineScript
      # 1.5.0 throws some kind of auth error.
      inlineScript: "az extension add --name azure-cli-ml --version 1.33.1"
      useGlobalConfig: true

When can we expect a fix? Is there a workaround right now?

When can we expect a fix? Is there a workaround right now?

As a workaround I’ve downgraded the azure-cli with this

  - task: Bash@3
    displayName: "Bash: Downgrade AZ CLI to [2.29.2]"
    inputs:
      targetType: "inline"
      workingDirectory: "$(Build.SourcesDirectory)"
      script: |
        sudo add-apt-repository https://packages.microsoft.com/repos/azure-cli
        sudo apt update
        apt-cache policy azure-cli
        sudo apt install -y --allow-downgrades azure-cli=2.29.2-1~focal

However there seems to be a new (unrelated) issue with a new azure-cli-ml version, so I’ve also downgraded/locked it with this

  - task: AzureCLI@1
    displayName: "Azure CLI: [az extension add --name azure-cli-ml --version 1.33.1]"
    inputs:
      azureSubscription: "${{ parameters.AZURE_SUBSCRIPTION }}"
      scriptLocation: inlineScript
      # 1.5.0 throws some kind of auth error.
      inlineScript: "az extension add --name azure-cli-ml --version 1.33.1"
      useGlobalConfig: true

Nice. It worked for me. just FYI this command works if you are using image “ubuntu-latest (20.04)”, if you are using “ubuntu-18.04”, change “focal” to “bionic”

Thanks for your inputs!

azure-cli-ml 1.5.0 is an old package. Do you see any issues when you upgrade it to 1.33.1?

@kairu-ms When azure cli parses the package version, does 1.33.1 come newer than 1.5.0?

@Mossaka After my initial workaround the agents were automatically using 1.5.0 when I was running az extension add --name azure-cli-ml so that’s why I had to go back and lock in version 1.33.1. No issues with azure-cli-ml 1.33.1 along with azure-cli 2.29.2