Skip to content

Azure CLI ignores locally installed azcopy if version is 10.31.0~preview.1 #32363

@tsvietOK

Description

@tsvietOK

Describe the bug

I have installed Azure CLI 2.71.0 and azcopy 10.31.0~preview.1. When I run the sync command I see Azure CLI ignores locally installed azcopy with version 10.31.0~preview.1 and downloads the old one 10.13, which doesn't have argument --compare-hash.

Related command

az storage blob sync `
            -c $Container `
            -s $workDir `
            --account-name $StorageAccountName `
            --auth-mode login `
            -d "$dir/" `
            -- --compare-hash MD5

Errors

WARNING: You have 2 update(s) available. Consider updating your CLI installation with 'az upgrade'
14:04:02   Az Cli version: azure-cli                         2.71.0 *  core                              2.71.0 * telemetry                          1.1.0  Dependencies: msal                            1.31.2b1 azure-mgmt-resource               23.1.1  Python location '/opt/az/bin/python3' Config directory '/home/admin/.azure' Extensions directory '/home/admin/.azure/cliextensions'  Python (Linux) 3.12.8 (main, Mar 25 2025, 10:55:23) [GCC 13.3.0]  Legal docs and information: aka.ms/AzureCliLegal
14:04:03   WARNING: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
14:04:03   WARNING: Positional argument '<EXTRA_OPTIONS>' is experimental and under development. Reference and support levels: https://aka.ms/CLI_refstatus
14:04:08   WARNING: Azcopy not found, installing at /home/admin/.azure/bin/azcopy
14:04:08   WARNING: Downloading AzCopy from https://azcopyvnext-awgzd8g7aagqhzhe.b02.azurefd.net/release20211027/azcopy_linux_amd64_10.13.0.tar.gz
14:04:08   WARNING: Azcopy command: [<command>]
14:04:08   
14:04:08   unknown flag: --compare-hash

Issue script & Debug output

Looks like the used "packaging.version" package used in this code block doesn't support this version format 10.31.0~preview.1:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/packaging/version.py", line 54, in parse
    return Version(version)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/packaging/version.py", line 200, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '10.31.0~preview.1'

Expected behavior

Version (even preview) is correctly resolved, and locally installed azcopy is used instead of downloading the new one (older version).

Environment Summary

azure-cli 2.71.0 *

core 2.71.0 *
telemetry 1.1.0

Dependencies:
msal 1.31.2b1
azure-mgmt-resource 23.1.1

Python location '/opt/az/bin/python3'
Config directory '/home/admin/.azure'
Extensions directory '/home/admin/.azure/cliextensions'

Python (Linux) 3.12.8 (main, Mar 25 2025, 10:55:23) [GCC 13.3.0]

Additional context

No response

Metadata

Metadata

Labels

Auto-AssignAuto assign by botAuto-ResolveAuto resolve by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamStorageaz storageUpgradeaz upgradeact-codegen-extensibility-squadact-platform-engineering-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions