Description
On a public Azure SQL endpoint, 0.0.0.0 through 255.255.255.255 permits every IPv4 source. Setting both ends to 0.0.0.0 instead enables the Azure-services exception, which includes other customers’ subscriptions.
Potential impact
Any source permitted by the firewall can attempt to sign in. Data access still requires valid credentials and permissions. If publicNetworkAccess is disabled, a firewall rule alone cannot open the public path.
Remediation
Remove the all-IPv4 rule. In Microsoft.Sql/servers/firewallRules, set startIpAddress and endIpAddress to individual IPv4 addresses in ascending order, using the public source Azure sees after NAT. Check all server and database rules. For private-only access, test the private endpoint before disabling public access. A VNet or jump host alone leaves the public setting unchanged.
Examples
Supply real administrator credentials securely. Check the preview API schema before deployment. In the first excerpt, location belongs on the server and is absent from the documented firewall-rule properties. The second excerpt assumes an existing sample server.
Entire IPv4 range
resource sqlServer1 'Microsoft.Sql/servers@2021-02-01-preview' = {
name: 'sqlServer1'
location: resourceGroup().location
properties: {
administratorLogin: 'adminUsername'
administratorLoginPassword: 'adminPassword'
}
}
resource sqlServer1AllowAll 'Microsoft.Sql/servers/firewallRules@2021-02-01-preview' = {
parent: sqlServer1
location: resourceGroup().location
name: 'AllowAll'
properties: {
endIpAddress: '255.255.255.255'
startIpAddress: '0.0.0.0'
}
}
Restricted address range
resource sampleFirewall 'Microsoft.Sql/servers/firewallRules@2021-02-01-preview' = {
name: 'sample/firewall'
properties: {
startIpAddress: '192.168.1.2'
endIpAddress: '192.168.1.254'
}
}
Explanation:
- First example:
AllowAllspans the entire IPv4 range. - Second example: The rule allows
192.168.1.2through192.168.1.254. Confirm the source addresses Azure sees. Entering private addresses does not set up a private administration path.