Other Articles

SQL Server – Block Public Firewall Rules

Secure Configuration Checks > Azure

This check ensures that no firewall rule on an Azure SQL server opens the server to the entire internet. A rule covering the full range 0.0.0.0 to 255.255.255.255 allows any IP address to attempt a connection.

Check Details

  • Resource: SQL Server
  • Check: Block Public SQL Server Firewall Rules
  • Risk: A firewall rule that allows all IP addresses exposes the SQL server to brute-force attacks and unauthorized access attempts from anywhere on the internet.

Remediation via Azure Portal

  1. Log in to the Azure Portal. Azure Portal dashboard
  2. Navigate to SQL servers and select the affected SQL server. SQL servers list
  3. In the left menu, click on Networking under Security. Networking in the SQL server menu
  4. On the Public access tab, look at the Firewall rules list and find any rule with a start IP of 0.0.0.0 and an end IP of 255.255.255.255. SQL server firewall rules list
  5. Delete the rule, or change its range to only the specific IP addresses or ranges that need access.
  6. Click Save to apply the changes.

Remediation via Azure CLI

  1. Open Azure Cloud Shell from the Azure Portal or use a local terminal with Azure CLI installed. Azure Cloud Shell
  2. Run the following command to list the firewall rules:
    az sql server firewall-rule list \
    --resource-group <resource-group-name> \
    --server <sql-server-name> \
    --output table
    
  3. Run the following command to delete the rule that allows all IP addresses:
    az sql server firewall-rule delete \
    --resource-group <resource-group-name> \
    --server <sql-server-name> \
    --name <firewall-rule-name>
    

    Replace <resource-group-name>, <sql-server-name> and <firewall-rule-name> with your actual values.

Updated on 03 November, 2026