diff --git a/src/azure-cli/azure/cli/command_modules/storage/_help.py b/src/azure-cli/azure/cli/command_modules/storage/_help.py index d4251fa4122..a29d6ded09f 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/_help.py +++ b/src/azure-cli/azure/cli/command_modules/storage/_help.py @@ -1490,6 +1490,8 @@ text: az storage copy -s https://[account].file.core.windows.net/[share]/[path/to/directory] -d /path/to/dir --recursive - name: Download a set of files from Azure File Share using wildcards, and you can also specify your storage account and share information as above. text: az storage copy -s https://[account].file.core.windows.net/[share]/ --include-pattern foo* -d /path/to/dir --recursive + - name: Upload a single file to Azure Blob using url with azcopy options pass-through. + text: az storage copy -s /path/to/file.txt -d https://[account].blob.core.windows.net/[container]/[path/to/blob] -- --block-size-mb=0.25 --check-length """ helps['storage cors'] = """ diff --git a/src/azure-cli/azure/cli/command_modules/storage/_params.py b/src/azure-cli/azure/cli/command_modules/storage/_params.py index 56b4d6aa098..6a23a18d24a 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/_params.py +++ b/src/azure-cli/azure/cli/command_modules/storage/_params.py @@ -1076,6 +1076,9 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem c.argument('cap_mbps', arg_group='Additional Flags', help="Caps the transfer rate, in megabits per second. " "Moment-by-moment throughput might vary slightly from the cap. " "If this option is set to zero, or it is omitted, the throughput isn't capped. ") + c.positional('extra_options', nargs='*', is_experimental=True, default=[], + help="Other options which will be passed through to azcopy as it is. " + "Please put all the extra options after a `--`") with self.argument_context('storage blob copy') as c: for item in ['destination', 'source']: diff --git a/src/azure-cli/azure/cli/command_modules/storage/azcopy/util.py b/src/azure-cli/azure/cli/command_modules/storage/azcopy/util.py index bccd7f16d49..bddd2e71b6f 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/azcopy/util.py +++ b/src/azure-cli/azure/cli/command_modules/storage/azcopy/util.py @@ -23,7 +23,7 @@ STORAGE_RESOURCE_ENDPOINT = "https://storage.azure.com" SERVICES = {'blob', 'file'} -AZCOPY_VERSION = '10.8.0' +AZCOPY_VERSION = '10.13.0' class AzCopy: @@ -39,7 +39,7 @@ def install_azcopy(self, install_location): install_dir = os.path.dirname(install_location) if not os.path.exists(install_dir): os.makedirs(install_dir) - base_url = 'https://azcopyvnext.azureedge.net/release20201211/azcopy_{}_{}_{}.{}' + base_url = 'https://azcopyvnext.azureedge.net/release20211027/azcopy_{}_{}_{}.{}' if self.system == 'Windows': if platform.machine().endswith('64'): diff --git a/src/azure-cli/azure/cli/command_modules/storage/commands.py b/src/azure-cli/azure/cli/command_modules/storage/commands.py index f0b06cd5dd4..e71d4620e10 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/commands.py +++ b/src/azure-cli/azure/cli/command_modules/storage/commands.py @@ -99,7 +99,7 @@ def get_custom_sdk(custom_module, client_factory, resource_type=ResourceType.DAT with self.command_group('storage', custom_command_type=get_custom_sdk('azcopy', None)) as g: from ._validators import validate_azcopy_credential - g.storage_custom_command('copy', 'storage_copy', is_preview=True, validator=validate_azcopy_credential) + g.storage_custom_command('copy', 'storage_copy', validator=validate_azcopy_credential) with self.command_group('storage account', storage_account_sdk, resource_type=ResourceType.MGMT_STORAGE, custom_command_type=storage_account_custom_type) as g: diff --git a/src/azure-cli/azure/cli/command_modules/storage/linter_exclusions.yml b/src/azure-cli/azure/cli/command_modules/storage/linter_exclusions.yml index 7c508d79d7d..9ba27511279 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/linter_exclusions.yml +++ b/src/azure-cli/azure/cli/command_modules/storage/linter_exclusions.yml @@ -15,4 +15,9 @@ storage blob copy start: if_unmodified_since: rule_exclusions: - option_length_too_long +storage copy: + parameters: + extra_options: + rule_exclusions: + - no_positional_parameters ... \ No newline at end of file diff --git a/src/azure-cli/azure/cli/command_modules/storage/operations/azcopy.py b/src/azure-cli/azure/cli/command_modules/storage/operations/azcopy.py index f79e9343262..e147f503017 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/operations/azcopy.py +++ b/src/azure-cli/azure/cli/command_modules/storage/operations/azcopy.py @@ -10,7 +10,7 @@ def storage_copy(source, destination, put_md5=None, recursive=None, blob_type=None, preserve_s2s_access_tier=None, content_type=None, follow_symlinks=None, exclude_pattern=None, include_pattern=None, exclude_path=None, include_path=None, - cap_mbps=None, **kwargs): + cap_mbps=None, extra_options=None, **kwargs): azcopy = AzCopy() flags = [] @@ -36,6 +36,8 @@ def storage_copy(source, destination, put_md5=None, recursive=None, blob_type=No flags.append('--follow-symlinks=true') if cap_mbps is not None: flags.append('--cap-mbps=' + cap_mbps) + if extra_options is not None: + flags.extend(extra_options) azcopy.copy(source, destination, flags=flags)