Windows Azure SQL Database : How to manage your firewall rules using PowerShell

 

Generally, developers like to use their own applications to create automated or scheduled tasks and system admins like scripts. PowerShell offers a very good scripting and development experience and is really cool for everyone.

It is really easy to use PowerShell to manage your Windows Azure Subscription. For a general how-to article please read my previous post Manage your Windows Azure with PowerShell.

 

Using PowerShell you can create, update, list and delete Windows Azure SQL Database Server-Level Firewall rules. Command base is AzureSQLDatabaseServerFirewallRule.

 # List existing Server-Level Firewall Rules
 Get-AzureSqlDatabaseServerFirewallRule 
    [-ServerName] <String> 
    [-RuleName <String> ] 
    [ <CommonParameters>]
 # Create a new Server-Level Firewall Rule
 New-AzureSqlDatabaseServerFirewallRule 
    [-ServerName] <String> 
    -StartIpAddress <String> 
    -EndIpAddress <String> 
    -RuleName <String> 
    [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]
 # Delete existing Server-Level Firewall Rule
 Remove-AzureSqlDatabaseServerFirewallRule 
    [-ServerName] <String> 
    -RuleName <String> 
    [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]
 # Update existing Server-Level Firewall Rule
 Set-AzureSqlDatabaseServerFirewallRule 
    [-ServerName] <String> 
    -RuleName <String> 
    -StartIpAddress <String> 
    -EndIpAddress <String> 
    [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]

 

 

I strongly suggest to use Windows PowerShell ISE, it’s really helpful executing or creating PowerShell scripts.

You can reach to the full reference of commands at Windows Azure SQL Database Cmdlets.

For a general overview of securing your Windows Azure SQL Database please check my previous article : Secure Your Windows Azure SQL Database.

Start using your free Windows Azure trial Windows Azure Free Trial