`az vm create` template exception results in `AttributeError: 'str' object has no attribute 'message'`
See original GitHub issueDescribe the bug
msrest.exceptions : The template deployment 'vm_deploy_6wgE9OwiPdB6N2bH7t9TZfzPo0YBZmja' is not valid according to the validation procedure. The tracking id is '61a349e3-9cfa-4a75-989c-f1e4cfb9bd46'. See inner errors for details.
--- Logging error ---
Traceback (most recent call last):
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 636, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 306, in __call__
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 493, in default_command_handler
return op(**command_args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/vm/custom.py", line 804, in create_vm
LongRunningOperation(cmd.cli_ctx)(client.create_or_update(resource_group_name, deployment_name, properties))
File "/opt/az/lib/python3.6/site-packages/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py", line 2695, in create_or_update
**operation_config
File "/opt/az/lib/python3.6/site-packages/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py", line 2642, in _create_or_update_initial
raise exp
msrestazure.azure_exceptions.CloudError: <unprintable CloudError object>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/arm.py", line 103, in handle_template_based_exception
raise CLIError(ex.inner_exception.error.message) # NTL
AttributeError: 'str' object has no attribute 'message'
To Reproduce
az vm create
an instance that would generate a quota error
Expected behavior A simple error, not a big backtrace dump. Likely simply
InvalidTemplateDeployment
Environment summary
apt install on debian buster
2.0.81-1~buster
workaround diff:
diff --git a/src/azure-cli-core/azure/cli/core/commands/arm.py b/src/azure-cli-core/azure/cli/core/commands/arm.py
index d0fdd3c52..1cd110464 100644
--- a/src/azure-cli-core/azure/cli/core/commands/arm.py
+++ b/src/azure-cli-core/azure/cli/core/commands/arm.py
@@ -100,7 +100,7 @@ class ArmTemplateBuilder(object):
def handle_template_based_exception(ex):
try:
- raise CLIError(ex.inner_exception.error.message)
+ raise CLIError(ex.inner_exception.error)
except AttributeError:
raise CLIError(ex)
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Command raised an exception: AttributeError: 'str' object has ...
The following error appears when I execute the code. It was executed before I entered these codes. Finally, the add_reaction feature will not...
Read more >Adding Hybrid Connection with Azure CLI failed with slot ...
Hello,. I'm trying to use Azure CLI command to add Hybrid Connection to the app service slot, but it failed with error:.
Read more >Site works great yet why can't remove these ... - Django Forum
Exception while resolving variable 'class' in template ... AttributeError: 'dict' object has no attribute 'class'.
Read more >azure-cli 2.24.2 - PyPI
az vm create –count : Support vnet and subnet configuration (#17660) ... fails with AttributeError: 'Thread' object has no attribute 'isAlive' (#15446).
Read more >azure - 'str' object has no attribute 'cloud' - Server Fault
I am developing 1 web app for Azure by PHP. When i deploy this app to Azure by Azure CLI az webapp deployment...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The root cause is that the error message for going over quota contains non-ascii characters (“Details” is surrounded by smart single quotes). https://github.com/Azure/azure-cli/pull/12200#discussion_r381434412
Azure CLI 2.4.0 has been released. It fixes this issue.