Blog Post

Apps on Azure Blog
5 MIN READ

🦞 Deploy OpenClaw to Azure Container Apps: Your 24/7 AI Assistant in 30 Minutes

dbandaru's avatar
dbandaru
Icon for Microsoft rankMicrosoft
Jan 29, 2026

OpenClaw is an open-source personal AI assistant that runs 24/7 and communicates through Discord, Telegram, WhatsApp, and more. This guide shows you how to deploy it on Azure Container Apps with a single command (azd up), with built-in security features.

πŸš€ The Quick Version: Create a Discord bot, clone the repo, run azd up, invite bot to server, start chatting. Total time: ~25 minutes. Total cost: ~$40-60/month.

Why Azure Container Apps over other options?

  • βœ… Managed Identity - No credentials in config files
  • βœ… Built-in Secrets - API keys never exposed in logs
  • βœ… Automatic HTTPS - Free TLS certificates
  • βœ… Hyper-V Isolation - Hardware-level container security
  • βœ… Compliance Ready - SOC2, ISO, HIPAA certifications

What is OpenClaw?

If you've ever wanted a personal AI assistant that actually does things - not just answers questions - OpenClaw is for you. Created by Peter Steinberger and a growing open-source community, OpenClaw is a personal AI assistant that:

CapabilityDescription
Runs 24/7On your own infrastructure, always available
Multi-channelTelegram, Discord, WhatsApp, Slack, iMessage, and more
Persistent memoryRemembers your preferences and context across sessions
Task executionAutonomously clears inboxes, deploys code, manages files
Skill learningCreates reusable "skills" that you teach it

πŸ’‘ Think of it as: A very capable coworker who never sleeps, works and gets better over time.

 


Why Azure Container Apps?

The original setup guide for OpenClaw uses AWS EC2, but Azure Container Apps offers significant advantages for running a 24/7 AI assistant - especially around security.


The 30-Minute Setup

Prerequisites

Before you start, you'll need:

RequirementLink
βœ… Azure subscriptionFree tier works for testing
βœ… Azure CLIInstall here
βœ… Azure Developer CLI (azd)Install here
βœ… OpenRouter API Keyopenrouter.ai/keys (recommended)
βœ… Discord AccountFor bot creation

πŸ’‘ Why OpenRouter? OpenRouter provides access to multiple AI models (Claude, GPT-4, Gemini) through a single API. For the simplicity for this demo we are using OpenRouter.


Step 0: Create Discord Bot

⚠️ Important: Do this before running azd up - you'll need the bot token during deployment.

StepAction
1Go to Discord Developer Portal
2Click New Application β†’ Name it (e.g., "OpenClaw-Azure")
3Go to Bot β†’ Click Add Bot
4Enable Privileged Gateway Intents: Message Content βœ…, Server Members βœ…
5Click Reset Token β†’ Copy the bot token (save it securely!)
6Go to OAuth2 β†’ URL Generator
7Select Scopes: bot, applications.commands
8Select Permissions: Send Messages, Read Message History, View Channels
9Copy the generated OAuth2 URL (you'll need this to invite the bot)

Get Your Discord User ID:

StepAction
1In Discord: Settings β†’ Advanced β†’ Enable Developer Mode
2Right-click your username β†’ Copy User ID

Security Note: The Discord User ID is used for the DM allowlist. Only users in this list can message your bot directly.


Step 1: Clone the Repo

Clone the deployment template:

git clone https://github.com/BandaruDheeraj/moltbot-azure-container-apps
cd moltbot-azure-container-apps

Step 2: Deploy to Azure

Run the initial provisioning:

azd provision

You'll be prompted for:

PromptWhat to Enter
Environment nameOpenClaw-prod
Azure subscriptionSelect from your list
Azure locationeastus2 (recommended)

Note: azd provision creates the Azure infrastructure without deploying the app. We need to build the image first.

This creates:

StepWhat Happens
Step 1:Creates a Resource Group
Step 2:Deploys Azure Container Registry
Step 3:Sets up Azure Storage for persistent data
Step 4:Creates a Container Apps Environment
Step 5:Configures Log Analytics for monitoring

Build Container Image

⚠️ This must be done before deploying the app. The container image needs to exist in ACR before the Container App can pull it.

# Get your ACR name from the provisioned resources
ACR_NAME=$(az acr list --resource-group rg-OpenClaw-prod --query "[0].name" -o tsv)

# Build the image in Azure Container Registry (no local Docker needed!)
az acr build --registry $ACR_NAME --image "OpenClaw:latest" --file src/OpenClaw/Dockerfile src/OpenClaw/

Understanding this command:

PartWhat It Does
--registry $ACR_NAMEBuild in your Azure Container Registry (in the cloud)
--image "OpenClaw:latest"Name the output image OpenClaw:latest (we choose this name)
--file src/OpenClaw/DockerfileUse the Dockerfile from our sample repo
src/OpenClaw/Send this folder as the build context

πŸ’‘ What happens during the build? The Dockerfile in our sample (at src/OpenClaw/Dockerfile) automatically:

  1. Starts from a Node.js base image
  2. Clones the official OpenClaw source code from GitHub
  3. Installs dependencies with pnpm
  4. Builds the TypeScript application
  5. Builds the Control UI
  6. Adds our custom entrypoint.sh that generates config from Azure environment variables

You don't need to download OpenClaw separately - it's pulled fresh from GitHub during the ACR build. The resulting image is stored in your ACR as OpenClaw:latest.


Configure Credentials

Set your secrets before deploying:

cd moltbot-azure-container-apps

# Set your required secrets
azd env set OPENROUTER_API_KEY "sk-or-v1-your-key-here"
azd env set DISCORD_BOT_TOKEN "your-discord-bot-token"
azd env set DISCORD_ALLOWED_USERS "your-discord-user-id"

Where to get these values:

VariableWhere to Get It
OPENROUTER_API_KEYopenrouter.ai/keys
DISCORD_BOT_TOKENDiscord Developer Portal β†’ Your App β†’ Bot β†’ Reset Token
DISCORD_ALLOWED_USERSDiscord β†’ Settings β†’ Advanced β†’ Developer Mode β†’ Right-click your username β†’ Copy User ID

Optional settings:

# Change the AI model
azd env set OPENCLAW_MODEL "openrouter/anthropic/claude-3.5-sonnet"

# Change the bot's name
azd env set OPENCLAW_PERSONA_NAME "Clawd"

# Add IP restrictions (for security)
azd env set ALLOWED_IP_RANGES "1.2.3.4/32"

# Enable email alerts
azd env set ALERT_EMAIL_ADDRESS "your-email@example.com"

Deploy Application

Now deploy with your configuration:

azd deploy

This deploys OpenClaw to Container Apps with all your secrets configured.

⚠️ Important: If you change any environment variables later, run azd deploy again to apply them.


Step 3: Invite Bot to Server

⚠️ Critical: Discord requires bots and users to share a server before DMs work!

StepAction
1Open the OAuth2 URL you copied in Step 0
2Select a server to invite the bot to (or create a new one)
3Click Authorize

Step 4: Start Chatting

StepAction
1Find your bot in the server's member list (right sidebar)
2Right-click the bot β†’ Message to open a DM
3Send: Hello!
4Wait a few seconds for the response πŸŽ‰

πŸŽ‰ You're now chatting with your personal AI assistant running 24/7 on Azure!


What You Just Deployed

Here's what's running in your Azure subscription:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                          Azure Resource Group                               β”‚
β”‚                                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚
β”‚  β”‚                  Azure Container Apps Environment                       β”‚β”‚
β”‚  β”‚                                                                          β”‚β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚β”‚
β”‚  β”‚  β”‚                    🦞 OpenClaw Container App                    β”‚     β”‚β”‚
β”‚  β”‚  β”‚                                                                  β”‚     β”‚β”‚
β”‚  β”‚  β”‚  Gateway     β†’ Control plane for sessions and tools             β”‚     β”‚β”‚
β”‚  β”‚  β”‚  Control UI  β†’ Web dashboard for management                     β”‚     β”‚β”‚
β”‚  β”‚  β”‚  Channels    β†’ Telegram, Discord, WhatsApp connections          β”‚     β”‚β”‚
β”‚  β”‚  β”‚  Skills      β†’ Extensible automation capabilities               β”‚     β”‚β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
β”‚                                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚  Container       β”‚  β”‚   πŸ’Ύ Storage        β”‚  β”‚  πŸ“Š Log Analytics  β”‚ β”‚
β”‚  β”‚     Registry        β”‚  β”‚     Account         β”‚  β”‚                     β”‚ β”‚
β”‚  β”‚  (stores image)     β”‚  β”‚  (persistent data)  β”‚  β”‚  (logs & metrics)  β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Cleaning Up

When you're done experimenting:

azd down --purge

This removes all Azure resources. Your data in Azure Storage will be deleted.


Resources

ResourceLink
OpenClaw Docsdocs.openclaw.bot
OpenClaw GitHubgithub.com/OpenClaw/OpenClaw
OpenClaw Discorddiscord.gg/openclaw
Azure Container AppsDocumentation
Sample RepositoryGitHub

 

Deploy OpenClaw with a single command:

# Clone the sample repository
git clone https://github.com/BandaruDheeraj/moltbot-azure-container-apps
cd moltbot-azure-container-apps

# Deploy everything with Azure Developer CLI
azd up

Repository: github.com/BandaruDheeraj/moltbot-azure-container-apps


Questions or feedback? Join the OpenClaw Discord or open an issue on the sample repository.

Updated Feb 09, 2026
Version 5.0
No CommentsBe the first to comment