The Simplest Way to Make Azure App Service and Pulumi Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use azure app service and pulumi to build and ship web apps with code. Pulumi writes the cloud setup, while Azure App Service runs the live web app. This pair lets developers manage web hosts, custom domains, and scaling rules in one place. You write your setup in familiar languages like TypeScript, Python, or Go. Then Pulumi talks to the Azure API to create and update your web app resources. How permissions and data flow in azure app service and pulumi A clean setup starts with how Pu

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams use azure app service and pulumi to build and ship web apps with code. Pulumi writes the cloud setup, while Azure App Service runs the live web app.

This pair lets developers manage web hosts, custom domains, and scaling rules in one place. You write your setup in familiar languages like TypeScript, Python, or Go. Then Pulumi talks to the Azure API to create and update your web app resources.

How permissions and data flow in azure app service and pulumi

A clean setup starts with how Pulumi logs in to your Azure account. Pulumi needs an identity in Microsoft Entra ID to make changes on your behalf. In local tests, developers often log in with their own user accounts. In a build pipeline, Pulumi uses a service principal or a managed identity.

Once Pulumi logs in, it reads your code and compares it to your live cloud. It sends requests to the Azure Resource Manager API to create the app plan. After the plan exists, Pulumi creates the web app and sets up its runtime settings.

Your web app also needs a way to talk to databases and storage accounts. You should use Pulumi to turn on a system-assigned managed identity for the web app. Pulumi then grants that identity the exact role it needs on the target database. This flow keeps raw database keys out of your app settings and source code.

State files hold the map between your Pulumi code and your real Azure resources. Store this state in a locked Azure Blob Storage container or the Pulumi Cloud backend. Encrypt the state store so no one can read secret values in plain text.

Common failure modes and how to scope roles

Many teams fail by giving the Pulumi service principal full owner rights over the subscription. A broad token like that can delete every resource if a script has a bug. Instead, scope the Pulumi role to a single resource group for that one project.

Shared service accounts are another common trap in busy engineering teams. When five people share one cloud key, your audit logs cannot show who changed what. Give each developer their own identity for local previews and lock prod changes to pipelines.

Service-to-Service Authentication + Azure RBAC: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Unlogged database queries and open network paths also create big risks after deployment. By default, a new web app sits on the public network and accepts all traffic. Use Pulumi to put the web app inside a virtual network with private endpoints. This rule ensures your app talks to backend data stores over private cloud wires.

Watch out for config drift when someone edits settings in the Azure web portal. Manual clicks break the link between your Pulumi state and the live web app. Lock your prod resource groups to read-only for humans so all changes go through code. Also, mask sensitive fields like emails, phone numbers, card numbers, and national IDs in results.

Managing secrets and app settings across stacks

Web apps need connection strings, API keys, and flags to run in production. Never put plain text secrets into your Pulumi stack files or git repos. Use Pulumi secret types so the tool encrypts the value before saving the state.

A better pattern stores runtime secrets inside Azure Key Vault instead of app settings. Pulumi can create the vault, write the secret, and link it to the web app. The web app then reads the secret at boot time using its managed identity.

Split your cloud setup into separate stacks for dev, staging, and prod workloads. Keep your base network and data stores in one stack that changes very rarely. Put the web app in a second stack that reads outputs from the base stack. This split stops a simple web app update from touching your core database setup.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Should I use the classic Azure provider or the Azure Native provider in Pulumi?

Use the Azure Native provider for new projects because it maps directly to Azure APIs. It gives you same-day support for new features on your web apps.

How do I stop app downtime when Pulumi updates my web app settings?

Create deployment slots in Pulumi to stage your changes before they go live. Pulumi updates the staging slot first, warms up the app, and swaps it into production.

Where should Pulumi store its state file when working with Azure?

You can use the managed Pulumi Cloud service or an Azure Blob Storage container. If you use Azure storage, turn on blob versioning and lock access with Entra ID.

The query runs. The emails stay hidden.