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

--ip-tags not parsing per docs for az network public-ip update #26730

Closed
csm10495 opened this issue Jun 22, 2023 · 1 comment · Fixed by #27187
Closed

--ip-tags not parsing per docs for az network public-ip update #26730

csm10495 opened this issue Jun 22, 2023 · 1 comment · Fixed by #27187
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. Network az network vnet/lb/nic/dns/etc...
Milestone

Comments

@csm10495
Copy link

csm10495 commented Jun 22, 2023

Describe the bug

On https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/configure-routing-preference-virtual-machine-cli there is an example like so:

az network public-ip create \
    --resource-group TutorVMRoutePref-rg \
    --name myPublicIP \
    --version IPv4 \
    --ip-tags 'RoutingPreference=Internet' \
    --sku Standard \
    --zone 1 2 3

I modified this example to set RoutingPreference=Internet on an existing public ip:

az network public-ip update --ip-tags "RoutingPreference=Internet" --ids /subscriptions/<redacted>/Microsoft.Network/publicIPAddresses/testat1-ip

That fails with:

Failed to parse '--ip-tags' argument: dict type value expected, got 'Internet'(<class 'str'>)

According to az network public-ip update --help

..
    --ip-tags                                : Space-separated list of IP tags in 'TYPE=VAL' format.
                                               Support shorthand-syntax, json-file and yaml-file.
                                               Try `??` to show more.
..

I thought "RoutingPreference=Internet" would be TYPE=VAL format.

Related command

az network public-ip update

Errors

Failed to parse '--ip-tags' argument: dict type value expected, got 'Internet'(<class 'str'>)

Issue script & Debug output

C:\Windows\System32>az network public-ip update --ip-tags "RoutingPreference=Internet" --ids /subscriptions/<redacted>/Microsoft.Network/publicIPAddresses/testat1-ip --debug
cli.knack.cli: Command arguments: ['network', 'public-ip', 'update', '--ip-tags', 'RoutingPreference=Internet', '--ids', '/subscriptions/<redacted>/Microsoft.Network/publicIPAddresses/testat1-ip', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
Enable VT mode.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x0234B4A8>, <function OutputProducer.on_global_arguments at 0x02518C40>, <function CLIQuery.on_global_arguments at 0x02538898>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'network': ['azure.cli.command_modules.network', 'azure.cli.command_modules.privatedns']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: network                   0.402       112       443
cli.azure.cli.core: privatedns                0.004        14        66
cli.azure.cli.core: Total (2)                 0.406       126       509
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: Total (0)                 0.000         0         0
cli.azure.cli.core: Loaded 125 groups, 509 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : network public-ip update
cli.azure.cli.core: Command table: network public-ip update
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x047CB388>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\csm10495\.azure\commands\2023-06-21.22-53-04.network_public-ip_update.28088.log'.
az_command_data_logger: command args: network public-ip update --ip-tags {} --ids {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x047F34A8>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x04802418>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x04802610>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
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/_arg_action.py", line 394, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_action.py", line 435, in setup_operations
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_action.py", line 420, in setup_operations
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_action.py", line 296, in format_data
azure.cli.core.aaz.exceptions.AAZInvalidValueError: dict type value expected, got 'Internet'(<class 'str'>)

The above exception was the direct cause of the following exception:

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 588, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/parser.py", line 261, in parse_args
  File "argparse.py", line 1826, in parse_args
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/parser.py", line 281, in parse_known_args
  File "argparse.py", line 1859, in parse_known_args
  File "argparse.py", line 2054, in _parse_known_args
  File "argparse.py", line 2031, in consume_positionals
  File "argparse.py", line 1936, in take_action
  File "argparse.py", line 1214, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/parser.py", line 281, in parse_known_args
  File "argparse.py", line 1859, in parse_known_args
  File "argparse.py", line 2054, in _parse_known_args
  File "argparse.py", line 2031, in consume_positionals
  File "argparse.py", line 1936, in take_action
  File "argparse.py", line 1214, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/parser.py", line 281, in parse_known_args
  File "argparse.py", line 1859, in parse_known_args
  File "argparse.py", line 2054, in _parse_known_args
  File "argparse.py", line 2031, in consume_positionals
  File "argparse.py", line 1936, in take_action
  File "argparse.py", line 1214, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/parser.py", line 281, in parse_known_args
  File "argparse.py", line 1859, in parse_known_args
  File "argparse.py", line 2072, in _parse_known_args
  File "argparse.py", line 2012, in consume_optional
  File "argparse.py", line 1936, in take_action
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_action.py", line 396, in __call__
azure.cli.core.azclierror.InvalidArgumentValueError: Failed to parse '--ip-tags' argument: dict type value expected, got 'Internet'(<class 'str'>)

cli.azure.cli.core.azclierror: Failed to parse '--ip-tags' argument: dict type value expected, got 'Internet'(<class 'str'>)
az_command_data_logger: Failed to parse '--ip-tags' argument: dict type value expected, got 'Internet'(<class 'str'>)
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x047CB4A8>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 0.799 seconds (init: 0.334, invoke: 0.466)
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 3482 in cache
telemetry.check: Negative: The C:\Users\csm10495\.azure\telemetry.txt was modified at 2023-06-21 22:43:37.884169, which in less than 600.000000 s

Expected behavior

The command would have updated the ip address to use internet routing as talked about here: https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/routing-preference-overview

Environment Summary

az --version
azure-cli                         2.49.0

core                              2.49.0
telemetry                          1.0.8

Extensions:
resource-graph                     1.1.0

Dependencies:
msal                              1.20.0
azure-mgmt-resource               22.0.0

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\csm10495\.azure\cliextensions'

Python (Windows) 3.10.10 (tags/v3.10.10:aad5f6a, Feb  7 2023, 17:05:00) [MSC v.1929 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Additional context

No response

@csm10495 csm10495 added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Jun 22, 2023
@ghost ghost added customer-reported Issues that are reported by GitHub users external to the Azure organization. Network az network vnet/lb/nic/dns/etc... labels Jun 22, 2023
@ghost ghost added this to the Backlog milestone Jun 22, 2023
@ghost ghost assigned necusjz Jun 22, 2023
@ghost ghost added the Auto-Assign Auto assign by bot label Jun 22, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Jun 22, 2023

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

@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 Jun 22, 2023
@yonzhan yonzhan removed the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Jun 22, 2023
necusjz added a commit that referenced this issue Aug 23, 2023
…ot be correctly parsed (#27187)

* fix ip-tags

* revert help message

* support nullable

* add test case
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. Network az network vnet/lb/nic/dns/etc...
Projects
None yet
3 participants