Unable to create diagnostic setting for Activity Log
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
**Describe the bug**
I'm attempting to create a script to automate creation of diagnostic settings for Activity Log events but it is failing with the error message `'resource_group'`
**To Reproduce**
```
az monitor diagnostic-settings create \
--name team-logging \
--resource "/subscriptions/[REDACTED]" \
--workspace /subscriptions/[REDACTED]/resourcegroups/[REDACTED]/providers/microsoft.operationalinsights/workspaces/[REDACTED] \
--logs '[{"category":"Alert","enabled":false,"retentionPolicy": {"days":0,"enabled":false}}]' \
--debug
```
**Expected behavior**
Diagnostic setting is created correctly
**Environment summary**
```
az --version
azure-cli 2.24.0
core 2.24.0
telemetry 1.0.6
Extensions:
spring-cloud 2.1.1
portal 0.1.1
application-insights 0.1.13
Python location '/opt/az/bin/python3'
Extensions directory '/home/[REDACTED]/.azure/cliextensions'
Python (Linux) 3.6.10 (default, May 21 2021, 07:22:10)
[GCC 7.5.0]
```
**Additional context**
Actual output with debug info is the following
```
cli.knack.cli: Command arguments: ['monitor', 'diagnostic-settings', 'create', '--name', 'team-logging', '--resource', '/subscriptions/[REDACTED]', '--workspace', '/subscriptions/[REDACTED]/resourcegroups/[REDACTED]/providers/microsoft.operationalinsights/workspaces/[REDACTED]', '--logs', '[{"category":"Alert","enabled":false,"retentionPolicy": {"days":0,"enabled":false}}]', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [, , ]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'monitor': ['azure.cli.command_modules.monitor', 'azext_applicationinsights']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: monitor 0.079 32 133
cli.azure.cli.core: Total (1) 0.079 32 133
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.024 9 24 /home/[REDACTED]/.azure/cliextensions/application-insights
cli.azure.cli.core: Total (1) 0.024 9 24
cli.azure.cli.core: Loaded 40 groups, 157 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : monitor diagnostic-settings create
cli.azure.cli.core: Command table: monitor diagnostic-settings create
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate []
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/[REDACTED]/.azure/commands/2021-05-26.17-08-07.monitor_diagnostic-settings_create.15513.log'.
az_command_data_logger: command args: monitor diagnostic-settings create --name {} --resource {} --workspace {} --logs {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [.add_subscription_parameter at 0x7f6d572c60d0>, .register_query_examples at 0x7f6d57228158>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [.add_ids_arguments at 0x7f6d572281e0>, .add_cache_arguments at 0x7f6d572282f0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [, , .handle_example_parameter at 0x7f6d572280d0>, .parse_ids_arguments at 0x7f6d57228268>]
cli.azure.cli.core.azclierror: 'resource_group'
az_command_data_logger: 'resource_group'
cli.knack.cli: Event: Cli.PostExecute []
az_command_data_logger: exit code: 2
cli.__main__: Command ran in 3.002 seconds (init: 0.751, invoke: 2.251)
telemetry.save: Save telemetry record of length 3132 in cache
telemetry.check: Negative: The /home/[REDACTED]/.azure/telemetry.txt was modified at 2021-05-26 17:02:11.215225, which in less than 600.000000 s
```
Contributor guide
Assessment
This issue has not been assessed yet.