Microsoft Azure

Official Documentation

Manage Azure SQL Database

This tutorial guides you through the essential tasks for managing your Azure SQL Database, including creating, configuring, and monitoring.

Prerequisites: An active Azure subscription.

1. Create an Azure SQL Database

Learn how to create a new Azure SQL Database instance using the Azure portal or Azure CLI.

Using Azure Portal:

  1. Navigate to the Azure SQL Databases service.
  2. Click "+ Create".
  3. Select your subscription, resource group, and provide a database name.
  4. Configure server settings, performance tier, and backup options.
  5. Review and create the database.

Using Azure CLI:

az sql db create --resource-group myResourceGroup --server myserver --name mySampleDatabase --performance-level S0

2. Configure Firewall Rules

Secure your database by setting up firewall rules to control access.

Allow Azure Services Access

Enable this option to allow other Azure services within Azure to connect to your SQL Database firewall.

Add Client IP Address

Add your current IP address or a specific range to grant access from your machine or network.

Using Azure Portal:

  1. Go to your SQL Database resource.
  2. In the left navigation menu, under "Settings", select "Firewalls and virtual networks".
  3. Configure the "Allow Azure services and resources to access this server" option.
  4. Click "Add client IP" or manually enter IP address ranges.
  5. Click "Save".

3. Monitor Performance and Usage

Keep track of your database's performance, resource utilization, and costs.

Performance Metrics

Azure provides several metrics to monitor, including:

Query Performance Insights

Identify and troubleshoot performance bottlenecks by analyzing top resource-consuming queries.

Consider setting up alerts for critical performance thresholds to proactively manage your database.

4. Manage Security

Implement robust security measures for your Azure SQL Database.

Authentication

Azure SQL Database supports SQL authentication and Azure Active Directory (Azure AD) authentication. It's recommended to use Azure AD for enhanced security and centralized management.

Authorization

Use roles and permissions to control access to database objects and data.

Threat Detection

Enable Azure Defender for SQL to detect anomalous database activities, potential SQL injection attacks, and other threats.

Use the Azure CLI to automate security configurations: az sql server firewall-rule create ...

5. Backup and Restore

Azure SQL Database automatically backs up your data. Learn how to leverage these backups for point-in-time restore.

Point-in-Time Restore

Restore your database to a specific point in time within your retention period.

Long-Term Retention

Configure long-term retention policies for compliance or archival purposes.

Conclusion

You have now learned the fundamental steps to manage your Azure SQL Database. Continue exploring Azure's extensive capabilities to optimize your database solutions.