Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az monitor data-collection rule update fails updating stream declaration #7743

Open
erikrok opened this issue Jun 25, 2024 · 2 comments
Open
Assignees
Labels
Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone

Comments

@erikrok
Copy link

erikrok commented Jun 25, 2024

Describe the bug

Updating an existing data collection rule is not working.

az monitor data-collection rule update --resource-group my-rg --name my-dcr --stream-declarations "columns[{location:string}]"

error:
argument: Model 'AAZObjectArg' has no field named 'location'

az monitor data-collection rule update --resource-group my-rg --name my-dcr --stream-declarations "columns=[{'location':'string'}]"

error:
Failed to parse '--stream-declarations' argument: dict type value expected, got '[OrderedDict([('location', 'string')])]'(<class 'list '>)

Related command

az monitor data-collection rule update --resource-group my-rg --name my-dcr --stream-declarations "columns[{location:string}]"

Errors

Failed to parse '--stream-declarations' argument: dict type value expected, got '[OrderedDict([('location', 'string')])]'(<class 'list or argument: Model 'AAZObjectArg' has no field named 'location' `

Issue script & Debug output

cli.knack.cli: Command arguments: ['monitor', 'data-collection', 'rule', 'update', '--debug', '--resource-group', 'my-rg', '--nam
e', 'dcr-ghaction', '--stream-declarations', "columns=[{'location':'string'}]"]
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x0286EA78>, <function Output
Producer.on_global_arguments at 0x02B94B68>, <function CLIQuery.on_global_arguments at 0x02BB9938>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'monitor': ['azure.cli.command_modules.monitor', 'azext_applicationinsights', 'azext_
amcs']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: monitor                   0.659        22        65
cli.azure.cli.core: Total (1)                 0.659        22        65
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name                  Load Time    Groups  Commands  Directory
cli.azure.cli.core: application-insights      0.011        10        30  C:\Users\user\.azure\cliextensions\application-insigh
ts
cli.azure.cli.core: monitor-control-service      0.041        10        30  C:\Users\user\.azure\cliextensions\monitor-control
-service
cli.azure.cli.core: Total (2)                 0.052        20        60  
cli.azure.cli.core: Loaded 40 groups, 125 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : monitor data-collection rule update
cli.azure.cli.core: Command table: monitor data-collection rule update
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x03918258>]      
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\user\.azure\commands\2024-06-25.13-28-
42.monitor_data-collection_rule_update.34000.log'.
az_command_data_logger: command args: monitor data-collection rule update --debug --resource-group {} --name {} --stream-declarations 
{}
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_para
meter at 0x0394C348>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x0394C43
8>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x0395D618>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_action.py", line 89, in __call__ 
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_action.py", line 189, in setup_op
erations
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_action.py", line 296, in format_d
ata
azure.cli.core.aaz.exceptions.AAZInvalidValueError: dict type value expected, got '[OrderedDict([('location', 'string')])]'(<class 'li
st'>)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 589, in execut
e
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/parser.py", line 261, in parse_args
  File "argparse.py", line 1869, in parse_args
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/parser.py", line 281, in parse_known_args 
  File "argparse.py", line 1902, in parse_known_args
  File "argparse.py", line 2096, in _parse_known_args
  File "argparse.py", line 2073, in consume_positionals
  File "argparse.py", line 1978, in take_action
  File "argparse.py", line 1241, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/parser.py", line 281, in parse_known_args 
  File "argparse.py", line 1902, in parse_known_args
  File "argparse.py", line 2096, in _parse_known_args
  File "argparse.py", line 2073, in consume_positionals
  File "argparse.py", line 1978, in take_action
  File "argparse.py", line 1241, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/parser.py", line 281, in parse_known_args 
  File "argparse.py", line 1902, in parse_known_args
  File "argparse.py", line 2096, in _parse_known_args
  File "argparse.py", line 2073, in consume_positionals
  File "argparse.py", line 1978, in take_action
  File "argparse.py", line 1241, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/parser.py", line 281, in parse_known_args 
  File "argparse.py", line 1902, in parse_known_args
  File "argparse.py", line 2096, in _parse_known_args
  File "argparse.py", line 2073, in consume_positionals
  File "argparse.py", line 1978, in take_action
  File "argparse.py", line 1241, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/parser.py", line 281, in parse_known_args 
  File "argparse.py", line 1902, in parse_known_args
  File "argparse.py", line 2114, in _parse_known_args
  File "argparse.py", line 2054, in consume_optional
  File "argparse.py", line 1978, in take_action
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_action.py", line 95, in __call__ 
azure.cli.core.azclierror.InvalidArgumentValueError: Failed to parse '--stream-declarations' argument: dict type value expected, got '
[OrderedDict([('location', 'string')])]'(<class 'list'>)

cli.azure.cli.core.azclierror: Failed to parse '--stream-declarations' argument: dict type value expected, got '[OrderedDict([('locati
on', 'string')])]'(<class 'list'>)
az_command_data_logger: Failed to parse '--stream-declarations' argument: dict type value expected, got '[OrderedDict([('location', 's
tring')])]'(<class 'list'>)
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x03918398>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 1.457 seconds (init: 0.621, invoke: 0.837)

Expected behavior

  "resourceGroup": "my-rg",
  "streamDeclarations": {
    "Custom-mytable_CL": {
      "columns": [
        {
          "name": "TimeGenerated",
          "type": "datetime"
        },
        {
          "name": "location",
          "type": "string"
        },
        {
          "name": "properties",
          "type": "dynamic"
        }
      ]
    }
  },

Environment Summary

{
  "azure-cli": "2.61.0",
  "azure-cli-core": "2.61.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {
    "account": "0.2.3",
    "application-insights": "0.1.19",
    "azure-devops": "0.26.0",
    "datafactory": "0.6.0",
    "kusto": "0.5.0",
    "monitor-control-service": "1.1.0"
  }
}

Additional context

No response

@erikrok erikrok added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Jun 25, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Jun 25, 2024

Thank you for opening this issue, we will look into it.

@microsoft-github-policy-service microsoft-github-policy-service bot added question The issue doesn't require a change to the product in order to be resolved. Most issues start as that customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Monitor labels Jun 25, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Azure CLI Team The command of the issue is owned by Azure CLI team label Jun 25, 2024
@yonzhan yonzhan added this to the Backlog milestone Jun 25, 2024
@yonzhan yonzhan removed the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Jun 25, 2024
@AllyW
Copy link
Member

AllyW commented Jul 1, 2024

@erikrok Custom-mytable_CL is needed ourside columns structure.

For now, you can put all your streamDeclarations data into rule-file arg, like below, and it'll take care of the obj parsing by default.

image

@AllyW AllyW added the non-security This feature ask is not related to security. label Jul 25, 2024
@Azure Azure deleted a comment from github-actions bot Jul 25, 2024
@AllyW AllyW removed the non-security This feature ask is not related to security. label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

3 participants