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

{Network} az network application-gateway private-link add: Improve error message for excessive name length #28299

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

koudaiii
Copy link
Member

@koudaiii koudaiii commented Feb 3, 2024

Related command

az network application-gateway private-link add

Description

This Pull Request addresses the issue of unhelpful error messages when a user inputs a name exceeding 37 characters in the az network application-gateway private-link add command. Currently, the error message for an excessively long name is generic and does not guide the user effectively. This PR aims to implement a more informative error message, clearly stating that the name exceeds the 37-character limit and advising the correct format.

38 characters name test

$ PRIVATELINK_NAME=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKL

$ az network application-gateway private-link add --frontend-ip <your_frontend_ip> --gateway-name <your_appgw_name> --name $PRIVATELINK_NAME --resource-group  <your_resource_group_name> --subnet <your_subnet_name>

This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
(ApplicationGatewayPrivateLinkProvisioningError) An error occurred while configuring private link on Application Gateway.
Code: ApplicationGatewayPrivateLinkProvisioningError
Message: An error occurred while configuring private link on Application Gateway.

$ az network application-gateway private-link list --gateway-name  <your_appgw_name> --resource-group <your_resource_group_name>

This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
Name                                           ProvisioningState    ResourceGroup
---------------------------------------------  -------------------  --------------------------
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKL  Failed               <your_appgw_name>

Testing Guide

  • 37 characters name test

Expected Result: Successful execution with the provisioning state set to Succeeded.

$  PRIVATELINK_NAME=abcdefghijklmnopqrstuvwxyzABCDEFGHIJK
$ env/bin/az network application-gateway private-link add --frontend-ip appGatewayFrontendIP --gateway-name  <your_gateway_name>--name $PRIVATELINK_NAME --resource-group <your_resource_group_name> --subnet <your_subnet_name>
/Users/sakabekodai/src/github.com/koudaiii/azure-cli/env/bin/az:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  __import__('pkg_resources').require('azure-cli==2.56.0')
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
Name                                   ProvisioningState    ResourceGroup
-------------------------------------  -------------------  --------------------------
abcdefghijklmnopqrstuvwxyzABCDEFGHIJK  Succeeded            <your_resourc_group_name>
  • 38 characters name test

Expected Result: Successful execution with the provisioning state set to Succeeded.

$ PRIVATELINK_NAME=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKL
$ env/bin/az network application-gateway private-link add --frontend-ip <your_frontend_ip> --gateway-name <your_gateway_name> --name $PRIVATELINK_NAME --resource-group  <your_resource_group_name> --subnet <your_subnet_name>

/Users/sakabekodai/src/github.com/koudaiii/azure-cli/env/bin/az:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  __import__('pkg_resources').require('azure-cli==2.56.0')
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
38
The command failed with an unexpected error. Here is the traceback:
Name exceeds the maximum character limit of 37.
Traceback (most recent call last):
  File "/Users/sakabekodai/src/github.com/koudaiii/azure-cli/env/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sakabekodai/src/github.com/koudaiii/azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py", line 664, in execute
    raise ex
  File "/Users/sakabekodai/src/github.com/koudaiii/azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py", line 729, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sakabekodai/src/github.com/koudaiii/azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py", line 709, in _run_job
    result = LongRunningOperation(cmd_copy.cli_ctx, 'Starting {}'.format(cmd_copy.name))(result)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sakabekodai/src/github.com/koudaiii/azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py", line 1033, in __call__
    result = poller.result()
             ^^^^^^^^^^^^^^^
  File "/Users/sakabekodai/src/github.com/koudaiii/azure-cli/src/azure-cli-core/azure/cli/core/aaz/_poller.py", line 108, in result
    self.wait(timeout)
  File "/Users/sakabekodai/src/github.com/koudaiii/azure-cli/env/lib/python3.11/site-packages/azure/core/tracing/decorator.py", line 76, in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sakabekodai/src/github.com/koudaiii/azure-cli/src/azure-cli-core/azure/cli/core/aaz/_poller.py", line 130, in wait
    raise self._exception
  File "/Users/sakabekodai/src/github.com/koudaiii/azure-cli/src/azure-cli-core/azure/cli/core/aaz/_poller.py", line 83, in _start
    for polling_method in self._polling_generator:
  File "/Users/sakabekodai/src/github.com/koudaiii/azure-cli/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/private_link/_add.py", line 126, in _execute_operations
    self.pre_operations()
  File "/Users/sakabekodai/src/github.com/koudaiii/azure-cli/src/azure-cli-core/azure/cli/core/aaz/_command.py", line 289, in wrapper
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sakabekodai/src/github.com/koudaiii/azure-cli/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/private_link/_add.py", line 139, in pre_operations
    raise ValueError("Name exceeds the maximum character limit of 37.")
ValueError: Name exceeds the maximum character limit of 37.
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


This checklist is used to make sure that common guidelines for a pull request are followed.

Copy link

azure-client-tools-bot-prd bot commented Feb 3, 2024

️✔️AzureCLI-FullTest
️✔️acr
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️acs
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.11
️✔️3.9
️✔️ams
️✔️latest
️✔️3.11
️✔️3.9
️✔️apim
️✔️latest
️✔️3.11
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.11
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.11
️✔️3.9
️✔️aro
️✔️latest
️✔️3.11
️✔️3.9
️✔️backup
️✔️latest
️✔️3.11
️✔️3.9
️✔️batch
️✔️latest
️✔️3.11
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.11
️✔️3.9
️✔️billing
️✔️latest
️✔️3.11
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.11
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.11
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.11
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.11
️✔️3.9
️✔️config
️✔️latest
️✔️3.11
️✔️3.9
️✔️configure
️✔️latest
️✔️3.11
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.11
️✔️3.9
️✔️container
️✔️latest
️✔️3.11
️✔️3.9
️✔️containerapp
️✔️latest
️✔️3.11
️✔️3.9
️✔️core
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.11
️✔️3.9
️✔️databoxedge
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️dla
️✔️latest
️✔️3.11
️✔️3.9
️✔️dls
️✔️latest
️✔️3.11
️✔️3.9
️✔️dms
️✔️latest
️✔️3.11
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.11
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.11
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.11
️✔️3.9
️✔️find
️✔️latest
️✔️3.11
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.11
️✔️3.9
️✔️identity
️✔️latest
️✔️3.11
️✔️3.9
️✔️iot
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️keyvault
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️kusto
️✔️latest
️✔️3.11
️✔️3.9
️✔️lab
️✔️latest
️✔️3.11
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.11
️✔️3.9
️✔️maps
️✔️latest
️✔️3.11
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.11
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.11
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.11
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.11
️✔️3.9
️✔️network
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.11
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.11
️✔️3.9
️✔️profile
️✔️latest
️✔️3.11
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.11
️✔️3.9
️✔️redis
️✔️latest
️✔️3.11
️✔️3.9
️✔️relay
️✔️latest
️✔️3.11
️✔️3.9
️✔️resource
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️role
️✔️latest
️✔️3.11
️✔️3.9
️✔️search
️✔️latest
️✔️3.11
️✔️3.9
️✔️security
️✔️latest
️✔️3.11
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.11
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.11
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.11
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.11
️✔️3.9
️✔️sql
️✔️latest
️✔️3.11
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.11
️✔️3.9
️✔️storage
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.11
️✔️3.9
️✔️telemetry
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️util
️✔️latest
️✔️3.11
️✔️3.9
️✔️vm
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9

Copy link

azure-client-tools-bot-prd bot commented Feb 3, 2024

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan
Copy link
Collaborator

yonzhan commented Feb 3, 2024

network

@microsoft-github-policy-service microsoft-github-policy-service bot added the Auto-Assign Auto assign by bot label Feb 3, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Network az network vnet/lb/nic/dns/etc... label Feb 3, 2024
@necusjz necusjz changed the title [network] az network application-gateway private-link add - Improve error message for excessive name length {Network} az network application-gateway private-link add: Improve error message for excessive name length Feb 6, 2024
@necusjz necusjz merged commit f041885 into Azure:dev Feb 6, 2024
57 checks passed
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 Network az network vnet/lb/nic/dns/etc...
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants