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
Categories: PowerShell, SQL Azure
PowerShell, SQL Azure, Windows Azure PowerShell CmdLets
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
Nice work Cory!