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

'InvalidArgumentValue' on az portal dashboard delete #8491

Open
eardanow opened this issue Feb 19, 2025 · 4 comments · May be fixed by #8521
Open

'InvalidArgumentValue' on az portal dashboard delete #8491

eardanow opened this issue Feb 19, 2025 · 4 comments · May be fixed by #8521
Assignees
Labels
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. Portal Service Attention This issue is responsible by Azure service team.

Comments

@eardanow
Copy link

Describe the bug

I've got az extension "portal" in version 1.0.0b1, and when running 'az portal dashboard delete' I've got an error suggesting dashboard name does not meet the requirements, which is matching regex '^[a-zA-Z0-9-]{3,24}$'. Dashboard name has indeed more that 24 characters, but according to the documentation: https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules#microsoftportal it can have up to 160 characters

Related command

az portal dashboard delete --name "laas-availability-drilldown" --resource-group rg-itp-us-pre25 -y

Errors

InvalidArgumentValue: -n: Invalid format: 'laas-availability-drilldown' does not fully match regular expression pattern '^[a-zA-Z0-9-]{3,24}$'

Issue script & Debug output

eardanow@eardanow-u22:~/laas.gaia$ az portal dashboard delete --name "laas-availability-drilldown" --resource-group rg-itp-us-pre25 -y --debug
cli.knack.cli: Command arguments: ['portal', 'dashboard', 'delete', '--name', 'laas-availability-drilldown', '--resource-group', 'rg-itp-us-pre25', '-y', '--debug']
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 0x7f58fc67b740>, <function OutputProducer.on_global_arguments at 0x7f58fc3c2700>, <function CLIQuery.on_global_arguments at 0x7f58fc407c40>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'portal': ['azext_portal']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: Total (0) 0.000 0 0
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: portal 0.319 2 6 /home/eardanow/.azure/cliextensions/portal
cli.azure.cli.core: Total (1) 0.319 2 6
cli.azure.cli.core: Loaded 2 groups, 6 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : portal dashboard delete
cli.azure.cli.core: Command table: portal dashboard delete
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f58fb622de0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/eardanow/.azure/commands/2025-02-19.12-25-45.portal_dashboard_delete.341751.log'.
az_command_data_logger: command args: portal dashboard delete --name {} --resource-group {} -y --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7f58fb663d80>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7f58fb696160>, <function register_cache_arguments..add_cache_arguments at 0x7f58fb6962a0>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x7f58fb696340>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f58fc3c27a0>, <function CLIQuery.handle_query_parameter at 0x7f58fc407ce0>, <function register_ids_argument..parse_ids_arguments at 0x7f58fb696200>]
az_command_data_logger: extension name: portal
az_command_data_logger: extension version: 1.0.0b1
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_command_ctx.py", line 53, in format_args
self.args._schema._fmt(ctx=self, value=self.args)
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_arg_fmt.py", line 402, in call
raise err from err
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_arg_fmt.py", line 399, in call
value[field_name] = field_schema._fmt(ctx, value[field_name])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_arg_fmt.py", line 56, in call
raise AAZInvalidArgValueError(
azure.cli.core.aaz.exceptions.AAZInvalidArgValueError: InvalidArgumentValue: -n: Invalid format: 'laas-availability-drilldown' does not fully match regular expression pattern '^[a-zA-Z0-9-]{3,24}$'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 666, in execute
raise ex
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 734, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job
result = cmd_copy(params)
^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_command.py", line 155, in call
return self._handler(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eardanow/.azure/cliextensions/portal/azext_portal/aaz/latest/portal/dashboard/_delete.py", line 33, in _handler
super()._handler(command_args)
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_command.py", line 165, in _handler
self.ctx.format_args()
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_command_ctx.py", line 55, in format_args
raise InvalidArgumentValueError(str(err))
azure.cli.core.azclierror.InvalidArgumentValueError: InvalidArgumentValue: -n: Invalid format: 'laas-availability-drilldown' does not fully match regular expression pattern '^[a-zA-Z0-9-]{3,24}$'

cli.azure.cli.core.azclierror: InvalidArgumentValue: -n: Invalid format: 'laas-availability-drilldown' does not fully match regular expression pattern '^[a-zA-Z0-9-]{3,24}$'
az_command_data_logger: InvalidArgumentValue: -n: Invalid format: 'laas-availability-drilldown' does not fully match regular expression pattern '^[a-zA-Z0-9-]{3,24}$'
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f58fb623060>]
az_command_data_logger: exit code: 1
cli.main: Command ran in 0.806 seconds (init: 0.390, invoke: 0.417)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 4017 in cache file under /home/eardanow/.azure/telemetry/20250219122545855
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.12/site-packages/azure/cli/telemetry/init.py /home/eardanow/.azure /home/eardanow/.azure/telemetry/20250219122545855"
telemetry.process: Return from creating process 341756
telemetry.main: Finish creating telemetry upload process.
eardanow@eardanow-u22:~/laas.gaia$

Expected behavior

Command should delete the dashboard

Environment Summary

azure-cli 2.67.0 *

core 2.67.0 *
telemetry 1.1.0

Extensions:
portal 1.0.0b1

Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1

Additional context

The problem does not occurs for az extension 'portal' version 0.1.3
Behavior is inconsistent with documentation: https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules#microsoftportal

@eardanow eardanow added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Feb 19, 2025
@yonzhan
Copy link
Collaborator

yonzhan commented Feb 19, 2025

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. labels Feb 19, 2025
@yonzhan yonzhan added Portal Service Attention This issue is responsible by Azure service team. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Feb 19, 2025
@jsntcy jsntcy assigned Jing-song and cxznmhdcxz and unassigned Jing-song Feb 19, 2025
@jsntcy
Copy link
Member

jsntcy commented Feb 19, 2025

@cxznmhdcxz, please help take a look at this issue, thanks.

@peterpalfi
Copy link

Can confirm, I have also run into this error, but with az portal dashboard create. It seems as if the API specs are contradictory, and the regex pattern for validating the max length of the name parameter seems to be wrong: Microsoft.Portal dashboards 2022-12-01-preview

More discussions here: #8383 (comment)

@es-cs1
Copy link

es-cs1 commented Feb 25, 2025

This is affecting me as well, I need to include more than 24 characters of information into my dashboard name

@cxznmhdcxz cxznmhdcxz linked a pull request Mar 5, 2025 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. Portal Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants