Azure / Azure/azure-cli

Listing subscription aliases does not support pagination

Open
#28,174 3 comments 0 reactions 3 assignees Claimed by @notyashhh View on GitHub
act-identity-squad ARM Auto-Assign customer-reported question Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

The `az account alias list` command returns at most 50 aliases. If you have more than 50 aliases you get a `nextLink` in the response. However, the command does not support the `--next-token` flag as other paginated commands do. So there is no way easy way to list the next page of subscription aliases (I know I can use `az rest ...` to do it).

### Related command

`az account alias list`

### Errors

`unrecognized arguments: --next-token`

### Issue script & Debug output

az account alias list --next-token abc --debug

cli.knack.cli: Command arguments: ['account', 'alias', 'list', '--next-token', 'abc', '--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 'account': ['azure.cli.command_modules.profile', 'azure.cli.command_modules.resource', 'azext_account']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: profile 0.001 2 8
cli.azure.cli.core: resource 0.040 51 228
cli.azure.cli.core: Total (2) 0.041 53 236
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: account 0.001 4 13 /Users/mattias/.azure/cliextensions/account
cli.azure.cli.core: Total (1) 0.001 4 13
cli.azure.cli.core: Loaded 55 groups, 249 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : account alias list
cli.azure.cli.core: Command table: account alias list
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate []
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/Users/mattias/.azure/commands/2024-01-11.19-33-59.account_alias_list.59983.log'.
az_command_data_logger: command args: account alias list --next-token {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [.add_subscription_parameter at 0x1028a6c00>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [.add_ids_arguments at 0x1028a6ca0>, .add_cache_arguments at 0x1028a6de0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.azure.cli.core.command_recommender: "--next-token" is an invalid parameter for command "account alias list".
urllib3.connectionpool: Starting new HTTPS connection (1): app.aladdin.microsoft.com:443
cli.azure.cli.core.command_recommender: "--next-token" is an invalid parameter for command "account alias list".
cli.azure.cli.core.azclierror: NoneType: None

cli.azure.cli.core.azclierror: unrecognized arguments: --next-token abc
az_command_data_logger: unrecognized arguments: --next-token abc

Examples from AI knowledge base:
https://aka.ms/cli_ref
Read more about the command in reference docs
cli.knack.cli: Event: Cli.PostExecute []
az_command_data_logger: exit code: 2
cli.__main__: Command ran in 0.430 seconds (init: 0.048, invoke: 0.382)
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 3603 in cache
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/bin/python /opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/cli/telemetry/__init__.py /Users/mattias/.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

### Expected behavior

If I am returned a next token in a command I expect to be able to use it to re-run the command and get the next batch of results.

### Environment Summary

azure-cli 2.56.0

core 2.56.0
telemetry 1.1.0

Extensions:
account 0.2.5
aks-preview 0.5.174
azure-devops 0.26.0
fzf 1.0.2

Dependencies:
msal 1.24.0b2
azure-mgmt-resource 23.1.0b2

Python location '/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/bin/python'
Extensions directory '/Users/mattias/.azure/cliextensions'

Python (Darwin) 3.11.7 (main, Dec 4 2023, 18:10:11) [Clang 15.0.0 (clang-1500.1.0.2.5)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.