title | description | services | ms.service | ms.subservice | ms.custom | ms.devlang | ms.topic | author | ms.author | ms.reviewer | manager | ms.date |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Azure portal: Create a SQL Database firwall rule| Microsoft Docs |
Create a SQL Database server-level firewall rule |
sql-database |
sql-database |
security |
quickstart |
sachinpMSFT |
sachinp |
vanto, carlrab |
craigg |
12/01/2018 |
This quickstart walks through how to create a server-level firewall rule for an Azure SQL database to enable you to connect to it from an on-premises resource.
This quickstart uses the resources created in Create an Azure SQL database in the Azure portal as its starting point.
Sign in to the Azure portal.
The SQL Database service creates a firewall at the server level. This firewall prevents applications and tools from connecting to the server or any server databases unless you create a firewall rule to open the firewall. For a connection from an IP address outside Azure, create a firewall rule for a specific IP address or range of addresses. For more information about firewall rules, see SQL Database server-level firewall rule.
Note
SQL Database communicates over port 1433. If you're trying to connect from within a corporate network, outbound traffic over port 1433 might not be allowed by your network's firewall. If so, you can't connect to your Azure SQL Database server unless your IT department opens port 1433.
Follow these steps to create a server-level firewall rule for your client's IP address and enable external connectivity through the SQL Database firewall for your IP address only.
-
After the prerequisite Azure SQL database deployment completes, select SQL databases from the left-hand menu and then choose mySampleDatabase on the SQL databases page. The overview page for your database opens, showing you the fully qualified server name (such as mynewserver-20170824.database.windows.net) and provides options for further configuration.
-
Copy this fully qualified server name to use when connecting to your server and its databases in other quickstarts.
-
Select Set server firewall on the toolbar. The Firewall settings page for the SQL Database server opens.
-
Choose Add client IP on the toolbar to add your current IP address to a new firewall rule. A firewall rule can open port 1433 for a single IP address or a range of IP addresses.
[!IMPORTANT] By default, access through the SQL Database firewall is enabled for all Azure services. Choose OFF on this page to disable for all Azure services.
-
Select Save. A server-level firewall rule is created for your current IP address opening port 1433 on the logical server.
-
Close the Firewall settings page.
Using SQL Server Management Studio or another tool of your choice, you can now connect to the SQL Database server and its databases from this IP address using the server admin account created previously.
Save these resources if you want to go to Next steps and learn how to connect and query your database using a number of different methods. If, however, you want to delete the resources that you created in this quickstart, use the following steps.
- From the left-hand menu in the Azure portal, select Resource groups and then select myResourceGroup.
- On your resource group page, select Delete, type myResourceGroup in the text box, and then select Delete.
- Now that you have a database, you can connect and query using one of your favorite tools or languages, including
- To learn how to design your first database, create tables, and insert data, see one of these tutorials: