Introduction
Database development often creates a gap between the local development environment and the cloud environment where an application eventually runs.
A .NET developer might build an application against SQL Server locally and then deploy it to Azure SQL Database. The application may work correctly during development, but database behavior, available features, configuration, or deployment assumptions can differ once the application reaches the cloud.
That creates the familiar problem:
Works on my machine
|
v
Deploy to cloud
|
v
Unexpected database behaviorAzure SQL Developer is designed to address part of this problem by providing the Azure SQL Database engine in a local container. The current offering is in preview and is intended for local development and CI scenarios. The goal is to let developers work against an Azure SQL Database-compatible engine without requiring a continuously available cloud database during the development loop.
This creates an interesting development model:
.NET Application
|
v
Azure SQL Developer Container
|
v
Local Development
|
v
Azure SQL DatabaseFor .NET developers, the important question is not simply whether a database can run inside a container. SQL Server containers have been available for development for years.
The interesting question is:
How closely can a local Azure SQL development environment match the database behavior that the application will eventually use in Azure?
The Local Development Problem
A typical cloud-oriented .NET application might use:
ASP.NET Core
|
v
Entity Framework Core
|
v
Azure SQL DatabaseDuring local development, developers have several choices.
Use a Shared Cloud Database
Developer
|
v
Azure SQL DatabaseThis can provide a realistic database environment, but it introduces:
Network dependency
Shared development state
Potential cloud costs
Data management concerns
Slower feedback for some operations
Use SQL Server Locally
Another option is:
Developer
|
v
SQL Server
|
v
EF CoreThis is convenient, but it may not reproduce every Azure SQL-specific behavior.
Use Azure SQL Developer Locally
The newer approach is:
Developer
|
v
Azure SQL Developer Container
|
v
EF CoreThe objective is to bring the Azure SQL Database engine closer to the developer's local inner loop.
What Is Azure SQL Developer?
Azure SQL Developer is a containerized Azure SQL Database engine intended for local development and CI use.
The preview announcement describes it as the Azure SQL Database engine running locally in a container, rather than a generic SQL Server image intended to approximate Azure SQL. The stated goal is to provide the same engine behavior used in Azure SQL Database for local development scenarios.
This distinction is important.
Conceptually:
Traditional Local Development
.NET
|
v
SQL Server Container
|
v
Hope behavior matches Azure SQLversus:
Azure SQL Developer
.NET
|
v
Azure SQL Database Engine
|
v
Local Container
|
v
Azure SQL DatabaseThe second model is designed to reduce the gap between local and cloud database development.
Why Engine Parity Matters
Consider a .NET application using Entity Framework Core.
Your application may execute:
var products = await db.Products
.Where(x => x.IsActive)
.OrderBy(x => x.Name)
.ToListAsync();The C# code looks identical regardless of where the database runs.
But the application depends on more than C#.
It also depends on:
EF Core
|
v
Database Provider
|
v
SQL Generation
|
v
Database Engine
|
v
Database BehaviorIf the local database behaves differently from the target database, developers may discover problems only after deployment.
A local environment that uses the same database engine can reduce that gap.
A Typical .NET Architecture
A local application might look like:
+----------------------+
| ASP.NET Core API |
+----------+-----------+
|
| EF Core
v
+----------------------+
| Azure SQL Developer |
| Container |
+----------------------+The application can use a normal SQL connection string.
For example:
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost,1433;Database=OrdersDb;User Id=sa;Password=YourPassword;TrustServerCertificate=True;"
}
}The exact connection string depends on how the container is configured.
The important architectural principle is that the application should not need separate database access code simply because development is local.
Containerized Database Development
Containers are particularly useful for database development because the environment can be created and removed without requiring a permanent database installation on the developer's machine.
The basic workflow is:
Pull Image
|
v
Start Container
|
v
Create Database
|
v
Run Application
|
v
Run Tests
|
v
Stop ContainerA simplified Docker workflow could look like:
docker pull <azure-sql-developer-image>and:
docker run \
--name azure-sql-dev \
-e ACCEPT_EULA=Y \
-e MSSQL_SA_PASSWORD="StrongPasswordHere" \
-p 1433:1433 \
-d <azure-sql-developer-image>The exact image name, environment variables, licensing requirements, and supported configuration should always be verified against the version being used because the Azure SQL Developer container is a preview offering.
Why Offline Development Is Useful
A major benefit of a local container is that developers can continue working without a live cloud database connection.
Consider:
Internet Available
|
v
Cloud Databaseversus:
Internet Unavailable
|
v
Local Database Container
|
v
Continue DevelopmentThis can be particularly useful for:
Travel
Workshops
Classrooms
Demonstrations
Local integration testing
Restricted development environments
CI environments
Once the required container image and dependencies are available locally, database development can continue without sending queries to a remote development database.
The Inner Loop
The inner loop is the repeated development cycle:
Write Code
|
v
Build
|
v
Run
|
v
Test
|
v
Change
|
+---------> RepeatDatabase development is part of this loop.
A cloud database can make the loop dependent on:
Network
Cloud Availability
Shared Resources
Cloud ConfigurationA local container moves the database closer to the developer:
.NET Application
|
v
Local Database
|
v
Immediate FeedbackThat can make local iteration simpler.
The Outer Loop
The outer loop covers collaboration and deployment:
Developer
|
v
Git Repository
|
v
CI
|
v
Staging
|
v
ProductionThe local database should fit into this process rather than becoming a completely different environment.
A good architecture is:
INNER LOOP
.NET
|
v
Azure SQL Developer
|
v
Tests
OUTER LOOP
Git
|
v
CI
|
v
Azure SQL DatabaseThe database engine remains consistent while the infrastructure around it changes.
EF Core Integration
For a .NET application using EF Core, the database provider remains responsible for communication with SQL Server-compatible databases.
A typical registration looks like:
builder.Services.AddDbContext<AppDbContext>(options =>
{
options.UseSqlServer(
builder.Configuration
.GetConnectionString("DefaultConnection"));
});The application code does not need to know whether the database is:
Local Containeror:
Azure SQL DatabaseThe environment-specific connection string can change through configuration.
This is one of the biggest advantages of containerized database development.
Environment-Based Configuration
Instead of hard-coding connection information, use environment-specific configuration.
For development:
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost,1433;Database=OrdersDb;..."
}
}For a cloud environment:
ConnectionStrings__DefaultConnectioncan be supplied through the deployment environment.
The application code remains:
var connectionString =
builder.Configuration.GetConnectionString(
"DefaultConnection");This keeps infrastructure configuration outside the application logic.
Running EF Core Migrations
A local container is also useful for testing EF Core migrations.
For example:
dotnet ef migrations add InitialCreateThen:
dotnet ef database updateThe migration runs against the local database.
A useful workflow is:
Create Migration
|
v
Apply Locally
|
v
Run Tests
|
v
Review SQL
|
v
Apply in CI
|
v
DeployThis gives developers a chance to catch schema problems before deployment.
Testing Database Migrations
Suppose a migration adds:
migrationBuilder.AddColumn<decimal>(
name: "Price",
table: "Products",
type: "decimal(18,2)",
nullable: false,
defaultValue: 0m);The migration should be tested against the same database engine used by the target environment.
Test:
Migration Up
|
v
Schema Validation
|
v
Application Tests
|
v
Migration Downwhere rollback is supported and appropriate for the application's migration strategy.
Integration Testing
A local database container is particularly useful for integration tests.
Instead of:
Integration Test
|
v
Shared Cloud Databaseyou can use:
Integration Test
|
v
Temporary Database ContainerThis improves test isolation.
A test suite might:
Start Database
|
v
Apply Migrations
|
v
Seed Test Data
|
v
Run Tests
|
v
Clean UpThis approach is especially useful in CI.
Example Integration Test
Consider:
[Fact]
public async Task Can_Create_Order()
{
var order = new Order
{
CustomerId = 1001,
Total = 250m
};
db.Orders.Add(order);
await db.SaveChangesAsync();
var result = await db.Orders
.SingleAsync(x => x.CustomerId == 1001);
Assert.Equal(250m, result.Total);
}The test becomes more valuable when the database behind it behaves like the production database.
It is still an integration test, not a replacement for unit testing.
Local Container vs Shared Database
| Area | Local Container | Shared Cloud Database |
|---|---|---|
| Internet dependency | Low after setup | High |
| Developer isolation | High | Lower |
| Setup | Container required | Cloud resource required |
| Shared data | No | Usually yes |
| Local iteration | Strong | Depends on network |
| Cloud configuration | Can be reproduced locally | Direct |
| CI suitability | Strong | Strong |
| Production parity | Designed for Azure SQL parity | Direct |
| Cloud cost during local work | Avoided | Possible |
| Cleanup | Container removal | Resource/data cleanup |

Join the conversation! Your thoughts help the community grow.