Blog Post

Azure Architecture Blog
8 MIN READ

Deploy PostgreSQL on Azure VMs with Azure NetApp Files: Production-Ready Infrastructure as Code

GeertVanTeylingen's avatar
Jan 15, 2026

PostgreSQL is a popular open‑source cloud database for modern web applications and AI/ML workloads, and deploying it on Azure VMs with high‑performance storage should be simple. In practice, however, using Azure NetApp Files requires many coordinated steps—from provisioning networking and storage to configuring NFS, installing and initializing PostgreSQL, and maintaining consistent, secure, and high‑performance environments across development, test, and production. To address this complexity, we’ve built production‑ready Infrastructure as Code templates that fully automate the deployment, from infrastructure setup to database initialization, ensuring PostgreSQL runs on high‑performance Azure NetApp Files storage from day one.

Table of Contents

Introduction

Why PostgreSQL on Azure NetApp Files?

Performance That Scales

Azure NetApp Files Service Levels

The Problem: Manual Deployment Complexity

What Teams Face Today

The Solution: Infrastructure as Code Templates

One Deployment, Three Workflows

Terraform (Declarative Infrastructure)

ARM Templates (Azure Native)

PowerShell (Script-Based Automation)

What Gets Deployed

Real-World Impact: From Hours to Minutes

Before: Manual Deployment

After: Automated Deployment

Key Features

Zero Manual Configuration

Security by Default

Production-Ready

Multi-Environment Support deployment capability

Deployment Flexible Deployable options

Getting Started

Prerequisites

Quick Start: Deploy in 5 Steps

Use Cases

Development & Testing

Production Workloads

AI/ML Workloads

Database Migrations

Future Considerations

Conclusion

Ready to get started?

Contribute

Learn more

Introduction

PostgreSQL is a leading open-source cloud database for web apps and AI/ML workloads. Deploying it on Azure VMs with high storage performance should be straightforward.

The challenge: Deploying PostgreSQL on Azure VMs with Azure NetApp Files involves multiple steps provisioning infrastructure, configuring storage, setting up NFS mounts, installing and initializing PostgreSQL, and ensuring consistent environments across development, testing, and production. Each step must meet strict security and performance standards, and manual processes increase the risk of errors and configuration drift.

The solution: We've created production-ready Infrastructure as Code (IaC) templates that automate the entire deployment, from networking to database initialization, ensuring your PostgreSQL data lives on high-performance Azure NetApp Files storage from day one.

Co-authors:

Why PostgreSQL on Azure NetApp Files?

Performance That Scales

Azure NetApp Files delivers consistent, sub-millisecond latency and high throughput exactly what database workloads demand. Unlike standard Azure disk storage, Azure NetApp Files provides:

  • Predictable Performance: No "noisy neighbor" issues or performance variability
  • Independent Scaling: Scale storage capacity and performance independently of compute
  • Enterprise Features: Built-in snapshots, cross-region replication, and backup integration

Azure NetApp Files Service Levels

Choose the right performance tier for your workload:

Service Level

Performance

Use Case

Standard

Up to 16 MiB/s per TB

Development, testing, low I/O workloads

Premium

Up to 64 MiB/s per TB

Production databases, moderate I/O

Ultra

Up to 128 MiB/s per TB

High-performance databases, analytics

Flexible

Independent throughput and capacity. Minimum 128 MiB/s per pool, scaling up to 5 × per TiB of pool size (Manual QoS only)

Ultimate flexibility and cost optimization, enabling customers to dial performance up or down independently of capacity.

The Storage Advantage

When PostgreSQL data directories live on Azure NetApp Files volumes, you get:

  • Faster I/O: Optimized for database workloads with consistent low latency
  • Instant Snapshots: Point-in-time recovery without impacting performance
  • Seamless Scaling: Grow storage without downtime or data migration
  • Cost Efficiency: Pay only for what you use with flexible service levels

The Problem: Manual Deployment Complexity

What Teams Face Today

Deploying PostgreSQL on Azure VMs with Azure NetApp Files typically involves:

  1. Infrastructure Provisioning (2-3 hours)
    ○      Create virtual networks and subnets
    ○      Provision VMs with appropriate sizing
    ○      Set up network security groups and routing
  2. Storage Configuration (1-2 hours)
    ○      Create Azure NetApp Files account, capacity pool, and volumes
    ○      Configure NFS export policies
    ○      Validate subnet delegations
  3. PostgreSQL Installation (1-2 hours)
    ○      Install PostgreSQL packages
    ○      Configure NFS client and mount Azure NetApp Files volumes
    ○      Initialize data directory on Azure NetApp Files storage
    ○      Configure PostgreSQL settings and security
  4. Database Setup (30-60 minutes)
    ○      Create databases and users
    ○      Configure authentication
    ○      Test connectivity and performance
  5. Repeat for Each Environment (multiply by 3-5 environments)

Total Time: 6-10 hours per environment, with high risk of configuration drift and human error.

The Solution: Infrastructure as Code Templates

One Deployment, Three Workflows

We've built comprehensive IaC templates that support your team's preferred workflow:

Terraform (Declarative Infrastructure)

Perfect for teams already using Terraform for multi-cloud or complex infrastructure.

module "postgresql_vm_Azure NetApp Files" {
source = "./terraform/db/postgresql-vm-Azure NetApp Files"

  postgresql_version        = "15"
postgresql_admin_password = var.pg_admin_password
database_name            = "production_db"
database_user            = "app_user"
database_password        = var.db_password

netapp_service_level = "Premium"
netapp_volume_size   = 500
}

ARM Templates (Azure Native)

Deploy directly from Azure Portal with the "Deploy to Azure" button, or integrate into Azure DevOps pipelines.

PowerShell (Script-Based Automation)

Ideal for Windows-centric teams or existing PowerShell automation frameworks.

What Gets Deployed

The templates provision a complete, production-ready PostgreSQL environment:

Networking Infrastructure

  • Virtual network with dedicated subnets for VMs and Azure NetApp Files
  • Network security groups with PostgreSQL and SSH access rules
  • Optional public IP for remote access

Azure NetApp Files Storage

  • Azure NetApp Files account and capacity pool
  • NFSv3 volume with optimized export policies
  • Automatic mount point configuration

PostgreSQL Database Server

  • Ubuntu 22.04 LTS VM with PostgreSQL 14, 15, or 16
  • Automated installation and configuration
  • Data directory initialized on Azure NetApp Files volume
  • Database and user creation
  • Security hardening (password authentication, network access)

Outputs & Validation

  • Connection strings and commands
  • Resource IDs for integration
  • Validation tests to confirm deployment

 

 

 

 

Real-World Impact: From Hours to Minutes

Before: Manual Deployment

Scenario: A development team needs a PostgreSQL database for a new microservice.

Timeline:

  • Day 1: Infrastructure team provisions VM and Azure NetApp Files(4 hours)
  • Day 2: Database team configures PostgreSQL (3 hours)
  • Day 3: Troubleshooting and validation (2 hours)
  • Total: 9 hours over 3 days

Risks:

  • Configuration inconsistencies between environments
  • Security misconfigurations
  • Performance issues discovered late in the process

After: Automated Deployment

Scenario: Same team, using IaC templates.

Timeline:

  • Hour 1: Review template parameters (15 minutes)
  • Hour 1: Deploy infrastructure (30 minutes)
  • Hour 1: Validate and hand off (15 minutes)
  • Total: 1 hour, same day

Benefits:

  • Consistent configuration across all environments
  • Security best practices built-in
  • Performance optimized from the start
  • Repeatable for future deployments

Key Features

Zero Manual Configuration

Everything is automated from VM provisioning to PostgreSQL initialization. No SSH sessions, no manual mount commands, no configuration file editing.

Security by Default

  • Network Security: NSG rules restrict access to PostgreSQL port (5432) and SSH (22) from authorized sources
  • Authentication: PostgreSQL configured with password-based authentication (md5) for secure access
  • Credential Management: All passwords handled securely via Azure Key Vault or secure parameters (no hardcoded credentials)
  • Network Isolation: Optional private-only deployment (no public IP) for enhanced security
  • Encryption: Azure NetApp Files volumes support encryption at rest with Azure-managed keys
  • Access Control: Least-privilege network security group rules and PostgreSQL user permissions

Production-Ready

  • PostgreSQL data directory on Azure NetApp Files for optimal performance
  • Proper service configuration and auto-start
  • Logging and monitoring hooks
  • Resource tagging for cost management

Multi-Environment Support deployment capability

Deploy the same template across development, test, staging, and production environments using environment‑specific parameters, ensuring consistency, repeatability, and reduced configuration drift.

Deployment Flexible Deployable options

Choose between Terraform, ARM templates, or PowerShell based on your team’s expertise and existing tooling, enabling faster adoption and seamless integration with current workflows.

Getting Started

Prerequisites

  • Azure subscription with Azure NetApp Files enabled
  • Appropriate permissions (Contributor role or equivalent)
  • Terraform 1.0+ (if using Terraform)
  • Azure PowerShell modules (if using PowerShell)

Quick Start: Deploy in 5 Steps

Clone the Repository

git clone https://github.com/NetApp/azure-netapp-files-storage.git
cd azure-netapp-files-storage
  1. Choose Your Tool
    ○      Terraform: terraform/db/postgresql-vm-Azure NetApp Files/
    ○      ARM Template: arm-templates/db/postgresql-vm-Azure NetApp Files/
    ○      PowerShell: powershell/db/postgresql-vm-Azure NetApp Files/
  1. Configure Parameters
    ○      PostgreSQL version (14, 15, or 16)
    ○      Database name and credentials
    ○      Azure NetApp Files service level and volume size
    ○      VM size and networking options
  1. Deploy
    ○      Terraform: terraform apply
    ○      ARM: Use "Deploy to Azure" button or az deployment group create
    ○      PowerShell: ./deploy-postgresql-vm-Azure NetApp Files.ps1
  1. PostgreSQL Command
    ○      psql -h <vm_ip> -p 5432 -U appuser -d mydb

Use Cases

The following sections will explore key scenarios for deploying PostgreSQL on Azure NetApp Files, focusing on both development and production environments. We'll highlight how these solutions address technical and economic requirements for rapid testing, operational consistency, and scaling with enterprise-grade storage. Each section outlines the practical benefits and considerations to help you choose the best approach for your specific workload needs.

Development & Testing

Spin up isolated PostgreSQL environments for feature development, functional testing, and CI/CD pipelines using infrastructure‑as‑code. Each environment remains consistent with production in terms of storage performance, security posture, and configuration, reducing “works‑in‑dev but not in‑prod” issues.

Technical benefits

  • Rapid environment provisioning using reusable templates.
  • Production‑like storage performance for realistic testing.
  • Instant cloning and snapshots for fast resets and parallel testing.
  • Isolated environments to safely test schema changes and new features.

Economic benefits

  • Pay only while in use tear down environments when tests complete
  • Lower storage amplification using snapshots and writable clones
  • Reduced defect leakage lowers remediation costs later in production

Production Workloads

Deploy mission‑critical PostgreSQL databases on Azure NetApp Files with confidence, backed by predictable performance, enterprise security, and operational consistency across environments. Infrastructure templates ensure every deployment follows best practices by design.

Technical benefits

  • High throughput and low latency storage for sustained production loads
  • Built‑in snapshot and backup capabilities for fast recovery
  • Consistent infrastructure, networking, and security configurations
  • Seamless scaling to meet growing data and transaction demands

Economic benefits

  • Optimized price‑performance through right‑sized service levels
  • Reduced operational overhead via automated, repeatable deployments
  • Minimized downtime risk, protecting revenue and SLAs

AI/ML Workloads

PostgreSQL on Azure NetApp Files enables data‑intensive AI/ML workloads, including feature stores and vector databases. The templates can be easily extended to support pgvector for vector similarity search used in retrieval‑augmented generation (RAG) and recommendation systems.

Technical benefits

  • High I/O throughput to handle embeddings, feature extraction, and training data
  • Low latency access for inference‑time similarity searches
  • Scalable architecture that supports growing AI datasets
  • Native integration with Azure AI and analytics services

Economic benefits

  • Avoids costly data duplication across multiple systems
  • Scales storage and performance independently as AI workloads evolve
  • Accelerates model experimentation, reducing time‑to‑value

Database Migrations

Use Azure NetApp Files‑backed PostgreSQL as a high‑performance migration target, enabling safe, low‑risk database modernization. Snapshot‑based workflows allow fast rollback and validation during migration phases.

Technical benefits

  • High throughput speeds up bulk data transfers and cutovers
  • Snapshot‑based rollback enables safer migration iterations
  • Consistent performance during testing, validation, and production switchover

Supports phased migrations with minimal service interruption

Economic benefits

  • Reduced downtime lowers business disruption costs
  • Faster migrations shorten project timelines and labor spend
  • Built‑in rollback reduces risk of expensive recovery scenarios

Future Considerations

For high availability and backup requirements, consider:

Conclusion

Deploying PostgreSQL on Azure VMs with Azure NetApp Files doesn't have to be a multi-day, error-prone process. With these Infrastructure as Code templates, you can provision a production-ready database environment in minutes, not hours with consistency, security, and performance built in.

Whether you're a DevOps engineer automating infrastructure, a database administrator standardizing deployment, or a developer needing a quick database instance, these templates remove the complexity and let you focus on what matters: building great applications.

Ready to get started?

Head to the GitHub repository and deploy your first PostgreSQL instance on AZURE NETAPP FILES today.

Have questions or feedback? Reach out to us at 1P_ProductGrowth@netapp.com or open an issue on GitHub.

Contribute

We welcome contributions! Found a bug? Have a feature request? Open an issue or submit a pull request on GitHub.

Learn more

Updated Jan 15, 2026
Version 1.0
No CommentsBe the first to comment