Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/azure-cli/azure/cli/command_modules/storage/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = """
Expand Down
3 changes: 3 additions & 0 deletions src/azure-cli/azure/cli/command_modules/storage/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=[],
Comment thread
evelyn-ys marked this conversation as resolved.
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']:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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'):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
...
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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)


Expand Down