Skip to the content.

Architecture Overview

Component Diagram

graph TB
    Users([Users]) -->|HTTPS 443| AppService

    subgraph Azure Subscription
        subgraph Resource Group
            subgraph VNet["Virtual Network (10.101.0.0/24)"]
                subgraph AppSnet["app-service-snet (10.101.0.0/26)"]
                    ASP["App Service Plan (B1 Basic)<br/>1 core, 1.75 GB RAM"]
                    AppService["App Service (Web App)<br/>Container: vaultwarden<br/>Port: 80<br/>Managed Identity<br/>VNet Integration"]
                end

                subgraph PgSnet["postgresql-snet (10.101.0.64/26)<br/>Delegated to PostgreSQL Flexible Server"]
                    PostgreSQL["Azure Database for PostgreSQL<br/>Flexible Server<br/>Burstable B1MS (1 vCore, 2 GB)<br/>SSL enforced<br/>VNet integrated (private access)<br/>35-day GRS automated backups<br/>Optional CanNotDelete lock"]
                end

                subgraph PESnet["private-endpoints-snet (10.101.0.128/26)<br/>privateEndpointNetworkPolicies: Disabled"]
                    KVPE[Key Vault Private Endpoint]
                    StoragePE[Storage Account Private Endpoint]
                end
            end

            PrivateDNS["Private DNS Zones (linked to VNet)<br/>privatelink.postgres.database.azure.com<br/>privatelink.vaultcore.azure.net<br/>privatelink.file.‹storage-suffix›"]

            KeyVault["Azure Key Vault<br/>Admin token + Database URL secrets<br/>publicNetworkAccess: Disabled<br/>RBAC enabled<br/>System-assigned identity access"]

            StorageAccount["Azure Storage Account<br/>Azure Files share mounted at /data<br/>publicNetworkAccess: Disabled<br/>Geo-redundant storage (GRS)"]

            LogAnalytics["Log Analytics Workspace<br/>App Service logs<br/>Metrics & Performance data"]
        end
    end

    AppService -->|DB connection| PostgreSQL
    AppService -->|Managed Identity – retrieves DATABASE_URL| KVPE
    KVPE --> KeyVault
    AppService --> StoragePE
    StoragePE --> StorageAccount
    AppService -->|Logs & Metrics| LogAnalytics
    PrivateDNS -.->|Resolves private IPs| PostgreSQL
    PrivateDNS -.->|Resolves private IPs| KeyVault
    PrivateDNS -.->|Resolves private IPs| StorageAccount

Resource Flow

  1. User Access: Users access Vaultwarden via HTTPS through the App Service’s public endpoint
  2. App Service: Runs the Vaultwarden container with automatic HTTPS termination
  3. Secrets Management: App Service uses its system-assigned managed identity to retrieve admin token and database URL from Key Vault
  4. Data Storage: App Service connects to Azure Database for PostgreSQL Flexible Server via VNet integration → delegated PostgreSQL subnet
  5. DNS Resolution: Private DNS Zone (privatelink.postgres.database.azure.com) resolves PostgreSQL server to its private IP within the VNet
  6. Backup Protection: PostgreSQL Flexible Server built-in backup with 35-day retention and geo-redundant replication to the Azure paired region; point-in-time restore
  7. Monitoring: All logs and metrics are sent to Log Analytics Workspace
  8. Networking: App Service is integrated with Virtual Network; PostgreSQL Flexible Server is accessible only via VNet integration (no public access)

Security Features

Network Security

Data Security

Application Security

Scaling and High Availability

Scaling Configuration

High Availability

Performance Optimizations

Cost Breakdown

Monthly Cost Estimates (North Europe)

Resource Configuration Estimated Cost
App Service Plan (B1) 1 core, 1.75 GB RAM, Linux $13-15
PostgreSQL Flexible Server Burstable B1MS, 1 vCore, 2 GB RAM, 32 GB storage, 35-day GRS backup $15-25
Storage Account Standard_GRS Hot Files, 250 GB share quota (billed on actual usage) $2-15
Private Endpoints Key Vault + Storage Account Files (×2) ~$15
Log Analytics Pay-as-you-go ingestion (~10 GB/month) $2-10
Virtual Network Three subnets (app service, PostgreSQL, private endpoints), NSGs included Free
Private DNS Zones privatelink for PostgreSQL, Key Vault, and Storage Files (×3) ~$1.50
Key Vault Operations-based pricing < $1
Total   $50-80/month

B1 Features (Default):

Upgrade Options:

Backup & Protection Features:

Note: B1 provides excellent value for small to medium deployments (5-50 users). For larger deployments or auto-scaling needs, upgrade to Standard (S1+) or Premium tiers.

Cost Optimization Tips

  1. B1 tier is ideal for small to medium deployments (5-50 users) with excellent cost savings
  2. Upgrade to Standard (S1+) tier for auto-scaling and deployment slots if needed
  3. Configure auto-scaling (on S1+) to scale down during low-traffic periods
  4. Use lifecycle policies for Log Analytics to manage log retention
  5. Use shared Log Analytics workspace across multiple projects
  6. Reserved instances available for 1-3 year commitments (30-55% savings)
  7. Adjust PostgreSQL backup retention period (1-35 days) based on compliance requirements; the default is the maximum 35 days

Deployment Process

Pre-Deployment

  1. Azure CLI and Bicep installed
  2. Appropriate Azure subscription permissions
  3. Optional: Custom domain DNS configured

Deployment Steps

  1. Resource Group Creation: Subscription-scoped deployment creates resource group
  2. Network Setup: Virtual Network with three subnets (app-service-snet, postgresql-snet, private-endpoints-snet) provisioned
  3. Private DNS Zones: privatelink.postgres.database.azure.com, privatelink.vaultcore.azure.net, and privatelink.file.<storage-suffix> created and linked to the VNet
  4. Database Provisioning: Azure Database for PostgreSQL Flexible Server deployed in the delegated subnet with VNet integration
  5. Monitoring Setup: Log Analytics Workspace deployed
  6. App Service Plan: B1 Basic Linux plan created (can be upgraded to Standard/Premium for auto-scaling)
  7. Key Vault: Deployed for secrets management (admin token + database URL) with publicNetworkAccess: 'Disabled' and a vault private endpoint in private-endpoints-snet, wired to the Key Vault private DNS zone
  8. Storage Account: StorageV2 account with an Azure Files share is provisioned with geo-redundant storage (GRS) for cross-region data replication. publicNetworkAccess is Disabled; the App Service reaches the file share over the VNet through a file private endpoint in private-endpoints-snet, with name resolution via the linked privatelink.file.<storage-suffix> private DNS zone. The share is mounted into the container at /data so that ATTACHMENTS_FOLDER (/data/attachments), SENDS_FOLDER (/data/sends), ICON_CACHE_FOLDER (/data/icon_cache), and RSA_KEY_FILENAME (/data/rsa_key, used by Vaultwarden as the prefix for the .pem / .pub.pem JWT signing keypair) are persisted to durable storage — offloading the favicon cache and the generated RSA keys from the ephemeral container disk so client sessions survive restarts. TEMPLATES_FOLDER is intentionally left on the local container disk because upstream Vaultwarden requires it to be a local path. USER_ATTACHMENT_LIMIT (1000 MiB per user), ORG_ATTACHMENT_LIMIT (250 GiB per org), and USER_SEND_LIMIT (100 MiB per user) cap storage sizes. Diagnostic metrics are forwarded to Log Analytics.
  9. Application Deployment: Vaultwarden container deployed on App Service with VNet integration and DATABASE_URL configured

Post-Deployment

  1. Verify App Service health status
  2. Test application access via provided URL
  3. Configure custom domain (if required)
  4. Set up backup procedures
  5. Configure monitoring alerts

Monitoring and Operations

Key Metrics to Monitor

Log Queries (KQL)

Recent App Service Logs

AppServiceConsoleLogs
| where ResourceId contains "vaultwarden-dev-app"
| order by TimeGenerated desc
| take 100

Error Logs

AppServiceConsoleLogs
| where ResourceId contains "vaultwarden-dev-app"
| where ResultDescription contains "ERROR" or ResultDescription contains "error"
| order by TimeGenerated desc

HTTP Request Stats

AppServiceHTTPLogs
| where ResourceId contains "vaultwarden-dev-app"
| summarize count() by ScStatus

Backup and Disaster Recovery

Backup Strategy

  1. PostgreSQL Built-in Backup: Azure Database for PostgreSQL Flexible Server provides automated backups
    • Schedule: Continuous automated backups (snapshots + transaction logs)
    • Retention: 35 days (the service maximum), configured at deployment
    • Geo-redundancy: Enabled — backups are replicated to the Azure paired region (set at server creation, immutable)
    • Point-in-Time Restore: Restore to any second within the retention period
    • Setup: Automatically enabled on PostgreSQL Flexible Server at deployment
    • Operation: Fully automatic with no manual intervention required
  2. Manual Backups: Alternative option using pg_dump via Azure CLI or direct connection for logical backups
  3. Database Protection: Optional CanNotDelete lock prevents accidental PostgreSQL server deletion (enable via enablePostgresqlLock parameter)

Recovery Procedures

Point-in-Time Restore

  1. Access Azure Portal or use Azure CLI to initiate a point-in-time restore
  2. Select the restore point (any second within the retention period)
  3. A new PostgreSQL Flexible Server instance is created with the restored data
  4. Update the App Service DATABASE_URL to point to the new server (or swap DNS)
  5. Restart App Service if needed
  6. Verify data integrity

Manual Restore Process

  1. Stop the App Service to prevent new writes
  2. Restore the PostgreSQL database using point-in-time restore via Azure Portal or CLI
  3. Update connection settings if the restored server has a different endpoint
  4. Restart the App Service
  5. Verify data integrity and application functionality

Business Continuity

Backup Monitoring

Troubleshooting Guide

Common Issues

Container Won’t Start

Symptoms: Container keeps restarting Causes:

Resolution:

# Check App Service logs
az webapp log tail --name <app-name> --resource-group <rg-name>

# Check App Service status
az webapp show --name <app-name> --resource-group <rg-name>

Cannot Access Application

Symptoms: URL not responding Causes:

Resolution:

# Check ingress configuration
az webapp show --name <app-name> --resource-group <rg-name> --query "httpsOnly,hostNames"

# Verify container is running
az webapp log tail --name <app-name> --resource-group <rg-name>

PostgreSQL Connectivity Issues

Symptoms: Application errors related to database connection failures Causes:

Resolution:

  1. Verify PostgreSQL server status in Azure Portal
  2. Check VNet integration and subnet delegation settings
  3. Verify Private DNS Zone is linked to the VNet and resolving correctly
  4. Test connectivity from App Service using Kudu console ```bash

    Check PostgreSQL server status

    az postgres flexible-server show –name --resource-group

Verify DNS resolution from within the VNet

az webapp ssh –name --resource-group

Then from the SSH session: nslookup .postgres.database.azure.com

```

Security Hardening

Production Checklist

Compliance Considerations

Updates and Maintenance

Update Procedures

  1. Test updates in dev environment first
  2. Backup data before updating
  3. Update image tag in parameters file
  4. Redeploy template
  5. Verify application functionality
  6. Monitor for issues

Maintenance Windows

Additional Resources

Official Documentation

Community Resources

Support Channels