Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3.01k forks source link

az network application-gateway http listener --host-names #19701

Open dazinator opened 3 years ago

dazinator commented 3 years ago

I've run this command to create a new http listener, specifying the --host-names argument with a space seperated list of domain names.

This ran successfully.

However when viewing the resource in the Azure Portal, the host names appear all on a single line rather than on seperate lines, making me think it hasn't been configured correctly.

image

I am raising this here because I am not sure if the "space seperated" --host-names argument is documented incorrectly - causing this bug (i.e perhaps it should be comma seperated?) or if there is some other bug, or perhaps just an azure portal display issue.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

dazinator commented 3 years ago

Note: It appears the issue is the following:

If you pass --host-names "a.foo.com *.a.foo.com" - even though you are seperating the host names with a space, this will create a single host name line entry in the portal and I am assuming is incorrect.

You have to pass multiple argument values (by wrapping each one in quotes), one for each host name, like this --host-names "a.foo.com" "*.a.foo.com"

Then it will work. In other words, space seperate the individual host name arguments, not the host names within one argument!

I discovered this problem when doing something like this in powershell which lead to them all appearing on a single line in azure portal:

$hostNames = "a.foo.com *.a.foo.com" # space seperated host names as per the docs?
az network application-gateway http-listener create -g $resourceGroupName --gateway-name $gatewayName --frontend-port $frontEndHttpPortName -n $httpListenerName --frontend-ip $frontEndIpConfigurationName --host-names $hostNames

It's a bit confusing, in the one above, I am clearly seperating the host names with a space, yet this doesn't work. I think the docs are therefore not clear enough, perhaps an example is needed showing passing multiple host names ?

yonzhan commented 3 years ago

@kairu-ms for awareness