Isaac.

azure

Azure App Service with ASP.NET Core

Deploy and manage ASP.NET Core applications on Azure App Service.

By Emem IsaacAugust 23, 20212 min read
#azure#app service#aspnet core#deployment#paas
Share:

A Simple Analogy

Azure App Service is like renting a house instead of building one. You don't manage the foundation (servers, OS, runtime)—Azure handles that. You just run your app and pay for what you use.


What Is Azure App Service?

App Service is a Platform-as-a-Service (PaaS) for hosting web apps, APIs, and mobile backends. It handles infrastructure, scaling, and patching automatically.


Benefits

  • No infrastructure management: Focus on code
  • Auto-scaling: Handle traffic spikes automatically
  • Built-in CI/CD: Deploy from GitHub, Azure DevOps
  • Monitoring: Application Insights integration
  • Cost-effective: Pay-as-you-go pricing

Deployment from .NET Project

// In Program.cs
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllers();
builder.Services.AddApplicationInsightsTelemetry();

var app = builder.Build();
app.UseHttpsRedirection();
app.MapControllers();
app.Run();

Deploy with Azure CLI:

az webapp create --resource-group myGroup \
  --plan myServicePlan \
  --name myApp
  
dotnet publish -c Release
az webapp deployment source config-zip \
  --resource-group myGroup \
  --name myApp \
  --src publish.zip

Configuration & Secrets

// Access App Service settings
var connectionString = builder.Configuration["ConnectionStrings:Default"];
var apiKey = builder.Configuration["ApiKey"];

// From Azure Key Vault
builder.Configuration.AddAzureKeyVault(
    new Uri($"https://{keyVaultName}.vault.azure.net/"),
    new DefaultAzureCredential());

Scaling

# Scale up (increase machine size)
az appservice plan update --name myPlan \
  --resource-group myGroup \
  --sku P1V2

# Scale out (add instances)
az appservice plan update --name myPlan \
  --resource-group myGroup \
  --number-of-workers 3

Monitoring

public class HealthCheckController : ControllerBase
{
    [HttpGet("/health")]
    public IActionResult Health()
    {
        return Ok(new { status = "healthy" });
    }
}

// App Service can use this for health checks

Best Practices

  1. Use deployment slots: Test before production
  2. Enable authentication: Azure AD integration
  3. Monitor performance: Application Insights
  4. Auto-scale rules: Scale based on CPU/memory
  5. Database connections: Use Connection Strings

Related Concepts

  • Application Insights monitoring
  • Deployment slots for staging
  • Azure SQL Database integration
  • Application gateway for load balancing

Summary

Azure App Service simplifies ASP.NET Core deployment with automatic scaling, monitoring, and built-in DevOps. Focus on building features while Azure handles infrastructure.

Share:

Written by Emem Isaac

Expert Software Engineer with 15+ years of experience building scalable enterprise applications. Specialized in ASP.NET Core, Azure, Docker, and modern web development. Passionate about sharing knowledge and helping developers grow.

Ready to Build Something Amazing?

Let's discuss your project and explore how my expertise can help you achieve your goals. Free consultation available.

💼 Trusted by 50+ companies worldwide | ⚡ Average response time: 24 hours