What Azure/AWS services have you worked with for .NET applications?
Quick Answer
For hosting .NET apps in the cloud, Azure and AWS offer comparable building blocks. Compute ranges from managed app platforms (Azure App Service, AWS Elastic Beanstalk) to containers (Azure Container Apps/AKS, AWS ECS/EKS) and serverless (Azure Functions, AWS Lambda). Both provide managed databases (Azure SQL, Amazon RDS), storage (Blob/S3), messaging (Service Bus/SQS/SNS), caching, identity, and monitoring — chosen by the workload's hosting, scaling, and operational needs.
Detailed Answer
Here's an overview of commonly used cloud services for .NET Core applications:
Azure Services
Compute:
- Azure App Service
- Managed platform for hosting web apps, APIs, and mobile backends
- Built-in CI/CD, auto-scaling, custom domains, SSL
- Best for: Web APIs, web applications, background jobs
// Program.cs - optimized for Azure App Service
var builder = WebApplication.CreateBuilder(args);
// Azure App Service provides HTTPS automatically
builder.Services.AddHttpsRedirection(options =>
{
options.HttpsPort = 443;
});
// Add Application Insights
builder.Services.AddApplicationInsightsTelemetry();
var app = builder.Build();
// Configure for Azure App Service
app.UseForwardedHeaders();
app.UseHttpsRedirection();
app.MapHealthChecks("/health");
app.Run();
- Azure Functions
- Serverless compute for event-driven workloads
- Pay per execution, auto-scaling
- Best for: Background tasks, webhooks, scheduled jobs
[Function("ProcessOrder")]
public async Task Run(
[HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestData req,
[QueueOutput("orders")] ICollector orderQueue)
{
var order = await req.ReadFromJsonAsync();
orderQueue.Add(order);
var response = req.CreateResponse(HttpStatusCode.OK);
return response;
}
-
Azure Kubernetes Service (AKS)
- Managed Kubernetes cluster
- Best for: Microservices, complex containerized applications
-
Azure Container Instances (ACI)
- Run containers without managing servers
- Best for: Simple containerized apps, batch jobs
Data Storage:
- Azure SQL Database
- Managed SQL Server database
- Automatic backups, patching, high availability
// Connection string from Azure Key Vault
builder.Configuration.AddAzureKeyVault(
new Uri($"https://{keyVaultName}.vault.azure.net/"),
new DefaultAzureCredential());
builder.Services.AddDbContext(options =>
options.UseSqlServer(
builder.Configuration["ConnectionStrings:DefaultConnection"]));
- Azure Cosmos DB
- Globally distributed NoSQL database
- Multiple APIs: SQL, MongoDB, Cassandra, Gremlin
builder.Services.AddSingleton(sp =>
{
var connectionString = builder.Configuration["CosmosDb:ConnectionString"];
return new CosmosClient(connectionString);
});
- Azure Blob Storage
- Object storage for unstructured data (files, images, videos)
builder.Services.AddSingleton(x =>
{
var connectionString = builder.Configuration["AzureStorage:ConnectionString"];
return new BlobServiceClient(connectionString);
});
// Usage
public class FileService
{
private readonly BlobServiceClient _blobServiceClient;
public async Task UploadFileAsync(Stream fileStream, string fileName)
{
var containerClient = _blobServiceClient.GetBlobContainerClient("uploads");
await containerClient.CreateIfNotExistsAsync();
var blobClient = containerClient.GetBlobClient(fileName);
await blobClient.UploadAsync(fileStream, overwrite: true);
return blobClient.Uri.ToString();
}
}
- Azure Table Storage / Azure Storage Queues
- NoSQL key-value storage / Message queuing
Messaging & Integration:
- Azure Service Bus
- Enterprise message broker with topics, queues, subscriptions
builder.Services.AddSingleton(sp =>
{
var connectionString = builder.Configuration["ServiceBus:ConnectionString"];
return new ServiceBusClient(connectionString);
});
// Sending messages
public async Task SendMessageAsync(Order order)
{
var sender = _serviceBusClient.CreateSender("orders");
var message = new ServiceBusMessage(JsonSerializer.Serialize(order));
await sender.SendMessageAsync(message);
}
-
Azure Event Grid
- Event routing service for reactive programming
-
Azure Event Hubs
- Big data streaming platform and event ingestion service
Security & Identity:
- Azure Active Directory (Azure AD / Entra ID)
- Identity and access management
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd"));
builder.Services.AddAuthorization();
- Azure Key Vault
- Secrets, keys, and certificate management
var keyVaultUri = new Uri(builder.Configuration["KeyVault:Uri"]);
builder.Configuration.AddAzureKeyVault(keyVaultUri, new DefaultAzureCredential());
Monitoring & Logging:
- Application Insights
- APM and monitoring solution
builder.Services.AddApplicationInsightsTelemetry(options =>
{
options.ConnectionString = builder.Configuration["ApplicationInsights:ConnectionString"];
});
// Custom telemetry
public class OrderService
{
private readonly TelemetryClient _telemetry;
public async Task ProcessOrder(Order order)
{
var stopwatch = Stopwatch.StartNew();
try
{
// Process order
_telemetry.TrackEvent("OrderProcessed",
new Dictionary { ["OrderId"] = order.Id });
}
catch (Exception ex)
{
_telemetry.TrackException(ex);
throw;
}
finally
{
_telemetry.TrackMetric("OrderProcessingTime", stopwatch.ElapsedMilliseconds);
}
}
}
- Azure Monitor & Log Analytics
- Infrastructure and application monitoring
DevOps:
-
Azure DevOps
- CI/CD pipelines, repos, boards, artifacts
-
Azure Container Registry (ACR)
- Private Docker registry
AWS Services
Compute:
-
AWS Elastic Beanstalk
- Managed platform for .NET applications
- Similar to Azure App Service
-
AWS Lambda
- Serverless functions (supports .NET)
public class Function
{
public async Task FunctionHandler(
APIGatewayProxyRequest request, ILambdaContext context)
{
return new APIGatewayProxyResponse
{
StatusCode = 200,
Body = JsonSerializer.Serialize(new { message = "Hello from Lambda" })
};
}
}
-
Amazon ECS / EKS
- Container orchestration (ECS = proprietary, EKS = Kubernetes)
-
Amazon EC2
- Virtual machines
Data Storage:
-
Amazon RDS (SQL Server)
- Managed relational database
-
Amazon DynamoDB
- NoSQL database
-
Amazon S3
- Object storage (like Azure Blob Storage)
var s3Client = new AmazonS3Client(RegionEndpoint.USEast1);
// Upload file
var putRequest = new PutObjectRequest
{
BucketName = "my-bucket",
Key = "uploads/file.txt",
ContentBody = "Hello S3"
};
await s3Client.PutObjectAsync(putRequest);
Messaging:
-
Amazon SQS
- Message queuing service
-
Amazon SNS
- Pub/sub messaging
-
Amazon EventBridge
- Event bus for serverless applications
Security:
-
AWS IAM
- Identity and access management
-
AWS Secrets Manager
- Secrets management
-
AWS Cognito
- User authentication and authorization
Typical .NET Core Architecture on Azure:
Internet
↓
Azure Front Door / Application Gateway (CDN, WAF, Load Balancer)
↓
Azure App Service / AKS (Multiple instances)
↓
├─→ Azure SQL Database (Relational data)
├─→ Azure Cosmos DB (NoSQL data)
├─→ Azure Cache for Redis (Caching)
├─→ Azure Blob Storage (File storage)
├─→ Azure Service Bus (Async messaging)
└─→ Azure Key Vault (Secrets)
Monitoring: Application Insights + Azure Monitor
Identity: Azure AD
CI/CD: Azure DevOps / GitHub Actions
Cost Optimization Tips:
- Use Azure App Service for simple apps (easier than AKS)
- Use serverless (Functions, Logic Apps) for sporadic workloads
- Enable auto-scaling to match demand
- Use Azure Reserved Instances for predictable workloads (save 30-70%)
- Implement caching (Redis) to reduce database load
- Use Azure CDN for static content
- Monitor with Azure Cost Management