azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Azure Managed Redis - Show Access Policies - Does not support GUID names

Open trindels opened this issue 5 months ago โ€ข 5 comments

Describe the bug

We cannot view any details of an individual access policy assignment on Azure Managed Redis.

Related command

az redisenterprise database access-policy-assignment show --resource-group rxr-rxi-devqe-01-cus-rg --cluster-name rxr-rxi-devqe-cus-redis-goods-receiving-01 --database-name default --access-policy-assignment-name 91c1e064-da28-45b9-936a-bc638d7bac55

Errors

InvalidArgumentValue: -n: Invalid format: '/subscriptions/{00000000-0000-0000-0000-000000000000}/resourceGroups/{rgname}/providers/Microsoft.Cache/redisEnterprise/{cacheName}/databases/default/accessPolicyAssignments/{objectIdGuid}' does not fully match regular expression pattern '^[A-Za-z0-9]{1,60}$'

Issue script & Debug output

cli.knack.cli: Command arguments: ['redisenterprise', 'database', 'access-policy-assignment', 'show', '--resource-group', 'rxr-rxi-devqe-01-cus-rg', '--cluster-name', 'rxr-rxi-devqe-cus-redis-goods-receiving-01', '--database-name', 'default', '--access-policy-assignment-name', '/subscriptions/117cc72c-bb3d-4b86-beba-be946bf2f5d8/resourceGroups/rxr-rxi-devqe-01-cus-rg/providers/Microsoft.Cache/redisEnterprise/rxr-rxi-devqe-cus-redis-goods-receiving-01/databases/default/accessPolicyAssignments/91c1e064-da28-45b9-936a-bc638d7bac55', '--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 0x0000021133719C60>, <function OutputProducer.on_global_arguments at 0x00000211338B1D00>, <function CLIQuery.on_global_arguments at 0x00000211338FFD80>] cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate [] cli.azure.cli.core: Using packaged command index for profile 'latest'. cli.azure.cli.core: Found installed extension 'azure-devops' (azext_devops). cli.azure.cli.core: Blending packaged core index with local extension index. cli.azure.cli.core: Modules found from index for 'redisenterprise': ['azext_redisenterprise'] cli.azure.cli.core: Loading command modules... cli.azure.cli.core: Loaded command modules in parallel: cli.azure.cli.core: Name Load Time Groups Commands cli.azure.cli.core: Total (0) 0.006 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: redisenterprise 0.119 4 29 C:\Users\trrind4x.azure\cliextensions\redisenterprise cli.azure.cli.core: Total (1) 0.119 4 29 cli.azure.cli.core: Loaded 4 groups, 29 commands. cli.azure.cli.core: Found a match in the command table. cli.azure.cli.core: Raw command : redisenterprise database access-policy-assignment show cli.azure.cli.core: Command table: redisenterprise database access-policy-assignment show cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x0000021133EB7420>] cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\trrind4x.azure\commands\2026-06-16.10-36-36.redisenterprise_database_access-policy-assignment_show.18604.log'. az_command_data_logger: command args: redisenterprise database access-policy-assignment show --resource-group {} --cluster-name {} --database-name {} --access-policy-assignment-name {} --debug cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x0000021133F0C4A0>] cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad [] cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x0000021133F0CAE0>, <function register_global_policy_argument..add_global_policy_argument at 0x0000021133F0CC20>, <function register_cache_arguments..add_cache_arguments at 0x0000021133F0CCC0>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x0000021133F0CD60>] cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded [] cli.knack.cli: Event: CommandInvoker.OnPreParseArgs [] cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x00000211338B1DA0>, <function CLIQuery.handle_query_parameter at 0x00000211338FFE20>, <function register_ids_argument..parse_ids_arguments at 0x0000021133F0CB80>] az_command_data_logger: extension name: redisenterprise az_command_data_logger: extension version: 1.4.0 This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus 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/_command_ctx.py", line 53, in format_args File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_fmt.py", line 402, in call File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_fmt.py", line 399, in call File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_fmt.py", line 56, in call azure.cli.core.aaz.exceptions.AAZInvalidArgValueError: InvalidArgumentValue: -n: Invalid format: '/subscriptions/117cc72c-bb3d-4b86-beba-be946bf2f5d8/resourceGroups/rxr-rxi-devqe-01-cus-rg/providers/Microsoft.Cache/redisEnterprise/rxr-rxi-devqe-cus-redis-goods-receiving-01/databases/default/accessPolicyAssignments/91c1e064-da28-45b9-936a-bc638d7bac55' does not fully match regular expression pattern '^[A-Za-z0-9]{1,60}$'

During handling of the above exception, another exception occurred:

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 677, in execute File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 820, 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 789, in _run_job File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command.py", line 154, in call File "C:\Users\trrind4x.azure\cliextensions\redisenterprise\azext_redisenterprise\aaz\latest\redisenterprise\database\access_policy_assignment_show.py", line 33, in _handler super()._handler(command_args) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command.py", line 164, in _handler File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command_ctx.py", line 55, in format_args azure.cli.core.azclierror.InvalidArgumentValueError: InvalidArgumentValue: -n: Invalid format: '/subscriptions/117cc72c-bb3d-4b86-beba-be946bf2f5d8/resourceGroups/rxr-rxi-devqe-01-cus-rg/providers/Microsoft.Cache/redisEnterprise/rxr-rxi-devqe-cus-redis-goods-receiving-01/databases/default/accessPolicyAssignments/91c1e064-da28-45b9-936a-bc638d7bac55' does not fully match regular expression pattern '^[A-Za-z0-9]{1,60}$'

cli.azure.cli.core.azclierror: InvalidArgumentValue: -n: Invalid format: '/subscriptions/117cc72c-bb3d-4b86-beba-be946bf2f5d8/resourceGroups/rxr-rxi-devqe-01-cus-rg/providers/Microsoft.Cache/redisEnterprise/rxr-rxi-devqe-cus-redis-goods-receiving-01/databases/default/accessPolicyAssignments/91c1e064-da28-45b9-936a-bc638d7bac55' does not fully match regular expression pattern '^[A-Za-z0-9]{1,60}$' az_command_data_logger: InvalidArgumentValue: -n: Invalid format: '/subscriptions/117cc72c-bb3d-4b86-beba-be946bf2f5d8/resourceGroups/rxr-rxi-devqe-01-cus-rg/providers/Microsoft.Cache/redisEnterprise/rxr-rxi-devqe-cus-redis-goods-receiving-01/databases/default/accessPolicyAssignments/91c1e064-da28-45b9-936a-bc638d7bac55' does not fully match regular expression pattern '^[A-Za-z0-9]{1,60}$' cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x0000021133EB76A0>] az_command_data_logger: exit code: 1 cli.main: Command ran in 0.793 seconds (init: 0.166, invoke: 0.627) telemetry.main: Begin splitting cli events and extra events, total events: 1 telemetry.main: Finish splitting cli events and extra events, cli events: 1 telemetry.save: Save telemetry record of length 4488 in cache file under C:\Users\trrind4x.azure\telemetry\20260616103636817 telemetry.main: Begin creating telemetry upload process. telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry_init_.pyc C:\Users\trrind4x.azure C:\Users\trrind4x.azure\telemetry\20260616103636817" telemetry.process: Return from creating process 19216 telemetry.main: Finish creating telemetry upload process.

Expected behavior

By default, all azure-policy-assignment names are created with the GUID of the User / Service Principal ObjectId when using the portal. This can be seen with the az redisenterprise database access-policy-assignment list ... command.

Environment Summary

azure-cli 2.87.0

core 2.87.0 telemetry 1.1.0

Extensions: azure-devops 1.0.2 bastion 1.4.2 redisenterprise 1.4.0

Dependencies: msal 1.36.0 azure-mgmt-resource 24.0.0

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe' Config directory 'C:\Users\trrind4x.azure' Extensions directory 'C:\Users\trrind4x.azure\cliextensions'

Python (Windows) 3.13.13 (tags/v3.13.13:01104ce, Apr 7 2026, 19:25:48) [MSC v.1944 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

trindels avatar Jun 16 '26 15:06 trindels

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

yonzhan avatar Jun 16 '26 15:06 yonzhan

Routed to Azure/azure-cli-extensions as #9945 (https://github.com/Azure/azure-cli-extensions/issues/9945) because this targets the redisenterprise extension, whose source lives in Azure/azure-cli-extensions.


Posted by agent-assist (autonomous bug-fix pipeline).

azclibot avatar Jun 17 '26 04:06 azclibot

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @abhijitch_microsoft, @yuvalm_microsoft, @nikitagarg_microsoft, @sanar_microsoft, @cawa_microsoft, @Azure/act-codegen-extensibility-squad.

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @abhijitch_microsoft, @yuvalm_microsoft, @nikitagarg_microsoft, @sanar_microsoft, @cawa_microsoft, @Azure/act-codegen-extensibility-squad.

X Engineering Agent Bug analysis: Root cause analysis

Below is my analysis of this issue:

Summary

Azure Managed Redis assignments with GUID-style names cannot be retrieved through az redisenterprise database access-policy-assignment show: the reported validation error rejects hyphens before the lookup. Current extension source still imposes that restriction. The sandbox used a full resource ID with a nonexistent parent and was inconclusive; the linked Azure/azure-cli-extensions#9946 remains open with no changed files, so there is no verified fix yet.

๐Ÿ”ฌ Likely root cause

The generated Show argument schema restricts --access-policy-assignment-name to alphanumeric characters, excluding hyphens in GUID-named assignments. Validation runs before the generated GET operation can resolve an assignment name and send its request.

Affected code
  • src/redisenterprise/azext_redisenterprise/aaz/latest/redisenterprise/database/access_policy_assignment/_show.py โ€บ Show._build_arguments_schema (line 48)
๐Ÿšซ Ruled out
  • Configuration: The documented command supplies the required resource group, cluster, database and assignment name; the reported exception arises during local argument formatting, before Azure resource lookup.
  • Environment: The traceback points to a generated argument formatter rather than a Windows-only command path; the failed sandbox run cannot establish the behavior on an existing cluster.
  • Intended behavior: Assignments created through the portal have GUID-style names per the related report; rejecting names that already exist prevents users from managing those assignments. Confirm the service naming contract before widening the schema.
๐Ÿ› ๏ธ Proposed change

Correct the AAZ source definition or apply a supported handwritten argument override for the assignment-name constraint after verifying the service contract, then regenerate the affected extension commands. Preserve alphanumeric names, accept valid GUID-style names for show and other relevant assignment operations, and do not hand-edit generated files.

๐Ÿงฌ Origin
  • Introduced by: Commit 1bf12cafa6 in Azure/azure-cli-extensions#8013 (2024-09-25) introduced the affected argument lines.
  • Original intent: The 2024-09-01 preview release generated Redis Enterprise assignment commands with name validation tied to the API model.
  • Does the fix keep that intent: Yes: retain normal alphanumeric assignment names and legitimate service validation while allowing GUID-named assignments exposed by the service.
โฑ๏ธ Why this surfaced now

The exact introduction of portal-generated GUID assignment names is unverified; their use exposes an older client-side restriction rather than a proven recent formatter change.

  • The argument lines still trace to 2024-09-25 commit 1bf12cafa6; no later change owns them.
  • The extension dependency timeline shows an API-version release in Azure/azure-cli-extensions#9332 (2025-10-28), but does not establish it as the cause. The 2026-09-15 retarget in #10246 occurred after the June report.

Earlier related reports

  • Azure/azure-cli#33444 (2026-05-26) reports the same GUID-name rejection for delete.
๐Ÿ’ฅ Blast radius
  • Other callers: The same name format appears independently in generated show, delete, create, update and wait commands for database access-policy assignments.
  • Visible change for them: Those assignment commands should accept valid GUID-style names while continuing to reject invalid names; list is not name-filtered.
  • Why not a narrower fix: Changing only show would leave portal-created GUID assignments inaccessible through delete and other assignment operations.
๐Ÿ”ฌ Technical details

Evidence

  • In the extension main branch, _show.py:48-55 applies ^[A-Za-z0-9]{1,60}$ to the required name, while _show.py:109-112 uses that name in the GET URL.
  • The issue reports InvalidArgumentValue from the AAZ formatter for a hyphenated assignment identifier; Azure/azure-cli#33444 reports the same restriction for portal-created GUID assignments on delete.
  • The sibling generated _delete.py, _create.py, _update.py and _wait.py also carry the restrictive pattern.

Test plan

Extend the existing Redis Enterprise ScenarioTest in src/redisenterprise/azext_redisenterprise/tests/latest/test_demo.py: create a real cluster and GUID-named assignment using a supported service path, invoke show and delete with the GUID name, assert the show output and deletion against Azure, and add a parser regression for an invalid name. Capture a live recording; the previous sandbox lacked an existing parent cluster and did not verify this path.

Generated code: Generated AAZ command code (fix the AAZ model and regenerate). _show.py:5 explicitly says it was generated by aaz-dev-tools; the same constraint is repeated across generated assignment commands.

Out of scope: Azure/azure-cli-extensions#9945 already tracks this report and has an open linked PR, Azure/azure-cli-extensions#9946, with no changed files. Maintainers should complete and verify that existing PR or close it before starting a competing fix.

๐Ÿ” Live reproduction (BAMI sandbox) โ€” Inconclusive

Verdict: Inconclusive: the sandbox could not run the reproduction to the end. Reason: a reproduction step failed before it could observe the reported behavior. The analysis above is based on reading the code only, so its confidence is capped at low.

Version Result Evidence
2.91.0 (latest), extension 1.4.0 Not reproduced ParentResourceNotFound, exit 3
dev Error CLI was not installed
Steps run (redacted)

2.91.0 (latest), extension 1.4.0

repro: az redisenterprise database access-policy-assignment show --resource-group <rg> --cluster-name <name1> --database-name default --access-policy-assignment-name /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Cache/redisEnterprise/<name1>/databases/default/accessPolicyAssignment...

Sandbox run

Commands ran in an isolated Azure sandbox subscription from a validated ReproSpec; output is redacted.

X Engineering Agent ยท Fixer ยท react ๐Ÿ‘ / ๐Ÿ‘Ž to train the agent

x-engineering-agent avatar Oct 25 '26 16:10 x-engineering-agent