`az ams account show --name <>` throws errors
This is autogenerated. Please review and update as needed.
Describe the bug
Command Name
az ams account show --name <mediaservicename>
Errors:
The command failed with an unexpected error. Here is the traceback:
'MediaservicesOperations' object has no attribute 'get_by_subscription'
Traceback (most recent call last):
File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
raise ex
File "/usr/local/Cellar/azure-cli/2.40.0/libexec/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/Cellar/azure-cli/2.40.0/libexec/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/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/ams/_exception_handler.py", line 16, in ams_exception_handler
raise ex
File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
result = cmd_copy(params)
File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
return self.handler(*args, **kwargs)
File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 363, in handler
show_exception_handler(ex)
File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/arm.py", line 429, in show_exception_handler
raise ex
File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 361, in handler
return op(**command_args)
File "/usr/local/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/ams/operations/account.py", line 17, in get_mediaservice
account_name) if resource_group_name else client.get_by_subscription(account_name)
AttributeError: 'MediaservicesOperations' object has no attribute 'get_by_subscription'
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
az ams account show --name {}
Expected Behavior
Azure Media Services account details are shown
Environment Summary
macOS-12.5.1-x86_64-i386-64bit, Darwin 21.6.0
Python 3.10.6
Installer: HOMEBREW
azure-cli 2.40.0
Extensions:
resource-graph 2.1.0
Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1
Additional Context
NOTE: providing resource group name via -g flag makes it to work (az ams account show --name <name> -g <rg> WORKS)
Similar issues: #22897
route to CXP team
From https://github.com/Azure/azure-sdk-for-python/pull/19067/files#diff-e9068214fdef0ba0f16c61272f00e7dab5a02032e8ec3d08a3725b5d4723ae09R34
## 7.0.0 (2021-06-03)
**Breaking changes**
- Removed operation MediaservicesOperations.get_by_subscription
and I guess this #18687 update didn't catch that
UPDATE: looked at this test case https://github.com/phcooper/azure-cli/blob/1e7f7962df34f3104db4f2eefdcbdfe46ccd4bc1/src/azure-cli/azure/cli/command_modules/ams/tests/latest/test_ams_account_scenarios.py#L34 - it specifies resource group as well. I tried to run the same command, but with -g flag -> SUCCESS !!! Will update the description.
@antonblr You are correct. While passing the--resource-group or -g the command works just fine. Please let us know if you need any further assistance on this issue.
@navba-MSFT the fact that it is working with --resource-group / -g does not solve the original issue. It should either - show the resource, or provide a friendly error message (i.e. --resource-group is required). But it should not throw stack traces. Though, it could be a low priority now.