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 diagnostic-settings create unable to provide resource id #26828

Closed
dannyljl opened this issue Jul 6, 2023 · 2 comments
Closed

az monitor diagnostic-settings create unable to provide resource id #26828

dannyljl opened this issue Jul 6, 2023 · 2 comments
Assignees
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

Comments

@dannyljl
Copy link

dannyljl commented Jul 6, 2023

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

@dannyljl dannyljl added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Jul 6, 2023
@ghost ghost added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Monitor az monitor labels Jul 6, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Jul 6, 2023

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

@ghost ghost assigned AllyW Jul 6, 2023
@ghost ghost added this to the Backlog milestone Jul 6, 2023
@ghost ghost added Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jul 6, 2023
@dannyljl dannyljl closed this as completed Jul 6, 2023
@dannyljl
Copy link
Author

dannyljl commented Jul 6, 2023

Solved it by running the command in powershell 7

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 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
Projects
None yet
Development

No branches or pull requests

3 participants