Azure / azure-cli

Azure Command-Line Interface
MIT License
3.95k stars 2.93k forks source link

Impossible to update network application-gateway listener customErrorConfigurations #29351

Open danyric opened 1 month ago

danyric commented 1 month ago

Describe the bug

Hello While trying to set a customErrorConfigurations to network application-gateway listener. First run the command: az network application-gateway http-listener update -g $gr_ppd --gateway-name $appgw_ppd --name appGatewayHttpListener --set customErrorConfigurations=[]

{ "customErrorConfigurations": [], ................ "type": "Microsoft.Network/applicationGateways/httpListeners" }

An then try to run still have an error .

Related command

az network application-gateway http-listener update -g $gr_ppd --gateway-name $appgw_ppd --name appGatewayHttpListener --add customErrorConfigurations[0].customErrorPageUrl=https://xxxxxx.windows.net/error-502.html customErrorConfigurations[0].statusCode=HttpStatus502

Errors

Couldn't find 'customErrorPageUrl=https://xxxxx' in 'customErrorConfigurations[0].customErrorPageUrl=https://xxxxx.windows.net/error-502'. Available options: ['custom_error_page_url', 'status_code']

Issue script & Debug output

Couldn't find 'customErrorPageUrl=https://xxxxx' in 'customErrorConfigurations[0].customErrorPageUrl=https://xxxxx.windows.net/error-502'. Available options: ['custom_error_page_url', 'status_code']

Expected behavior

customErrorConfigurations set and visible when issuing az cli show command and when using the az portal

Environment Summary

azure-cli 2.62.0

core 2.62.0 telemetry 1.1.0

Extensions: bastion 1.0.1

Dependencies: msal 1.28.1 azure-mgmt-resource 23.1.1

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

Python (Windows) 3.11.8 (tags/v3.11.8:db85d51, Feb 6 2024, 22:03:32) [MSC v.1937 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

yonzhan commented 1 month ago

network

ReaNAiveD commented 1 month ago

@danyric Based on the error message, could you please try changing customErrorConfigurations[0].customErrorPageUrl to customErrorConfigurations[0].custom_error_page_url and changing customErrorConfigurations[0].statusCode to customErrorConfigurations[0].status_code?

danyric commented 2 weeks ago

Hi RealNAiveD Tried and still have error, anybody use this feature in azcli ? A working example will be really appreciated, cause either the doc is not precise enough, or the feature is buggy.

$ az network application-gateway http-listener update   -g $gr_prd   --gateway-name $appgw_prd   --name appGatewayHttpListener   --add custom_error_configurations.custom_error_page_url=https://xxxxxx.windows.net/error-502.html   custom_error_configurations.status_code=HttpStatus502
Couldn't find 'custom_error_page_url=https://xxxxxx' in 'custom_error_configurations.custom_error_page_url=https://xxxxxx.windows.net/error-502'. Available options: index into the collection 'custom_error_configurations.custom_error_page_url=https://xxxxxx.windows.net/error-502' with [<index>] or [<key=value>]
ReaNAiveD commented 2 weeks ago

Hi @danyric , Sorry for the misunderstanding in your question. The customErrorConfigurations is a list, so you should use the list generic update grammar instead of a dictionary. image

az network application-gateway http-listener update -g $gr_prd --gateway-name $appgw_prd --name appGatewayHttpListener --add customErrorConfigurations '{"customErrorPageUrl": "https://xxxxxx.windows.net/error-502.html", "statusCode": "HttpStatus502"}'