question

CoreyRastetter-4538 avatar image
0 Votes"
CoreyRastetter-4538 asked Grmacjon-MSFT commented

What format does --ip-address use in az webapp config access-restriction add?

When passing in a comma separated list of ranges, I'm continually met with Invalid IP address, regardless of format. Because I have to add one CIDR range at a time, the result is adding a handful of rules rather than a single rule with multiple ranges.

From the docs for az webapp config access-restriction add

--ip-address
IP address or CIDR range (optional comma separated list of up to 8 ranges).

My attempts:
--ip-address 52.151.220.252/32,52.151.221.14/32
--ip-address "52.151.220.252/32","52.151.221.14/32"
--ip-address "52.151.220.252/32,52.151.221.14/32"

azure-webapps
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Grmacjon-MSFT avatar image
0 Votes"
Grmacjon-MSFT answered Grmacjon-MSFT commented

Hi @CoreyRastetter-4538

We apologize for any inconvenience this issue may have caused. Does the command work with one IP address?

The last format you used is correct:

 --ip-address "52.151.220.252/32,52.151.221.14/32"

When working with service tags, http headers or multi-source rules in Azure CLI requires at least version 2.23.0. Please makes sure you're using the latest version. You can verify the version of your installed module with: az version

You can also try using this PowerShell command:


 Add-AzWebAppAccessRestrictionRule -ResourceGroupName "ResourceGroup" -WebAppName "AppName" `
   -Name "Multi-source rule" -IpAddress "192.168.1.0/24,192.168.10.0/24,192.168.100.0/24" `
   -Priority 100 -Action Allow

Hope that helps.

Thanks,
Grace


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks so much for the help, @Grmacjon-MSFT! Sure enough, I'm on a laptop I haven't opened since February, and found Azure CLI 2.18.0. Updated to 2.23.0, ran the command with the format suggested, and my rule added beautifully!

Thanks again, Grace!

//corey

0 Votes 0 ·

Hi Corey,

Thanks for the update. Happy to hear your issue was resolved :)

-Grace

0 Votes 0 ·