Manage Azure SQL Database
This tutorial guides you through the essential tasks for managing your Azure SQL Database, including creating, configuring, and monitoring.
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:
- Navigate to the Azure SQL Databases service.
- Click "+ Create".
- Select your subscription, resource group, and provide a database name.
- Configure server settings, performance tier, and backup options.
- 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:
- Go to your SQL Database resource.
- In the left navigation menu, under "Settings", select "Firewalls and virtual networks".
- Configure the "Allow Azure services and resources to access this server" option.
- Click "Add client IP" or manually enter IP address ranges.
- 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:
- CPU Percentage
- Data IO Percentage
- Log IO Percentage
- DTU Percentage (or vCore usage)
- Storage Used
Query Performance Insights
Identify and troubleshoot performance bottlenecks by analyzing top resource-consuming queries.
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.
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.