How can I upload file from local to storage account using EV2
I tried How to upload the snapshot json into the storage account with Ev2 ARM template? - Microsoft Q&A. But while putting the local file name to templates getting error that file not present,
bacpac file which I want to upload to storage account is present in parallel to deploymentscript template.
Azure Storage Accounts
-
Shubhi Jain • 0 Reputation points • Microsoft Employee
2025-03-08T07:34:33.7066667+00:00 @Keshavulu Dasari please assist this
-
Shubhi Jain • 0 Reputation points • Microsoft Employee
2025-03-08T07:53:44.9133333+00:00 ERROR: The cloud 'AzureChinaCloud' is already registered.
WARNING: Switched active cloud to 'AzureChinaCloud'.
WARNING: Use 'az login' to log in to this cloud.
WARNING: Use 'az account set' to set the active subscription.
Adding certificates not required Registering and setting the cloud Registering cloud AzureChinaCloud Registering and setting the cloud completed Uploading blob customers.bacpac... total 21 drwxrwxrwx 2 root root 0 Mar 8 07:29 . drwxrwxrwx 2 root root 0 Mar 8 07:32 .. -rwxrwxrwx 1 root root 20137 Mar 8 07:46 DeploymentScript.sh -rwxrwxrwx 1 root root 268 Mar 8 07:46 userscript.sh DEBUG: cli.knack.cli: Command arguments: ['storage', 'blob', 'upload', '--file', './customers.bacpac', '--name', 'customers.bacpac', '--container-name', 'rolloutmgmtsyncmooncake', '--account-name', 'rolloutmgmtsamooncake', '--auth-mode', 'login', '--no-progress', '--debug'] DEBUG: cli.knack.cli: init debug log: Cannot enable color. DEBUG: cli.knack.cli: Event: Cli.PreExecute [] DEBUG: cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7fbd628c12d0>, <function OutputProducer.on_global_arguments at 0x7fbd62789870>, <function CLIQuery.on_global_arguments at 0x7fbd627cab00>] DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate [] DEBUG: cli.azure.cli.core: Modules found from index for 'storage': ['azure.cli.command_modules.storage'] DEBUG: cli.azure.cli.core: Loading command modules: DEBUG: cli.azure.cli.core: Name Load Time Groups Commands DEBUG: cli.azure.cli.core: storage 0.079 57 269 DEBUG: cli.azure.cli.core: Total (1) 0.079 57 269 DEBUG: cli.azure.cli.core: Loaded 57 groups, 269 commands. DEBUG: cli.azure.cli.core: Found a match in the command table. DEBUG: cli.azure.cli.core: Raw command : storage blob upload DEBUG: cli.azure.cli.core: Command table: storage blob upload DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7fbd6131e710>] DEBUG: cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/root/.azure/commands/2025-03-08.07-46-42.storage_blob_upload.101.log'. INFO: az_command_data_logger: command args: storage blob upload --file {} --name {} --container-name {} --account-name {} --auth-mode {} --no-progress --debug DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7fbd6133b490>] DEBUG: cli.azure.cli.core.profiles._shared: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/azure/cli/core/profiles/_shared.py", line 624, in _get_attr op = getattr(op, part) AttributeError: module 'azure.mgmt.storage.v2022_05_01.models' has no attribute 'ActiveDirectoryPropertiesAccountType' DEBUG: cli.azure.cli.core.profiles._shared: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/azure/cli/core/profiles/_shared.py", line 624, in _get_attr op = getattr(op, part) AttributeError: module 'azure.mgmt.storage.v2022_05_01.models' has no attribute 'ListKeyExpand' DEBUG: cli.azure.cli.core.profiles._shared: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/azure/cli/core/profiles/_shared.py", line 624, in _get_attr op = getattr(op, part) AttributeError: module 'azure.mgmt.storage.v2022_05_01.models' has no attribute 'CorsRuleAllowedMethodsItem' DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad [] DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7fbd61381d80>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7fbd61381ea0>] DEBUG: cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded [] DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreParseArgs [] DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7fbd62789900>, <function CLIQuery.handle_query_parameter at 0x7fbd627cab90>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x7fbd61381e10>] DEBUG: urllib3.connectionpool: Starting new HTTP connection (1): 169.254.169.254:80 DEBUG: urllib3.connectionpool: http://169.254.169.254:80 "GET /metadata/identity/oauth2/token?resource=https%3A%2F%2Fmanagement.core.chinacloudapi.cn%2F&api-version=2018-02-01 HTTP/1.1" 200 1760 DEBUG: msrestazure.azure_active_directory: MSI: Retrieving a token from http://169.254.169.254/metadata/identity/oauth2/token, with payload {'resource': 'https://management.core.chinacloudapi.cn/', 'api-version': '2018-02-01'} DEBUG: msrestazure.azure_active_directory: MSI: Token retrieved DEBUG: cli.azure.cli.core.profiles._shared: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/azure/cli/core/profiles/_shared.py", line 620, in _get_attr op = import_module(full_mod_path) File "/usr/local/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked ModuleNotFoundError: No module named 'azure.multiapi.storagev2.blob.v2021_06_08.blob' DEBUG: cli.azure.cli.core.profiles._shared: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/azure/cli/core/profiles/_shared.py", line 620, in _get_attr op = import_module(full_mod_path) File "/usr/local/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked ModuleNotFoundError: No module named 'azure.multiapi.storagev2.blob.v2021_06_08.file' DEBUG: cli.azure.cli.core.profiles._shared: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/azure/cli/core/profiles/_shared.py", line 620, in _get_attr op = import_module(full_mod_path) File "/usr/local/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked ModuleNotFoundError: No module named 'azure.multiapi.storagev2.blob.v2021_06_08.blob' DEBUG: cli.azure.cli.core.profiles._shared: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/azure/cli/core/profiles/_shared.py", line 620, in _get_attr op = import_module(full_mod_path) File "/usr/local/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked ModuleNotFoundError: No module named 'azure.multiapi.storagev2.blob.v2021_06_08.file' DEBUG: cli.azure.cli.core.util: azure.cli.core.util.handle_exception is called with an exception: DEBUG: cli.azure.cli.core.util: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job result = cmd_copy(params) File "/usr/local/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 333, in call return self.handler(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(**command_args) File "/usr/local/lib/python3.10/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 629, in upload_blob length = os.path.getsize(file_path) File "/usr/local/lib/python3.10/genericpath.py", line 50, in getsize return os.stat(filename).st_size FileNotFoundError: [Errno 2] No such file or directory: './customers.bacpac' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) File "/usr/local/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 663, in execute raise ex File "/usr/local/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/usr/local/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 718, in _run_job return cmd_copy.exception_handler(ex) File "/usr/local/lib/python3.10/site-packages/azure/cli/command_modules/storage/init.py", line 411, in new_handler first(ex) File "/usr/local/lib/python3.10/site-packages/azure/cli/command_modules/storage/init.py", line 411, in new_handler first(ex) File "/usr/local/lib/python3.10/site-packages/azure/cli/command_modules/storage/_exception_handler.py", line 9, in file_related_exception_handler raise FileOperationError(ex, recommendation='Please check the file path.') azure.cli.core.azclierror.FileOperationError: [Errno 2] No such file or directory: './customers.bacpac' ERROR: cli.azure.cli.core.azclierror: [Errno 2] No such file or directory: './customers.bacpac' ERROR: az_command_data_logger: [Errno 2] No such file or directory: './customers.bacpac' Please check the file path. DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7fbd6131e950>] INFO: az_command_data_logger: exit code: 1 INFO: cli.main: Command ran in 1.145 seconds (init: 0.306, invoke: 0.839) INFO: cli.azure.cli.core.decorators: Suppress exception: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/azure/cli/main.py", line 61, in <module> raise ex File "/usr/local/lib/python3.10/site-packages/azure/cli/main.py", line 54, in <module> sys.exit(exit_code) SystemExit: 1 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/azure/cli/core/decorators.py", line 79, in _wrapped_func return func(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/azure/cli/core/telemetry.py", line 117, in generate_payload payload = json.dumps(self.events, separators=(',', ':')) File "/usr/local/lib/python3.10/json/init.py", line 238, in dumps **kw).encode(obj) File "/usr/local/lib/python3.10/json/encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "/usr/local/lib/python3.10/json/encoder.py", line 257, in iterencode return _iterencode(o, 0) File "/usr/local/lib/python3.10/json/encoder.py", line 179, in default raise TypeError(f'Object of type {o.class.name} ' TypeError: Object of type FileNotFoundError is not JSON serializable INFO: telemetry.main: Split cli events and extra events failure: the JSON object must be str, bytes or bytearray, not NoneType
Sign in to comment