Praveen
Praveen

Reputation: 261

Set Azure SQL Server Firewall Off using either ARM or powershell

I want to set set Azure SQL Server Firewall Off either using ARM or powershell.

One possible solution is setting the start and end IP to 255.255.255.255 in ARM. I also tried removing the block from ARM template file which is used to create the firewall rules. But, even that didn't help.

But, I want to know if there is any other way to do it?

Upvotes: 3

Views: 863

Answers (3)

Praveen
Praveen

Reputation: 261

It was just as simple as it could be. Not sure how i did not see it. Anyways, for those who stuck with the same thing. Here are the options to turn the Firewall Off.

  1. In ARM template you can put start and end IP as 255.255.255.255. This will set the firewall to off however it will leave a firewallrule line with name (that you provide in ARM). You can delete it using powershell command Remove-AzureSqlDatabaseServerFirewallRule.
  2. If you're giving start and end IP as 0.0.0.0, it will set the firewall to be on by default. Now use Powershell command Remove-AzureSqlDatabaseServerFirewallRule -ServerName "server" -RuleName "AllowAllWindowsAzureIps"

Upvotes: 1

Ivan Glasenberg
Ivan Glasenberg

Reputation: 29950

For powershell, details refer to here:

turn on:

New-AzureRmSqlServerFirewallRule -ResourceGroupName 'resourcegroup1' -ServerName 'Contoso' -FirewallRuleName "ContosoFirewallRule" -StartIpAddress '192.168.1.1' -EndIpAddress '192.168.1.10'   

turn off:

Remove-AzureRmSqlServerFirewallRule –FirewallRuleName 'ContosoFirewallRule' –ServerName 'Contoso' -ResourceGroupName 'xxx'

Upvotes: 0

4c74356b41
4c74356b41

Reputation: 72171

its not 255.255.255.255, its 0.0.0.0 :)

{
    "apiVersion": "2018-06-01-preview",
    "name": "AllowAllWindowsAzureIps",
    "type": "firewallRules",
    "location": "[variables('location')]",
    "properties": {
        "endIpAddress": "0.0.0.0",
        "startIpAddress": "0.0.0.0"
    }
}

Upvotes: 0

Related Questions