Deploying Medplum on Azure with Terraform and AKS

A self-hosted Medplum deployment on Azure uses Terraform for the network and managed services, AKS for the app, and Helm for the release. This page covers the decisions, setup sequence and limits to confirm before you build it.

On this page

Deploying Medplum on Azure with Terraform and AKS: when this path fits

Choose the Azure path when a health organization or platform team must run Medplum inside its own Azure subscription and already operates Azure as its primary cloud. Medplum's self-hosting docs list a Terraform-based Azure deployment, but they mark it Beta, so treat it as a starting blueprint that your team validates and hardens rather than a finished production product. The Azure layout spans virtual networking, Azure Kubernetes Service (AKS) for the Medplum application, Azure Database for PostgreSQL, Azure storage with a CDN in front of it, Redis for caching, an Application Gateway for ingress, Azure Key Vault for configuration secrets, and a Helm chart that deploys the app onto the cluster. Each of these is a service your team will own after handover, so the decision is as much about who will operate them as about who builds them.

Compare Azure against the other paths before committing. The AWS path uses CDK and is the recommended option in the same docs, so teams with no Azure footprint or existing AWS skills usually have less to justify there. Teams that already run Kubernetes on another cloud or on their own hardware may prefer the generic Kubernetes Helm chart and bring their own managed database and object storage. A single-server install on Ubuntu fits small, low-load deployments where a full cluster would add more operational weight than value. Confirm with your Azure architects whether your subscription, region and policy controls match the networking and private endpoint design the Terraform modules assume.

How the Azure components connect for a self-hosted Medplum

The diagram starts with users reaching Medplum through Application Gateway at the edge of the virtual network. Traffic passes to the Medplum Helm release running on AKS, which talks to Azure Database for PostgreSQL for FHIR data and to Redis for caching. Binary files are served from Storage through a CDN, and Key Vault supplies configuration secrets to the workloads. Terraform provisions the network and managed services in one pass. Check that every managed service sits on private endpoints inside the trust boundary, and confirm each secret path with your own security team before go-live.

Request flow and provisioning for a self-hosted Medplum on Azure, with the virtual network as the trust boundary.

Which Azure layout fits your team

Medplum's Azure deployment is marked Beta in its self-hosting documentation, and it is a Terraform reference layout that provisions networking, AKS, Azure Database for PostgreSQL, storage, CDN, Redis, Application Gateway and Key Vault together. Starting from it gives your team a working baseline to read, test and adapt, rather than a blank module to design from zero.

  • Ownership: Your team owns the cloud account, the state backend, the resource names and every change Terraform makes after the first apply.
  • Upgrades: Medplum server upgrades still have to pass through each minor version in sequence, so the Terraform layout does not remove that work.
  • Audit evidence: Terraform plans, version-controlled variable files and the Key Vault access logs become your change records, so review them as part of the baseline.
  • Beta status: Confirm with Medplum which parts of the reference layout you plan to keep unchanged before you rely on it for a regulated workload.
  • Drift: Changes made in the portal outside Terraform will drift from the code, so set a rule that all changes go through the repository.

Before adopting it, read the module source line by line and confirm each resource against your own network and retention policies.

How the Azure install is sequenced

The sequence moves from confirming the Medplum release and upgrade path to a verified running instance, with each layer built and checked before the next depends on it. Terraform creates the Azure foundation, the Helm chart runs the application on top, and the checks at each step show where a problem sits before it reaches production.

  1. Confirm the Medplum release and upgrade path

    Before any Azure resource is created, the team picks the Medplum version to deploy and confirms it against the release history and the versioning policy. If the target is not the latest release, the team writes down every minor version between the current and target versions, because self-hosted Medplum must be upgraded through each minor version in sequence. Skipping versions causes startup failures. Done when the team has a signed-off target version and an ordered list of versions to pass through, and they can point to the release notes for each one.

  2. Set up the Azure subscription and Terraform identity

    The cloud or platform team creates or selects a dedicated Azure subscription for the Medplum environment, then creates a identity Terraform will use, with role assignments limited to the resource groups it manages. Remote state storage is set up before the first apply so the state file is not kept on an engineer's laptop. Done when a plan runs cleanly against an empty resource group and the team can show who holds which role.

  3. Provision networking and private endpoints

    Terraform creates the virtual network, subnets for the AKS nodes, the database, Redis and the Application Gateway, and private endpoints for PostgreSQL, Redis, storage and Key Vault. Network rules keep data services off the public internet. Done when a plan shows the expected subnets and private DNS zones, and a test resource in the node subnet can resolve the private endpoint names. Confirm the address ranges with your network team before apply, since changing them later is disruptive.

  4. Create AKS, PostgreSQL, Redis and storage

    Terraform provisions the AKS cluster, Azure Database for PostgreSQL, Redis, the storage account for binary data, and the CDN where the Beta module uses it. The team checks the Medplum database settings and sizing against the Medplum documentation for the chosen version. Done when the cluster reports ready nodes, the database accepts connections from inside the node subnet only, and the storage account rejects anonymous access. Record the outputs so the Helm values can reference them.

  5. Load configuration secrets into Key Vault

    The team writes the Medplum server configuration secrets, including database credentials, Redis access details and signing keys, into Key Vault rather than into Helm values files or source control. The AKS cluster reads them through the Key Vault integration with a workload identity that has read-only access to those secrets. Done when a test pod in the Medplum namespace reads one secret through its identity, and a manual check of the Helm values files finds no plaintext credentials.

  6. Configure Application Gateway and TLS

    The Application Gateway is set up in front of the AKS ingress with a certificate for the public Medplum hostnames, and the backend pool points at the ingress controller. Health probes are set to the Medplum health endpoint for the server. Done when the gateway returns a valid certificate chain for each hostname, the backend probe shows healthy, and plain HTTP redirects to HTTPS. Confirm the certificate source and renewal process with your security team before go-live.

  7. Install the Helm chart and verify the deployment

    The team installs the Medplum Helm chart at the target version with values that reference the Key Vault secrets, the private database and Redis endpoints, and the public base URLs. Pods are checked for readiness and logs are reviewed for startup errors. Then the team verifies three things: the health endpoint responds through the gateway, a test user can sign in through the configured identity flow, and a test invitation or password reset email arrives from the configured sender. Done when all three checks pass and the results are written into the change record.

Security decisions in an Azure Medplum deployment

An Azure Medplum deployment has several security decisions that sit across Terraform, AKS and the application itself. Secret handling, cluster access, network placement, sign-in and compliance responsibilities each need an owner before the first deploy.

Key Vault secret handling

Medplum configuration secrets such as database credentials and signing keys should live in Azure Key Vault, not in values.yaml or Terraform state committed to a repository. Decide who can read each secret, how the Kubernetes workload receives it, and how rotation is performed. Check that Terraform state holding any generated values is stored with restricted access.

Secrets good practices

Kubernetes secrets stored unencrypted

Kubernetes stores Secrets unencrypted in etcd by default. If Medplum configuration is copied into native Kubernetes Secrets, anyone with read access to etcd backups can recover it. Confirm that encryption at rest is enabled for the AKS cluster, or keep the authoritative copy in Key Vault and sync only what the pods need.

Least-privilege RBAC for secret access

Restrict list and watch permissions on Secrets to the namespaces and service accounts that need them. Listing Secrets exposes every value in a namespace, so a broad cluster role can leak credentials even when individual objects are well protected. Review role bindings for the Medplum namespace and remove wildcard verbs from operator and CI identities.

Pod Security Standards

Apply the restricted Pod Security Standard to the namespace that runs the Medplum server so containers run without privilege escalation and with restricted volume types. Confirm the Helm chart's security context settings satisfy the profile before enforcing it. Test in audit or warn mode first so a failed admission does not block a release during an upgrade.

Pod Security Standards

Private networking for database and cache

PostgreSQL and Redis should be reachable only from the AKS subnet through private endpoints or private access, with no public network exposure. Application Gateway should be the only public entry point. Verify the network rules in Terraform with a plan review, and confirm that the database firewall does not allow broad address ranges.

Identity provider and MFA choices

Medplum supports its own identity provider, external providers such as Google, Auth0 or AWS Cognito, and domain-level corporate identity providers. Decide which option governs clinician and administrator sign-in, whether MFA is enforced, and how client credentials are issued for server-to-server access. Multiple external identity providers are listed as an enterprise feature, so confirm entitlement before you design around it.

Medplum authentication docs

Shared responsibility for compliance controls

Medplum's compliance documentation states that compliance is a shared responsibility between Medplum and its customers. In a self-hosted Azure deployment, your team owns the Azure subscription, cluster, network, backups and access reviews. Map each HIPAA or other framework control to an owner and evidence source before an assessor asks for it.

Medplum compliance docs

Keeping the Azure stack upgradable and recoverable

The Azure stack has three upgrade tracks that move at different speeds, and the order matters. The Kubernetes version skew policy requires the kube-apiserver to be upgraded one minor version at a time, before kube-controller-manager, kube-scheduler and kubelets, and kubelets may run up to three minor versions behind the API server. In practice, AKS control plane upgrades and node pool upgrades should be planned as separate steps, with the node pools following the control plane within the skew window. Medplum adds a stricter rule on top: a self-hosted Medplum server must be stepped through each minor version in sequence, because skipping versions causes startup failures. Confirm the Medplum minor version you are on, the Kubernetes version your chart and images were tested against, and the next Medplum step before you touch the cluster. Keep the Terraform state and the Helm values in version control so each step is reproducible.

Recovery depends on two backups that the Azure resources do not give you automatically in the way the application needs. The first is etcd. AKS manages the etcd cluster for you, so your responsibility is to confirm what Azure backs up, how you could restore it, and what you would still need to rebuild from your Terraform and Helm sources. The second is the Medplum data in Azure Database for PostgreSQL, where point-in-time restore and retention settings need to be checked against your recovery objectives. Long post-deploy data migrations on large datasets can run for hours or days, so a rollback after a failed migration may mean restoring the database rather than redeploying the app. Assign one owner for AKS upgrades, one for database backups and restores, and one for the patch window, and write down who approves each step.

Medplum's policy targets security patches within 7 days for critical vulnerabilities (CVSS 9.0 or higher) and within 14 days for high ones (CVSS 7.0 to 8.9). Those targets only help you if your own cadence can meet them. A monthly patch window works for routine Kubernetes and node image updates, but a critical Medplum or dependency patch may need an out-of-cycle change, which requires a tested path through the minor version sequence. Decide in advance which changes you will fast-track, who can approve them and how you will test them in a non-production cluster first. Ask your partner or internal team to document the current versions of AKS, the Medplum chart and images, PostgreSQL and Redis, so the next upgrade starts from a known state.

Limits to confirm before you commit to Azure

The Azure path for Medplum is still marked Beta, so several parts of the design depend on facts that change outside this page. Confirm each item below in your own environment and with Medplum before you sign a scope or start the Terraform build.

Beta status and Terraform module state

Medplum lists its Terraform-based Azure deployment as Beta in its self-hosting documentation. Ask Medplum which Terraform modules and Helm chart versions are current, which of them are tested against the Medplum release you plan to run, and what support they offer for the Beta path. Record the exact module versions in your scope so the build can be reproduced and reviewed later.

Self-hosting docs

Regional service and SKU availability

AKS node sizes, PostgreSQL flexible server tiers, Redis tiers, Application Gateway SKUs and CDN options do not all exist in every Azure region. Check the regions and SKUs your data residency rules allow against the Terraform variables you intend to use, and confirm quota for vCPUs and public IP addresses before the first apply. Missing quota often surfaces late in a build.

Binary storage and presigned URL keys

Documents, images and other binaries are served through presigned URLs, which depend on signing keys. Confirm where the signing keys are generated, how they are stored in Key Vault, how they rotate, and who can read them. Medplum's guidance on temporary keys applies outside development, so confirm that your deployment does not rely on them.

Email sender and domain setup

Invites, password resets and MFA codes depend on a working sender for your domain. Azure does not provide a managed email service in the same way AWS SES does for this path, so confirm which SMTP relay or provider you will use, who controls the sending domain, and how SPF, DKIM and DMARC records are published. Test delivery to your real user mailboxes before go-live.

Compliance evidence from the Azure layer

Medplum states that compliance is a shared responsibility between Medplum and its customers. Ask your auditor which evidence they need from the Azure layer, such as network flow logs, Key Vault access logs, PostgreSQL audit settings, backup retention and AKS role assignments. Confirm which Azure controls you can evidence directly and which depend on Medplum's own documentation.

Medplum compliance docs

Kubernetes version and upgrade path

AKS clusters move through supported Kubernetes minor versions, and Medplum upgrades must follow its own minor version sequence. Confirm which Kubernetes version your AKS region offers and how long it stays supported, and plan cluster upgrades alongside Medplum upgrades so the two do not collide in the same window.

Questions buyers ask before deploying Medplum on Azure

What drives the cost of deploying Medplum on Azure?

Cost comes from three places: the Azure resources the deployment runs on, the people who build and operate it, and any partner fees. The Azure bill covers AKS nodes, Azure Database for PostgreSQL, storage, CDN, Redis, Application Gateway and Key Vault, and it recurs every month. The largest variables are database and node sizing, which depend on your expected record volume, concurrent users and availability target, plus how many environments (development, test, production) you run. Engineering effort is mostly one-time, covering networking, Terraform modules, identity and validation, but ongoing operations recur. Ask any quote to split one-time build work from recurring support and to list every Azure service it assumes.

Can our team deploy Medplum on Azure without a partner?

Yes, if your team has working Azure, Terraform and Kubernetes skills and time to own the result. Medplum's Azure deployment is marked Beta in its self-hosting documentation, so your engineers should read the Terraform and Helm code closely before relying on it. The skills that matter most are Azure networking and identity, AKS administration, PostgreSQL operations and secrets handling. A partner can shorten the path, mainly through a written scope and independent review, but the choice depends on whether you can staff those skills for the life of the system, not only the first deployment.

How long does an Azure Medplum deployment take, and what sets that?

No duration is supplied for this work, so confirm any timeline against your own environment rather than a generic figure. The main variables are how many Azure subscriptions and landing zone controls already exist, whether your DNS zone, certificates and email sending domain are ready, how your identity provider is configured, and how many environments you need. Compliance evidence, clinical sign-off and the first data load usually take longer than the infrastructure build. Ask for a milestone plan with dependencies on your side listed separately.

What does the client need to provide for an Azure Medplum deployment?

Plan for four groups of input before work starts. First, Azure subscription owners must create or approve the subscription, role assignments and policy exceptions the Terraform will need. Second, DNS administrators must delegate or create the zones for the application and API hostnames and approve certificate issuance. Third, identity owners must choose the sign-in model, whether Medplum itself, an external provider or a corporate identity provider, and supply the app registrations or claims. Fourth, clinical and compliance leads must sign off on data scope, access roles and validation evidence. Missing any of these is the most common cause of delay.

Is Medplum Cloud cheaper to run than a self-hosted Azure deployment?

It depends on your scale, your staffing and your compliance model, so compare total cost rather than the subscription price. Medplum's published hosted plans are Free, Production at $2,000 per month, Premium at $6,000 per month and custom-priced Enterprise, according to its pricing page. Those plans include a standard BAA and MSA. A self-hosted Azure deployment shifts cost to your Azure bill, your engineers and your own compliance evidence, and Medplum states that compliance is a shared responsibility. Build a comparison that includes Azure resources, staff time for operations, and the cost of controls your auditors expect, then set it against the hosted plan you would actually buy.

How are Medplum upgrades handled on a self-hosted Azure deployment?

You plan and run them yourself, one minor version at a time. Medplum's upgrade guide says self-hosted servers must pass through each minor version in sequence, because skipping versions causes startup failures, and post-deploy data migrations can run for hours or days on large datasets. Medplum ships major versions annually, minor versions two to three times a year and patches weekly, and its policy targets fixes for critical vulnerabilities within 7 days. On AKS, the Kubernetes upgrade order also matters: kube-apiserver goes first, and kubelets may lag by up to three minor versions. Ask for a written upgrade runbook with rollback windows and a test environment that matches production.

What breaks most often in an AKS-based Medplum install, and how do we check for it?

The most common failures are configuration drift between Terraform state and the running cluster, missing secrets in Key Vault, incorrect base URLs and certificates, and database connection or sizing problems. Kubernetes stores Secrets unencrypted in etcd by default, so confirm that your AKS secret encryption and Key Vault integration are set up as intended and that RBAC limits who can list or watch secrets. Verify each layer after deploy: network reachability through Application Gateway, health of the Helm release, database connectivity, Redis, storage access and email delivery. Keep these checks in code so they run again after every change.

How DeployOpen scopes an Azure Medplum deployment

Before any Azure work starts, DeployOpen agrees the scope in writing, including which parts of the Medplum Azure Terraform stack it will plan, implement, harden, back up, upgrade and document, and which parts your team keeps. DeployOpen plans, implements, hardens, backs up, upgrades and documents self-hosted open-source platforms inside your own infrastructure, so the Azure subscription, the resource groups, the AKS cluster, the Azure Database for PostgreSQL instance, the storage account, the CDN profile, the Redis cache, the Application Gateway and the Key Vault all sit in your tenant under your control. The written scope names the environments, the Terraform state location, the owners of each Key Vault secret and the Helm release that runs the app. Engagements are fixed-scope, so the deliverables and timelines are agreed before work starts rather than adjusted informally as the build proceeds.

Scoping an Azure build is mostly a set of ownership decisions. Ask who holds Azure administrator rights, who approves Terraform plans, who rotates secrets in Key Vault, who reviews Kubernetes RBAC, and who responds when the Medplum release cadence requires an upgrade. Because Medplum is Beta on Azure, confirm with Medplum which Terraform modules and Helm chart versions are current on the day you scope, and record the versions in the statement of work so the upgrade path is explicit. Ask for a quote that separates one-time build work from recurring operation, and make sure the Kubernetes version skew and upgrade plan for AKS is part of the written deliverables.

DeployOpen also prepares systems, controls and evidence for compliance assessments, such as configuration records, access reviews, backup evidence and change logs that your compliance team may need. It does not issue audit reports, attestations or certifications. Those come from independent auditors and certification bodies, so the scope should say which evidence DeployOpen produces, in what form, and which assessment it will feed. Medplum's compliance documentation notes that compliance is a shared responsibility between Medplum and its customers, and that split should be written down before the first Terraform plan runs.

How DeployOpen works on this

DeployOpen plans, implements, hardens, documents and supports self-hosted open-source platforms inside the client's own Azure subscriptions. For a Medplum deployment on Azure with Terraform and AKS, the work starts with a written scope that defines the environments, network layout, data services and handover items before any infrastructure is created.

How we scope

  • Confirm the Azure subscriptions, regions, and network ranges that Terraform will manage for the Medplum environments.
  • Agree in writing which Medplum version, Helm chart values, and Azure data services are in scope.
  • Record decisions on email delivery, binary storage, branding, and identity providers before the build begins.

How we build

  • Write Terraform for networking, AKS, PostgreSQL, storage, CDN, Redis, Application Gateway, and Key Vault in your environment.
  • Deploy the Medplum Helm chart to AKS, then test sign-in, FHIR API access, and binary storage behavior end to end.
  • Verify private networking, secret handling, and Kubernetes access controls against the scope before handover.

How we hand over

  • Provide the Terraform modules, Helm values, and configuration records under your own source control.
  • Document the Medplum upgrade sequence, including the requirement to move through each minor version in order.
  • Walk your platform, security, and compliance teams through the runbook, backups, and restore steps.

How we support

  • Offer ongoing support, upgrades, and continuous testing as a retainer after the fixed-scope engagement closes.
  • Plan Medplum upgrades and Azure service changes as written change work with agreed test and rollback steps.
  • Confirm with your team which compliance evidence DeployOpen prepares, since independent auditors issue any attestations.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.