Az.SqlDatabaseFirewallRule
The Az.SqlDatabaseFirewallRule cmdlet family provides commands for managing firewall rules on Azure SQL databases.
Syntax
Get-AzSqlDatabaseFirewallRule
   [-ResourceGroupName] <String>
   [-ServerName] <String>
   [-DatabaseName] <String>
   [-FirewallRuleName] <String>
   [-Expand <String[]>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
New-AzSqlDatabaseFirewallRule
   -ResourceGroupName <String>
   -ServerName <String>
   -DatabaseName <String>
   -FirewallRuleName <String>
   -StartIpAddress <String>
   -EndIpAddress <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf] [-Confirm]
Remove-AzSqlDatabaseFirewallRule
   -ResourceGroupName <String>
   -ServerName <String>
   -DatabaseName <String>
   -FirewallRuleName <String>
   [-Force] [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf] [-Confirm]Parameters
| Parameter | Type | Description | 
|---|---|---|
| -ResourceGroupName | String | Name of the resource group that contains the SQL server. | 
| -ServerName | String | Name of the Azure SQL server. | 
| -DatabaseName | String | Name of the Azure SQL database. | 
| -FirewallRuleName | String | Name of the firewall rule to manage. | 
| -StartIpAddress | String | Starting IP address of the rule range (e.g., 0.0.0.0). | 
| -EndIpAddress | String | Ending IP address of the rule range (e.g., 255.255.255.255). | 
| -Force | SwitchParameter | Suppresses confirmation prompts. | 
| -WhatIf | SwitchParameter | Shows what would happen if the command runs. | 
| -Confirm | SwitchParameter | Prompts for confirmation before executing. | 
Examples
# Get all firewall rules for a database
Get-AzSqlDatabaseFirewallRule `
  -ResourceGroupName "MyResourceGroup" `
  -ServerName "my-sql-server" `
  -DatabaseName "mydb"# Create a new firewall rule allowing IP range 203.0.113.0 - 203.0.113.255
New-AzSqlDatabaseFirewallRule `
  -ResourceGroupName "MyResourceGroup" `
  -ServerName "my-sql-server" `
  -DatabaseName "mydb" `
  -FirewallRuleName "AllowAppSubnet" `
  -StartIpAddress "203.0.113.0" `
  -EndIpAddress "203.0.113.255"# Remove an existing firewall rule
Remove-AzSqlDatabaseFirewallRule `
  -ResourceGroupName "MyResourceGroup" `
  -ServerName "my-sql-server" `
  -DatabaseName "mydb" `
  -FirewallRuleName "AllowAppSubnet" -Force