How can we add multiple IP addresses to the firewall rules on Azure SQL Server?

Nikhil 41 Reputation points
2023-03-22T18:50:16.22+00:00

How can we add multiple IP addresses or IP address in CIDR to the firewall rules on Azure SQL Server?

User's image

Azure SQL Database
0 comments No comments
{count} votes

Accepted answer
  1. GeethaThatipatri-MSFT 27,102 Reputation points Microsoft Employee
    2023-03-22T19:21:38.75+00:00

    @Nikhil Thanks for posting your question in the Microsoft Q&A forum.

    To add a firewall rule for an IP address range in CIDR notation, you can use the New-AzSqlServerFirewallRule cmdlet with the -StartIpAddress and -EndIpAddress parameters set to the same IP address in the range. Here is an example command that adds a firewall rule for an IP address range:

    New-AzSqlServerFirewallRule -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -FirewallRuleName "Rule01" -StartIpAddress "192.168.0.198" -EndIpAddress "192.168.0.199"

    ResourceGroupName : ResourceGroup01

    ServerName : Server01

    StartIpAddress : 192.168.0.198

    EndIpAddress : 192.168.0.199

    FirewallRuleName : Rule01

    This command adds a firewall rule for the IP address range You can modify the IP address range as needed to match your requirements.

    Regards

    Geetha

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. TP 75,541 Reputation points
    2023-03-22T19:17:02.7033333+00:00

    Hi,

    You can convert CIDR to desired start IP and End IP and create rule(s) as needed. For example, say you wanted to allow 52.253.200.0/24, you could enter 52.253.200.1 for Start IP and 52.253.200.254 for End IP.

    There are many free online subnet calculation tools if you don't want to do it manually.

    If above was helpful please click Accept Answer. If you need more assistance please add comment.

    Thanks.

    -TP

    0 comments No comments