azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

`az synapse sql audit-policy show` needs value for optional `--blob-auditing-policy-name`

Open HansZimmer5000 opened this issue 5 years ago • 5 comments

Describe the bug

Command Name az synapse sql audit-policy show

Errors:

The command failed with an unexpected error. Here is the traceback:
No value for given attribute
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
    raise ex
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
    result = cmd_copy(params)
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/command_operation.py", line 363, in handler
    show_exception_handler(ex)
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/arm.py", line 429, in show_exception_handler
    raise ex
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/command_operation.py", line 361, in handler
    return op(**command_args)
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/command_modules/synapse/manual/operations/sqlpoolblobauditingpolicy.py", line 911, in workspace_audit_policy_show
    return _audit_policy_show(
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/command_modules/synapse/manual/operations/sqlpoolblobauditingpolicy.py", line 955, in _audit_policy_show
    audit_policy = client.get(
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/mgmt/synapse/operations/_workspace_managed_sql_server_blob_auditing_policies_operations.py", line 87, in get
    'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'),
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/msrest/serialization.py", line 650, in url
    output = self.serialize_data(data, data_type, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/msrest/serialization.py", line 758, in serialize_data
    raise ValueError("No value for given attribute")
ValueError: No value for given attribute

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Open a BASH Terminal
  • az login
  • az synapse sql audit-policy show --workspace-name {some existing workspace-name} --resource-group {the matching resource-group}

Expected Behavior

No error due to omitting of optional --blob-auditing-policy-name

Environment Summary

macOS-11.6.1-x86_64-i386-64bit, Darwin 20.6.0
Python 3.9.7
Installer: HOMEBREW

azure-cli 2.30.0

Additional Context

Hotfix / Workaround

Set empty value: az synapse sql audit-policy show --workspace-name {some existing workspace-name} --resource-group {the matching resource-group} --blob-auditing-policy-name ""

Without prior look at the code, I guess the problem is that the variable does not have a default value and so relies on some value coming from the cli. If I have the time, I will create a PR later.

HansZimmer5000 avatar Nov 08 '21 15:11 HansZimmer5000

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @wonner, @zesluo.

Issue Details

Describe the bug

Command Name az synapse sql audit-policy show

Errors:

The command failed with an unexpected error. Here is the traceback:
No value for given attribute
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
    raise ex
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
    result = cmd_copy(params)
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/command_operation.py", line 363, in handler
    show_exception_handler(ex)
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/arm.py", line 429, in show_exception_handler
    raise ex
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/command_operation.py", line 361, in handler
    return op(**command_args)
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/command_modules/synapse/manual/operations/sqlpoolblobauditingpolicy.py", line 911, in workspace_audit_policy_show
    return _audit_policy_show(
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/command_modules/synapse/manual/operations/sqlpoolblobauditingpolicy.py", line 955, in _audit_policy_show
    audit_policy = client.get(
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/mgmt/synapse/operations/_workspace_managed_sql_server_blob_auditing_policies_operations.py", line 87, in get
    'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'),
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/msrest/serialization.py", line 650, in url
    output = self.serialize_data(data, data_type, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/msrest/serialization.py", line 758, in serialize_data
    raise ValueError("No value for given attribute")
ValueError: No value for given attribute

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Open a BASH Terminal
  • az login
  • az synapse sql audit-policy show --workspace-name {some existing workspace-name} --resource-group {the matching resource-group}

Expected Behavior

No error due to omitting of optional --blob-auditing-policy-name

Environment Summary

macOS-11.6.1-x86_64-i386-64bit, Darwin 20.6.0
Python 3.9.7
Installer: HOMEBREW

azure-cli 2.30.0

Additional Context

Hotfix / Workaround

Set empty value: az synapse sql audit-policy show --workspace-name {some existing workspace-name} --resource-group {the matching resource-group} --blob-auditing-policy-name ""

Without prior look at the code, I guess the problem is that the variable does not have a default value and so relies on some value coming from the cli. If I have the time, I will create a PR later.

Author: HansZimmer5000
Assignees: -
Labels:

Service Attention, customer-reported, Synapse

Milestone: -

ghost avatar Nov 08 '21 15:11 ghost

route to service team

yonzhan avatar Nov 08 '21 15:11 yonzhan

Hello @HansZimmer5000 , I can repo it. Thanks for your feedback! I will make a PR for it then.

zesluo avatar Nov 09 '21 11:11 zesluo

PR merged, thanks

zesluo avatar Dec 01 '21 05:12 zesluo

fyi, mentioned PR is here

HansZimmer5000 avatar Dec 16 '21 14:12 HansZimmer5000