Azure Database Administration Overview¶
Overview¶
Azure Database Administration covers planning, implementing, and managing SQL Server and Azure SQL database solutions. Focus areas include deployment, security, performance, high availability, disaster recovery, and automation.
Azure SQL Deployment Options¶
Azure SQL Database¶
- Fully managed PaaS
- Best for: Cloud-native applications
- Features: Auto-patching, backups, high availability
- Scaling: Vertical (compute/storage) and horizontal (sharding)
- Limitations: Some SQL Server features unavailable
Azure SQL Managed Instance¶
- Near 100% SQL Server compatibility
- Best for: Lift-and-shift migrations
- Features: Instance-level features, cross-database queries, SQL Agent
- VNet integration: Native virtual network support
SQL Server on Azure VMs¶
- Full control: IaaS solution
- Best for: Specific SQL Server versions, OS access needed
- You manage: OS, SQL Server, patches, backups
Security Implementation¶
Authentication Methods¶
- SQL Authentication: Username/password
- Azure AD Authentication: Recommended, supports MFA
- Windows Authentication: SQL VM only
Authorization¶
- Server-level roles: sysadmin, securityadmin
- Database-level roles: db_owner, db_datareader, db_datawriter
- Row-Level Security (RLS): Filter rows by user
- Dynamic Data Masking: Obfuscate sensitive data
Encryption¶
- TDE (Transparent Data Encryption): Encrypt at rest
- Always Encrypted: Column-level encryption
- SSL/TLS: Encryption in transit
Network Security¶
- Firewall rules: IP-based access control
- Virtual Network rules: VNet access
- Private endpoints: Private IP access
Performance Tuning¶
Query Performance¶
- Query Store: Track query performance over time
- Execution plans: Analyze query execution
- Indexes: Proper indexing strategy
- Statistics: Keep statistics updated
Monitoring¶
- Dynamic Management Views (DMVs): Real-time insights
- Extended Events: Lightweight tracing
- Azure Monitor: Metrics and alerts
- Query Performance Insight: Azure portal tool
Automatic Tuning¶
- Create index: Automatically create missing indexes
- Drop index: Remove unused indexes
- Force plan: Force good execution plans
High Availability and Disaster Recovery¶
High Availability Options¶
- Built-in HA (SQL Database): 99.99% SLA
- Business Critical tier: Zone-redundant, read replicas
- Always On Availability Groups (SQL VM): Multi-replica HA
Backup and Recovery¶
- Automated backups: Full, differential, transaction log
- Retention: 7-35 days (SQL Database)
- Long-term retention: Up to 10 years
- Point-in-time restore: Recover to specific moment
- Geo-restore: Restore from geo-redundant backup
Geo-Replication¶
- Active geo-replication: Up to 4 readable secondaries
- Auto-failover groups: Automatic failover with transparent connection string
Automation¶
PowerShell¶
# Create SQL Database
New-AzSqlDatabase -ResourceGroupName "myResourceGroup" `
-ServerName "myserver" `
-DatabaseName "mydatabase" `
-Edition "Standard" `
-RequestedServiceObjectiveName "S1"
Azure CLI¶
# Create SQL Database
az sql db create \
--resource-group myResourceGroup \
--server myserver \
--name mydatabase \
--service-objective S1
T-SQL Automation¶
-- Create SQL Agent job (Managed Instance/SQL VM)
EXEC msdb.dbo.sp_add_job @job_name = 'DailyBackup'
-- Index maintenance
CREATE INDEX idx_name ON table_name(column_name) WITH (ONLINE = ON)
Best Practices¶
Deployment¶
- Choose right option: PaaS vs IaaS based on requirements
- Use resource groups: Organize related resources
- Tag resources: For cost tracking and management
- Plan capacity: Right-size compute and storage
- Test in dev/test environments: Before production
Security¶
- Use Azure AD authentication
- Implement least privilege access
- Enable TDE for all databases
- Use private endpoints for isolation
- Regular security audits
Performance¶
- Monitor query performance regularly
- Implement proper indexing strategy
- Update statistics regularly
- Enable automatic tuning where appropriate
- Use appropriate service tier for workload
HADR¶
- Regular backup testing
- Document recovery procedures
- Implement geo-replication for critical databases
- Monitor replication lag
- Practice failover procedures
Study Tips¶
Key Concepts¶
- Deployment options and when to use each
- Authentication and authorization methods
- Encryption options (TDE, Always Encrypted)
- HA/DR solutions
- Performance tuning techniques
- Backup and restore strategies
Common Scenarios¶
- Lift-and-shift migration β SQL Managed Instance
- New cloud app β Azure SQL Database
- Specific SQL Server version needed β SQL VM
- Global availability needed β Geo-replication
- Performance issues β Query Store analysis
Remember¶
- SQL Database = Fully managed, cloud-native
- Managed Instance = Near-complete compatibility
- SQL VM = Full control, more management
- Always use Azure AD authentication when possible
- Enable TDE by default
- Test backup restores regularly