Introduction
Azure SQL Database is a fully managed Platform as a Service (PaaS) database engine that handles most database management functions such as upgrading, patching, backups, and provides high availability without administrator involvement. This tutorial will guide you through the process of setting up a new Azure SQL Database from scratch using the Azure portal.
Prerequisites
Before you begin, ensure you have the following:
- An active Azure subscription. If you don't have one, you can create a free account.
- Access to the Azure portal.
Step 1: Navigate to Azure SQL Databases
Open your web browser and navigate to portal.azure.com. Sign in with your Azure account credentials.
In the Azure portal search bar at the top, type "SQL databases" and select "SQL databases" from the results under the Services section.
On the SQL databases page, click the "+ Create" or "+ Add" button.
Step 2: Configure Basic Settings
You'll need to create or select an existing SQL server. If you don't have one, click "Create new" next to the Server dropdown.
- Server name: Enter a globally unique name for your SQL server.
- Location: Choose the Azure region closest to your users or applications.
- Administrator login: Create a username for the server administrator.
- Password: Set a strong password for the administrator login.
Click "OK" to create the server.
- Database name: Enter a name for your database (e.g.,
MyAwesomeDatabase). - Resource group: Select an existing resource group or create a new one to organize your Azure resources.
Step 3: Configure Compute and Storage
This section determines the performance and cost of your database. For testing and development, the "Serverless" tier is often a cost-effective choice.
Click on "Configure database" in the Compute + storage section.
- Service Tier: Select a tier like "General Purpose", "Business Critical", or "Hyperscale". For a first-time setup, "General Purpose" with a serverless option might be suitable.
- Hardware configuration: Choose the vCore or DTU model based on your needs.
- Max data size: Set the maximum storage size for your database.
Review the estimated cost and click "Apply".
Step 4: Network and Security Settings
Under the "Security" tab, you can configure:
- Microsoft Defender for SQL: Recommended for enhanced security.
- Allow Azure services and resources to access this server: Enable this if you plan to connect from other Azure services.
- Firewall rules: Define rules to control access to your server. You can add your current client IP address for immediate access.
Choose your desired connectivity method. For most scenarios, "Default" or "Public endpoint" is used.
Step 5: Additional Settings (Optional)
Explore other tabs like "Additional settings" for advanced configurations like data encryption, collation, and backup storage redundancy.
Step 6: Review and Create
On the "Review + create" tab, Azure will validate your configuration. If validation passes, you will see a summary of your settings. Click "Create" to deploy your Azure SQL Database.
Step 7: Deployment and Access
The deployment process may take a few minutes. You can monitor the progress in the Azure portal.
Once deployed, navigate to your SQL database resource. You will find the server name, database name, and connection strings. You can use these connection strings with tools like SQL Server Management Studio (SSMS) or Azure Data Studio to connect and manage your database.
Server Name: your-server-name.database.windows.net
Database Name: MyAwesomeDatabase
Admin Login: your-admin-username
Conclusion
Congratulations! You have successfully set up your Azure SQL Database. You can now start creating tables, inserting data, and building your applications on this robust and scalable cloud database.