Home > PowerShell, SQL Azure > Updating SQL Azure Firewall Rules with Windows Azure PowerShell Cmdlets 2.0

Updating SQL Azure Firewall Rules with Windows Azure PowerShell Cmdlets 2.0

You’ve deployed a few Sql Azure servers and through no fault of your own the requirement comes up to update all of the firewall rules for each of the Sql Azure Servers.

No Problem!

Adding new SQL Azure Firewall Rules

Get-SqlAzureServer -Certificate $cert -SubscriptionId $subscriptionid | foreach {
  $_ | New-SqlAzureFirewallRule -RuleName "NewRule1" -StartIpAddress "0.0.0.0" -EndIpAddress "1.1.2.2"
  $_ | New-SqlAzureFirewallRule -RuleName "NewRule2" -StartIpAddress "100.1.0.0" -EndIpAddress "100.15.0.0"
}

Removing Rules is Just as Easy

Get-SqlAzureServer -Certificate $cert -SubscriptionId $subscriptionid | foreach {
  $_ | Remove-SqlAzureFirewallRule -RuleName "OldRule1"
  $_ | Remove-SqlAzureFirewallRule -RuleName "OldRule2"
}

This of course requires the Windows Azure PowerShell Cmdlets 2.0

  1. September 28, 2011 at 1:43 pm | #1

    Hi Michael,

    I wanted to share the Powershell script I have made (currently in it’s first iteration, with enhancements on the way).

    This uses a IP Resolution Service to grab the current external IP then iterates over the SQL Servers in a subscription.

    https://github.com/SyntaxC4/WindowsAzure-HandyScripts

    I’ll be adding more scripts to this project as I have the ability to make them.

    Great work on all the new features!

    Thanks,

    Cory

  2. September 28, 2011 at 1:56 pm | #2

    Nice work Cory!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.