Sunday, August 2, 2026

Azure Container Registry


Azure Container Registry (ACR) — Complete Guide for .NET Lead

Azure Container Registry (ACR) is Microsoft's private Docker container registry that stores, manages, secures, and distributes container images for applications running on Azure Kubernetes Service (AKS), Azure App Service, Azure Container Apps, Azure Functions, Virtual Machines, and other container platforms.

Official Documentation

Azure Container Registry Documentation


Table of Contents

  1. What is Azure Container Registry?

  2. Why Do We Need ACR?

  3. Docker Hub vs Azure Container Registry

  4. ACR Architecture

  5. Real-Time Enterprise Example

  6. Image Lifecycle

  7. Authentication

  8. Azure DevOps Integration

  9. AKS Integration

  10. C# & Docker Example

  11. Geo-Replication

  12. Image Security

  13. Best Practices

  14. Lead-Level Interview Questions


1. What is Azure Container Registry?

Azure Container Registry is a fully managed private container image registry where you store Docker and OCI-compatible container images.

Instead of storing images on a public registry like Docker Hub, organizations use ACR to:

  • Store private images

  • Control access

  • Integrate with Azure services

  • Secure enterprise deployments

  • Improve deployment performance


2. Why Do We Need ACR?

Suppose your application contains:

Order Service
Payment Service
Inventory Service
Notification Service

Each service is packaged into a Docker image.

These images must be stored somewhere.

Developer
      |
Docker Build
      |
Azure Container Registry
      |
AKS / App Service / Container Apps

ACR becomes the central image repository.


3. Docker Hub vs Azure Container Registry

Docker HubAzure Container Registry
Public/PrivatePrivate Enterprise Registry
Internet HostedAzure Integrated
Basic SecurityMicrosoft Entra ID & RBAC
Limited Enterprise IntegrationNative Azure Integration
Community ImagesEnterprise Images

4. Real-Time Architecture

Developer
     |
Git Push
     |
Azure DevOps
     |
Build Docker Image
     |
Push Image
     |
Azure Container Registry
     |
+------------+-------------+
|            |             |
AKS      App Service   Container Apps

5. Real-Time Banking Example

Internet Banking

↓

Azure DevOps

↓

Docker Build

↓

Azure Container Registry

↓

AKS Cluster

↓

Customers

Every new application version is packaged as a Docker image and stored in ACR.


6. Repository Structure

Example:

mycompany.azurecr.io

|

+-- order-api

+-- payment-api

+-- inventory-api

+-- notification-api

Each repository contains multiple image versions.


7. Image Tagging

Examples:

order-api:1.0

order-api:1.1

order-api:2.0

order-api:latest

Avoid relying on the latest tag for production deployments. Use immutable version tags.


8. Docker Build

Dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:9.0
WORKDIR /app
COPY . .
ENTRYPOINT ["dotnet","OrderApi.dll"]

Build:

docker build -t order-api:1.0 .

9. Login to ACR

az acr login --name myregistry

10. Tag Image

docker tag order-api:1.0 myregistry.azurecr.io/order-api:1.0

11. Push Image

docker push myregistry.azurecr.io/order-api:1.0

Image flow:

Developer

↓

Docker Image

↓

Azure Container Registry

↓

Ready for Deployment

12. Pull Image

docker pull myregistry.azurecr.io/order-api:1.0

13. Azure DevOps Integration

Git Push

↓

Azure Pipeline

↓

Build

↓

Docker Build

↓

Push to ACR

↓

Deploy to AKS

Typical pipeline steps:

  • Restore

  • Build

  • Test

  • Docker Build

  • Push Image

  • Deploy


14. AKS Integration

Azure Container Registry

↓

AKS

↓

Pods

↓

Containers

AKS pulls the required image from ACR during deployment.


15. Authentication

Supported authentication methods include:

  • Microsoft Entra ID

  • Managed Identity

  • Service Principal

  • Repository Tokens (supported scenarios)

  • Admin Account (generally avoid in production)

Preferred approach:

AKS

↓

Managed Identity

↓

Azure Container Registry

↓

Access Granted

16. Geo-Replication

Large organizations deploy globally.

East US

↓

Azure Container Registry

↓

West Europe

↓

Southeast Asia

Geo-replication reduces latency and improves availability for Premium registries.


17. Image Security

ACR supports image security capabilities including:

  • Microsoft Entra authentication

  • Azure RBAC

  • Private Endpoints

  • Content trust/workflow integrations (where applicable)

  • Image scanning integrations through Microsoft Defender for Cloud and partner tools


18. C# Microservice Example

ASP.NET Core API

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllers();

var app = builder.Build();

app.MapControllers();

app.Run();

Containerize it with Docker and push the resulting image to ACR for deployment.


19. Enterprise Deployment Flow

Developer
      |
Git
      |
Azure DevOps
      |
Build
      |
Unit Tests
      |
Docker Build
      |
Azure Container Registry
      |
AKS
      |
Application Insights

20. Best Practices

  • Use immutable image tags.

  • Enable Microsoft Entra authentication.

  • Use Managed Identity where possible.

  • Apply Azure RBAC with least privilege.

  • Enable geo-replication for global deployments.

  • Keep base images updated.

  • Scan images for vulnerabilities.

  • Remove unused images with retention policies.

  • Integrate ACR with CI/CD pipelines.


21. Lead-Level Interview Questions

Basic

  1. What is Azure Container Registry?

  2. Why do we use ACR?

  3. What is a Docker image?

  4. What is a repository?

  5. What is image tagging?

Intermediate

  1. Docker Hub vs ACR?

  2. How does AKS pull images?

  3. How do you authenticate to ACR?

  4. What is geo-replication?

  5. How do you secure ACR?

  6. How do you integrate ACR with Azure DevOps?

  7. How do you manage image versions?

Lead-Level

  1. Design a secure container deployment architecture.

  2. How would you implement CI/CD using ACR?

  3. How do you prevent deploying vulnerable images?

  4. How would you design a multi-region container registry?

  5. How would you optimize image pull performance?

  6. How do you implement disaster recovery for container images?

  7. How would you manage thousands of container images?

  8. When would you choose ACR over Docker Hub?


22. Lead-Level Interview Answer

Interviewer: "How have you used Azure Container Registry in your project?"

Answer:

"In our .NET microservices platform, every ASP.NET Core service was containerized using Docker. Azure DevOps pipelines built versioned Docker images after successful builds and unit tests, then pushed those images to Azure Container Registry. AKS deployments referenced immutable image tags from ACR, ensuring consistent releases across DEV, QA, and Production. We secured the registry using Microsoft Entra ID, Azure RBAC, and Managed Identity, enabled geo-replication for global deployments, and integrated image vulnerability scanning into our CI/CD process. This provided secure, repeatable, and reliable container deployments for all microservices."

This is the type of comprehensive answer expected from a .NET Lead or Solution Architect, because it covers architecture, DevOps, security, scalability, and operational best practices.

Azure Key Vault

                                         

Azure Key Vault — Complete Guide for .NET Lead

Azure Key Vault is one of the most important Azure security services. Every .NET Developer, Technical Lead, and Solution Architect should understand how to securely store and access secrets, keys, and certificates without exposing sensitive information in source code or configuration files.

Official Documentation

Azure Key Vault Documentation


Table of Contents

  1. What is Azure Key Vault?

  2. Why Do We Need Key Vault?

  3. Real-Time Enterprise Example

  4. Key Vault Architecture

  5. Types of Objects

  6. Authentication

  7. Managed Identity

  8. Access Control

  9. C# Integration

  10. Azure DevOps Integration

  11. Certificates

  12. Security Best Practices

  13. Monitoring

  14. Best Practices

  15. Lead-Level Interview Questions


1. What is Azure Key Vault?

Azure Key Vault is a cloud service for securely storing and managing secrets, encryption keys, and certificates.

Instead of storing passwords in:

  • Source code

  • appsettings.json

  • web.config

  • Environment variables (where long-term secrets are difficult to manage)

Store them in Azure Key Vault.


2. Why Do We Need Key Vault?

Suppose your application connects to:

  • Azure SQL Database

  • Azure Storage

  • Azure Service Bus

  • Third-party APIs

Each requires credentials.

❌ Bad Practice

{
  "ConnectionString":
  "Server=...;Password=MyPassword123"
}

Anyone with access to the configuration file could potentially see the secret.


Better Approach

Application
     |
     v
Azure Key Vault
     |
     +--- SQL Secret
     +--- Storage Secret
     +--- Service Bus Secret
     +--- API Keys

The application retrieves secrets securely at runtime.


3. Real-Time Banking Example

Internet Banking App
          |
          v
Azure App Service
          |
Managed Identity
          |
Azure Key Vault
          |
+------------------------------+
| SQL Secret                   |
| Storage Secret               |
| Service Bus Secret           |
| Payment Gateway API Key      |
+------------------------------+

The application never stores passwords in code.


4. Azure Key Vault Architecture

             ASP.NET Core API
                    |
                    |
          Managed Identity
                    |
                    v
           Azure Key Vault
                    |
     +--------------+--------------+
     |              |              |
  Secrets         Keys        Certificates

5. What Can Key Vault Store?

Azure Key Vault stores three primary object types.

Secrets

Examples:

  • SQL Connection Strings

  • API Keys

  • Storage Keys

  • JWT Signing Secrets

  • SMTP Passwords


Keys

Used for:

  • Encryption

  • Digital Signatures

  • Key Management


Certificates

Used for:

  • HTTPS

  • SSL/TLS

  • Authentication


6. Real-Time Example

Suppose your application needs:

Azure SQL

Azure Storage

Service Bus

Stripe Payment

Twilio

Instead of:

Code

↓

Passwords

Use:

Code

↓

Key Vault

↓

Secrets

7. Authentication Methods

Applications can authenticate using:

  • Managed Identity (Recommended for Azure-hosted apps)

  • Microsoft Entra ID (Azure AD)

  • Service Principal

  • Azure CLI (Development)

  • Visual Studio Authentication (Development)


8. Managed Identity

This is one of the most frequently asked interview topics.

Without Managed Identity:

App

↓

Username

Password

↓

Azure SQL

Credentials must be stored somewhere.


With Managed Identity:

App Service

↓

Managed Identity

↓

Azure Key Vault

↓

Access Granted

No secret is stored in your application.


9. Access Control

Use Azure RBAC or Key Vault access policies (depending on your chosen model).

Example:

Developer

↓

Read Secret

↓

Allowed

-------------------

Unknown User

↓

Read Secret

↓

Denied

Follow the principle of least privilege.


10. Creating a Secret

Portal example:

Key Vault

↓

Secrets

↓

+ Generate / Import

↓

SQLConnection

↓

Save

11. Secret Naming

Example secrets:

SqlConnectionString

StorageConnection

ServiceBusConnection

JWTSecret

StripeApiKey

Use meaningful names and version secrets when appropriate.


12. ASP.NET Core Integration

Install package:

dotnet add package Azure.Extensions.AspNetCore.Configuration.Secrets

dotnet add package Azure.Identity

Program.cs

using Azure.Identity;

var builder = WebApplication.CreateBuilder(args);

builder.Configuration.AddAzureKeyVault(
    new Uri("https://myvault.vault.azure.net/"),
    new DefaultAzureCredential());

Now values stored in Key Vault become part of the application configuration.


13. Reading a Secret

string connection =
builder.Configuration["SqlConnectionString"];

No password appears in your source code.


14. Using DefaultAzureCredential

var credential = new DefaultAzureCredential();

During development it can authenticate using supported developer credentials (such as Visual Studio or Azure CLI).

In Azure App Service or Azure Functions, it can use the assigned Managed Identity automatically.


15. Using SecretClient

using Azure.Identity;
using Azure.Security.KeyVault.Secrets;

var client = new SecretClient(
    new Uri("https://myvault.vault.azure.net/"),
    new DefaultAzureCredential());

KeyVaultSecret secret =
    await client.GetSecretAsync("SqlConnectionString");

Console.WriteLine(secret.Value);

16. Azure DevOps Integration

Pipeline:

Azure DevOps

↓

Azure Key Vault

↓

Read Secrets

↓

Deploy App Service

Instead of storing passwords inside the pipeline.


17. Certificates

Store:

  • SSL Certificates

  • Client Certificates

  • Signing Certificates

Example:

HTTPS Website

↓

Key Vault Certificate

↓

Secure Communication

18. Key Rotation

Never use the same password forever.

Key Vault supports secret versioning and enables organizations to implement regular rotation strategies.

Example:

Old Secret

↓

New Version

↓

Application Uses New Version

19. Monitoring

Monitor Key Vault using:

  • Azure Monitor

  • Azure Activity Log

  • Diagnostic Logs

  • Alerts

  • Defender for Cloud (where applicable)

Track:

  • Secret access

  • Authentication failures

  • Unauthorized attempts


20. Security Best Practices

  • Use Managed Identity whenever possible.

  • Avoid hardcoded credentials.

  • Grant least-privilege access.

  • Enable soft delete and purge protection.

  • Rotate secrets regularly.

  • Use RBAC where appropriate.

  • Enable logging and monitoring.

  • Avoid sharing account keys broadly.

  • Separate development and production vaults.


21. Real-Time Enterprise Architecture

             Users
                |
      Azure Front Door
                |
      Azure API Management
                |
       Azure App Service
                |
       Managed Identity
                |
        Azure Key Vault
                |
+---------------+---------------+
|               |               |
SQL Secret   Storage Secret   Service Bus Secret
                |
                |
     ASP.NET Core API
                |
      Azure SQL Database

22. Common Mistakes

❌ Hardcoding passwords

❌ Storing secrets in Git repositories

❌ Sharing connection strings over email or chat

❌ Using one vault for every environment without proper separation

❌ Giving every application full access to every secret


23. Best Practices

  • One Key Vault per environment (Dev, QA, Prod) or an equivalent governance strategy.

  • Use Managed Identity for Azure-hosted workloads.

  • Rotate secrets automatically where feasible.

  • Store only sensitive values in Key Vault.

  • Use RBAC and least privilege.

  • Monitor secret usage.

  • Use private networking when required by security policies.


24. Lead-Level Interview Questions

Basic

  1. What is Azure Key Vault?

  2. Why do we need Key Vault?

  3. What can Key Vault store?

  4. What is a secret?

  5. What is a certificate?

Intermediate

  1. What is Managed Identity?

  2. How do you access Key Vault from .NET?

  3. What is DefaultAzureCredential?

  4. Explain RBAC in Key Vault.

  5. How do you rotate secrets?

  6. How do you integrate Key Vault with Azure DevOps?

  7. How do you secure production secrets?

Lead-Level

  1. Design a secure architecture using Azure Key Vault.

  2. How would you migrate hardcoded secrets to Key Vault?

  3. How do you implement secret rotation without downtime?

  4. How do you audit secret access?

  5. How do you secure a multi-environment deployment?

  6. How would you integrate Key Vault with AKS?

  7. How would you troubleshoot authentication failures?

  8. What are the differences between Azure Key Vault and Azure App Configuration?


25. Lead-Level Interview Answer

Interviewer: "How have you used Azure Key Vault in your project?"

Answer:

"In our .NET microservices application, we used Azure Key Vault as the centralized store for sensitive information such as Azure SQL connection details, Service Bus credentials, Storage account secrets, third-party API keys, and certificates. All applications hosted on Azure App Service authenticated using Managed Identity, so no credentials were stored in source code or configuration files. Azure DevOps pipelines retrieved deployment secrets securely from Key Vault during releases, and production access was controlled through Azure RBAC with least-privilege permissions. We also enabled soft delete, purge protection, auditing, and monitoring through Azure Monitor to meet our security and compliance requirements."

This answer demonstrates production-level experience with security, identity, DevOps integration, governance, and cloud architecture, which is what interviewers typically expect from a .NET Lead or Solution Architect.

Don't Copy

Protected by Copyscape Online Plagiarism Checker