Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Azure MSSQL – Server Firewall Rules

Posted on July 14, 2017 By David Kittell

Run these commands on the master table.

First get the existing rules

SELECT * FROM sys.firewall_rules ORDER BY name;

Based on the above query if there are any rules you need to remove get the name and replace Client with the appropriate name

EXECUTE sp_delete_firewall_rule @name = N'Client'
-- https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-delete-firewall-rule-azure-sql-database

If you need to add an IP rule go to https://www.kittell.net/ip.php and update the script below with what is shown on the screen.

-- Create server-level firewall setting for only IP 0.0.0.2  
exec sp_set_firewall_rule N'Example setting 1','0.0.0.2','0.0.0.2';  

-- Update server-level firewall setting to also allow IP 0.0.0.3  
exec sp_set_firewall_rule N'Example setting 1','0.0.0.2','0.0.0.3'; 

Of course if you simply need to allow all Azure (be careful with this one)

-- Enable Windows Azure connections.  
exec sp_set_firewall_rule N'Allow Windows Azure','0.0.0.0','0.0.0.0';
-- https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-set-firewall-rule-azure-sql-database
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Azure Code MSSQL MSSQL - Audit SQL

Post navigation

Previous post
Next post

Related Posts

Delete Ektron User

Posted on July 29, 2013October 26, 2015

In order to force a deletion from the Ektron user list you must follow the below path. DISCLAIMER: This will remove all content that was ever created/touched by the user. –Permissions Table DELETE permissions_tbl FROM permissions_tbl INNER JOIN users ON permissions_tbl.user_id = users.user_id WHERE users.user_name = ‘dkittell’ –Group Table DELETE…

Read More

Show Duplicate Records

Posted on February 28, 2013October 26, 2015

These two queries run under different schools of thought and purpose but will help in finding duplicate records. First, if you only want to see the records that are duplicates and the amount of times they appear in the table you could run this code: SELECT memberid ,COUNT(*) AS No_Of_Occurrences…

Read More

File Open

Posted on March 11, 2013October 26, 2015

OpenFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal) ‘OpenFileDialog1.InitialDirectory = "C:Program Files" OpenFileDialog1.Filter = "Text Files (*.txt)|*.txt|All Files(*.*)|*.*" OpenFileDialog1.FileName = "" OpenFileDialog1.FilterIndex = 1 ‘Check to see if the user clicked the open button If (OpenFileDialog1.ShowDialog() = DialogResult.OK) Then TextBox1.Text = OpenFileDialog1.FileName Try Using sr As New StreamReader(TextBox1.Text) Dim line As String line = sr.ReadToEnd()…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes