Introduction
ShopNest cloud-first apps store data in Azure SQL Database — managed SQL Server without patching VMs, with automatic backups and firewall rules.
After this article you will
- Create Azure SQL on budget tier
- Configure firewall and connection string
- Run EF Core migrations against Azure SQL
- Enable connection resiliency
- Use Managed Identity for passwordless access
Prerequisites
- Article 62 — GitHub Actions CI/CD
- ShopNest solution builds and tests pass locally
Concept deep-dive
// Program.cs — Azure SQL with retry
builder.Services.AddDbContext<ShopNestDbContext>(options =>
options.UseSqlServer(connectionString, sql =>
{
sql.EnableRetryOnFailure(maxRetryCount: 5,
maxRetryDelay: TimeSpan.FromSeconds(30),
errorNumbersToAdd: null);
sql.MigrationsAssembly(typeof(ShopNestDbContext).Assembly.FullName);
}));
// Managed Identity connection (no password)
// Server=tcp:shopnest.database.windows.net;Database=ShopNest;
// Authentication=Active Directory Managed Identity;
Firewall: allow Azure services + your dev IP. Tiers: Basic for dev (~₹500/mo); Standard S2+ for production load.
Hands-on — ShopNest Cloud-First Application
- Create Azure SQL server + database in Portal.
- Add firewall rule for local IP.
- dotnet ef database update against Azure connection.
- Enable Query Performance Insight in Portal.
- Configure App Service Managed Identity + SQL user.
Common errors & best practices
- Firewall blocks App Service — enable Allow Azure services or VNet integration.
- LocalDB connection string in Azure — won't work.
- No retry — transient fault errors under load.
Interview questions
Q: Azure SQL vs SQL on VM?
A: PaaS managed backups/patching; VM gives full control.
Q: EnableRetryOnFailure?
A: Handles transient Azure SQL throttling (error 40613 etc.).
Summary
- Azure SQL is managed SQL Server for ShopNest cloud
- Firewall + connection string first setup steps
- EF migrations work same as on-prem SQL
- Managed Identity eliminates password rotation pain
Previous: GitHub Actions CI/CD
Next: Secrets Management
FAQ
Cheapest dev tier?
Basic or serverless DTU — watch auto-pause costs.
Backup?
Automatic PITR; geo-redundant optional for DR.