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 dfdc5433178..e799f356746 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 @@ -53,9 +53,11 @@ def install_azcopy(self, install_location): else: raise CLIError('Azcopy ({}) does not exist.'.format(self.system)) try: + os.chmod(install_dir, + os.stat(install_dir).st_mode | stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH) + _urlretrieve(file_url, install_location) os.chmod(install_location, os.stat(install_location).st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH) - _urlretrieve(file_url, install_location) except IOError as err: raise CLIError('Connection error while attempting to download azcopy {}. You could also install the ' 'specified azcopy version to {} manually. ({})'.format(AZCOPY_VERSION, install_dir, err))