az monitor diagnostic-settings create unable to provide resource id #26828
Labels
Auto-Assign
Auto assign by bot
Azure CLI Team
The command of the issue is owned by Azure CLI team
bug
This issue requires a change to an existing behavior in the product in order to be resolved.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
Monitor
az monitor
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone
Describe the bug
When I run the az monitor diagnostic-settings create -n "name" --resource /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.KeyVault/vaults/{name}
(I copied the resource from the portal)
I get the error:
ERROR: usage error: --resource ID | --resource NAME --resource-group NAME --resource-type TYPE [--resource-parent PARENT] [--resource-namespace NAMESPACE]
It does work when I use the resource name together with the group name and resource type, but I want to use the ID.
I also want to add a workspace in a different resource group, this is why I want to use the resource ID.
btw: providing the workspace with the workspace resource id also doesn't work.
Related command
az monitor diagnostic-settings create
Errors
ERROR: usage error: --resource ID | --resource NAME --resource-group NAME --resource-type TYPE [--resource-parent PARENT] [--resource-namespace NAMESPACE]
Issue script & Debug output
DEBUG: cli.azure.cli.core.azclierror: 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 663, in execute
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 726, in _run_jobs_serially
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 697, in _run_job
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command.py", line 149, in call
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/monitor/aaz/latest/monitor/diagnostic_settings/_create.py", line 33, in _handler
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/monitor/aaz/latest/monitor/diagnostic_settings/_create.py", line 176, in _execute_operations
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/monitor/operations/diagnostics_settings.py", line 95, in pre_operations
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/monitor/operations/diagnostics_settings.py", line 67, in update_resource_parameters
knack.util.CLIError: usage error: --resource ID | --resource NAME --resource-group NAME --resource-type TYPE [--resource-parent PARENT] [--resource-namespace NAMESPACE]
ERROR: cli.azure.cli.core.azclierror: usage error: --resource ID | --resource NAME --resource-group NAME --resource-type TYPE [--resource-parent PARENT] [--resource-namespace NAMESPACE]
ERROR: az_command_data_logger: usage error: --resource ID | --resource NAME --resource-group NAME --resource-type TYPE [--resource-parent PARENT] [--resource-namespace NAMESPACE]
DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x0405C658>]
INFO: az_command_data_logger: exit code: 1
INFO: cli.main: Command ran in 0.627 seconds (init: 0.254, invoke: 0.373)
INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1
INFO: telemetry.client: Accumulated 0 events. Flush the clients.
INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1
INFO: telemetry.save: Save telemetry record of length 3540 in cache
WARNING: telemetry.check: Negative: The C:\Users\xxxxxx.azure\telemetry.txt was modified at 2023-07-06 12:27:26.650172, which in less than 600.000000 s
Expected behavior
That the command can find the resource when the resource id is provided.
Environment Summary
azure-cli 2.50.0
core 2.50.0
telemetry 1.0.8
Dependencies:
msal 1.22.0
azure-mgmt-resource 23.1.0b2
Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\xxxxxxxx.azure\cliextensions'
Python (Windows) 3.10.10 (tags/v3.10.10:aad5f6a, Feb 7 2023, 17:05:00) [MSC v.1929 32 bit (Intel)]
Additional context
No response
The text was updated successfully, but these errors were encountered: