Back to Skills

azure-nodejs-production

verified

Configure Express/Node.js applications for production deployment on Azure. Covers trust proxy settings, cookie configuration, health checks, port binding, and Dockerfile best practices for Container Apps and App Service.

View on GitHub

Marketplace

github-copilot-for-azure

microsoft/GitHub-Copilot-for-Azure

Plugin

azure

Repository
Verified Org

microsoft/GitHub-Copilot-for-Azure
102stars

plugin/skills/azure-nodejs-production/SKILL.md

Last Verified

February 1, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/main/plugin/skills/azure-nodejs-production/SKILL.md -a claude-code --skill azure-nodejs-production

Installation paths:

Claude
.claude/skills/azure-nodejs-production/
Powered by add-skill CLI

Instructions

# Express/Node.js Production Configuration for Azure

## Overview

When deploying Express/Node.js apps to Azure (Container Apps, App Service), you MUST configure production settings that aren't needed locally.

## Required Production Settings

### 1. Trust Proxy (CRITICAL)

Azure load balancers and reverse proxies sit in front of your app. Without trust proxy, you'll get:
- Wrong client IP addresses
- HTTPS detection failures
- Cookie issues

```javascript
// app.js or server.js
const app = express();

// REQUIRED for Azure - trust the Azure load balancer
app.set('trust proxy', 1);  // Trust first proxy

// Or trust all proxies (less secure but simpler)
app.set('trust proxy', true);
```

### 2. Cookie Configuration

Azure's infrastructure requires specific cookie settings:

```javascript
// Session configuration
app.use(session({
  secret: process.env.SESSION_SECRET,
  resave: false,
  saveUninitialized: false,
  cookie: {
    secure: process.env.NODE_ENV === 'production',  // HTTPS only in prod
    sameSite: 'lax',  // Required for Azure
    httpOnly: true,
    maxAge: 24 * 60 * 60 * 1000  // 24 hours
  }
}));
```

**Key settings:**
- `sameSite: 'lax'` - Required for cookies to work through Azure's proxy
- `secure: true` - Only in production (HTTPS)
- `httpOnly: true` - Prevent XSS attacks

### 3. Health Check Endpoint

Azure Container Apps and App Service check your app's health:

```javascript
// Add health check endpoint
app.get('/health', (req, res) => {
  res.status(200).json({ status: 'healthy', timestamp: new Date().toISOString() });
});

// Or minimal version
app.get('/health', (req, res) => res.sendStatus(200));
```

**Configure in Container Apps:**
```bash
az containerapp update \
  --name APP \
  --resource-group RG \
  --health-probe-path /health \
  --health-probe-interval 30
```

### 4. Port Configuration

Azure sets the port via environment variable:

```javascript
// Listen on Azure's port or default to 3000
const port = process.env.PORT || process.

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
6977 chars