Azure SQL vs. SQL Server auf VM
| Merkmal | Azure SQL Database | SQL Server auf VM |
|---|---|---|
| Patching | Automatisch | Manuell |
| Backups | Automatisch (7–35 Tage) | Manuell konfigurieren |
| HA | Integriert (99,99%) | Eigenverantwortlich |
| SQL Agent | Nur Elastic Jobs | Vollständig |
| Kosten | ab ~5 €/Monat | VM + Lizenz |
| Kompatibilität | 99% SQL Server 2022 | 100% |
SQL Server und Database erstellen
# Logischer SQL Server erstellen
az sql server create \
--name sql-firma-prod \
--resource-group rg-firma-prod \
--location germanywestcentral \
--admin-user sqladmin \
--admin-password "SicheresPasswort123!"
# Datenbank erstellen
az sql db create \
--server sql-firma-prod \
--resource-group rg-firma-prod \
--name db-produktion \
--service-objective S2 \
--backup-storage-redundancy Geo
Service Tiers (Pricing)
| Tier | DTU/vCore | RAM | Preis/Monat |
|---|---|---|---|
| Basic | 5 DTU | - | ~5 € |
| Standard S2 | 50 DTU | - | ~75 € |
| General Purpose (2 vCore) | 2 vCore | 10 GB | ~250 € |
| General Purpose (4 vCore) | 4 vCore | 20 GB | ~500 € |
| Serverless | 0,5–16 vCore | Auto | Pay-per-use |
Empfehlung für KMU: Serverless für variable Last, Standard S2 für konstante kleine Workloads.
Firewall-Regeln
# IP-Range erlauben
az sql server firewall-rule create \
--server sql-firma-prod \
--resource-group rg-firma-prod \
--name allow-office \
--start-ip-address 80.100.50.0 \
--end-ip-address 80.100.50.255
# Azure Services erlauben (für App Service, etc.)
az sql server firewall-rule create \
--server sql-firma-prod \
--resource-group rg-firma-prod \
--name allow-azure-services \
--start-ip-address 0.0.0.0 \
--end-ip-address 0.0.0.0
Private Endpoint (empfohlen für Produktion)
# Private Endpoint – SQL DB nur aus dem VNet erreichbar
az network private-endpoint create \
--name pe-sql-firma \
--resource-group rg-firma-prod \
--vnet-name vnet-firma-prod \
--subnet snet-data \
--private-connection-resource-id /subscriptions/.../sql-firma-prod \
--group-id sqlServer \
--connection-name pe-conn-sql
Migration von On-Premises SQL Server
# Azure Database Migration Service (DMS)
az dms create \
--name dms-firma \
--resource-group rg-firma-prod \
--location germanywestcentral \
--sku-name Premium_4vCores
# Migration per SSMS (SQL Server Management Studio)
# SSMS → Connect zu On-Premises → Tasks → Deploy Database to Azure SQL
Connection String
# ADO.NET
Server=tcp:sql-firma-prod.database.windows.net,1433;
Database=db-produktion;
User ID=sqladmin;
Password=***;
Encrypt=True;
# JDBC
jdbc:sqlserver://sql-firma-prod.database.windows.net:1433;
database=db-produktion;user=sqladmin@sql-firma-prod;
password={your_password};
Query Performance Insight
Portal → SQL Database → Query Performance Insight:
Zeigt die teuersten Queries nach CPU, Dauer und Ausführungszahl. Unverzichtbar für Performance-Optimierung.
FAQ
Kann ich gespeicherte Prozeduren und SQL Agent nutzen?
Stored Procedures: Ja. SQL Agent: Eingeschränkt (Elastic Jobs als Ersatz). Für vollständigen SQL Agent: Azure SQL Managed Instance.
Automatische Backups – wie lange aufbewahrt?
Standard: 7 Tage, konfigurierbar bis 35 Tage. Point-in-Time Restore auf Sekundengenauigkeit.
Fazit
Azure SQL Database ist für die meisten KMU-Anwendungen die beste Wahl: kein DBA nötig, automatische Backups und HA inbegriffen.
Azure-Datenbankarchitektur für KMU in Heidelberg, Mannheim und der Rhein-Neckar-Region. Beratung anfragen.