Deploy ClawdBot to Azure Container Apps: Your 24/7 AI Assistant in 30 Minutes
๐ฆ Deploy ClawdBot to Azure Container Apps: Your 24/7 AI Assistant in 30 Minutes
โก TL;DR
ClawdBot 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 like automatic TLS, secrets management, and IP restrictions.
๐ 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 ClawdBot?
If you've ever wanted a personal AI assistant that actually does things - not just answers questions - ClawdBot is for you. Created by Peter Steinberger and a growing open-source community, ClawdBot is a personal AI assistant that:
| Capability | Description |
|---|---|
| ๐ Runs 24/7 | On your own infrastructure, always available |
| ๐ฌ Multi-channel | Telegram, Discord, WhatsApp, Slack, iMessage, and more |
| ๐ง Persistent memory | Remembers your preferences and context across sessions |
| โ๏ธ Task execution | Autonomously clears inboxes, deploys code, manages files |
| ๐ Skill learning | Creates reusable "skills" that you teach it |
๐ก Think of it as: A very capable coworker who never sleeps, works for pennies per hour, and gets better over time.
๐ Why People Are Excited
The community response has been remarkable:
๐ข "It's running my company." โ @therno
๐ฏ "After years of AI hype, I thought nothing could faze me. Then I installed @clawdbot. From nervous 'hi what can you do?' to full throttle - design, code review, taxes, PM, content pipelines..." โ @lycfyi
โ "Me reading about @clawdbot: 'this looks complicated' ๐ me 30 mins later: controlling Gmail, Calendar, WordPress, Hetzner from Telegram like a boss. Smooth as single malt." โ @Abhay08
๐ฎ "Using @clawdbot for a week and it genuinely feels like early AGI. The gap between 'what I can imagine' and 'what actually works' has never been smaller." โ @tobi_bsf
โ๏ธ Why Azure Container Apps?
The original setup guide for ClawdBot uses AWS EC2, but Azure Container Apps offers significant advantages for running a 24/7 AI assistant - especially around security.
๐ Security Posture Comparison
When deploying a personal AI assistant that can execute code, access APIs, and potentially connect to sensitive services, security isn't optional. Here's how Azure Container Apps compares to other popular deployment options:
| Security Feature | Azure Container Apps | AWS EC2 | DigitalOcean Droplet | Home Server | Hetzner VPS |
|---|---|---|---|---|---|
| Managed Identity (passwordless auth) | โ Native | โ ๏ธ IAM roles | โ Manual | โ N/A | โ Manual |
| Secrets Management | โ Built-in secrets | โ ๏ธ SSM Parameter Store | โ Env vars | โ .env files | โ .env files |
| VNet Integration | โ Native | โ VPC | โ ๏ธ Limited | โ N/A | โ N/A |
| Private Endpoints | โ Supported | โ PrivateLink | โ No | โ N/A | โ N/A |
| Automatic TLS/HTTPS | โ Free, auto-renewed | โ Manual (ACM + ALB) | โ Manual (Let's Encrypt) | โ Manual | โ Manual |
| DDoS Protection | โ Azure DDoS | โ Shield (extra $) | โ ๏ธ Basic | โ None | โ ๏ธ Basic |
| Compliance Certifications | โ SOC2, ISO, HIPAA | โ SOC2, ISO, HIPAA | โ ๏ธ SOC2 only | โ None | โ None |
| RBAC (Role-Based Access) | โ Azure RBAC | โ IAM | โ ๏ธ Teams | โ N/A | โ N/A |
| Audit Logging | โ Log Analytics | โ CloudTrail | โ ๏ธ Basic | โ Manual | โ Manual |
| Container Isolation | โ Hyper-V | โ Firecracker | โ ๏ธ Shared kernel | โ None | โ ๏ธ Shared kernel |
| Network Policies | โ Native | โ ๏ธ Security Groups | โ ๏ธ Firewall | โ Manual iptables | โ ๏ธ Firewall |
| Vulnerability Scanning | โ Defender for Cloud | โ Inspector | โ Manual | โ Manual | โ Manual |
๐ก๏ธ Why Security Matters for AI Assistants
ClawdBot isn't just a chatbot - it can:
- Execute shell commands on the container
- Access external APIs with your credentials
- Store conversation history including potentially sensitive information
- Connect to messaging platforms with bot tokens
This makes security architecture critical. Let's break down the key advantages:
1. Managed Identity: Zero Secrets in Code
Azure Container Apps:
// No credentials needed - Azure handles auth automatically
identity: {
type: 'UserAssigned'
userAssignedIdentities: { '${managedIdentity.id}': {} }
}
Other platforms: Require storing access keys in environment variables or config files, creating potential leak vectors.
2. Secrets Management: First-Class Support
Azure Container Apps:
# Secrets stored securely, referenced by name
az containerapp secret set --name clawdbot --secrets "api-key=$MY_KEY"
# Used as: secretRef: 'api-key'
Other platforms: Secrets typically live in .env files on disk, visible to anyone with SSH access.
3. Network Isolation: VNet by Default
Azure Container Apps can be deployed into a VNet with:
- Private ingress only - no public IP
- Private Endpoints for Azure services
- Network Security Groups for fine-grained control
- Service Endpoints for secure storage access
This means your ClawdBot can be completely isolated from the public internet while still connecting to your messaging channels.
4. Container Runtime Security
Azure Container Apps runs on Hyper-V isolated containers, providing:
- Kernel-level isolation between workloads
- No shared kernel vulnerabilities
- Hardware-backed security boundaries
Compare this to standard Docker on VPS providers where containers share the host kernel.
5. Compliance Ready
Azure Container Apps inherits Azure's compliance certifications (if relevant to your use case):
- SOC 2 Type II
- ISO 27001, 27017, 27018
- HIPAA BAA available
- FedRAMP High
- PCI DSS
This matters when ClawdBot handles sensitive business data or connects to regulated systems.
๐ฐ Cost Comparison
| Platform | Monthly Cost | What You Get |
|---|---|---|
| ๐ AWS EC2 (t3.medium) | ~$30-40 | Fixed VM, you manage everything |
| ๐ต Azure Container Apps | ~$40-60 | Managed platform, auto-scaling, built-in HTTPS |
| ๐ Running on your Mac | $0 + electricity | Works, but must stay on 24/7 |
| ๐ฌ ChatGPT Plus | $20/month | Easy to use |
| ๐ค Claude Max | $100-200/month | Great model |
๐ Why Container Apps Wins
| Benefit | Description |
|---|---|
| ๐ง Zero Maintenance | No VMs to patch, no Kubernetes to manage |
| ๐ Auto-scaling | Scales to zero when idle, scales up under load |
| ๐ Built-in HTTPS | Automatic TLS certificates from Azure |
| ๐ Integrated Monitoring | Logs flow to Azure Log Analytics automatically |
| ๐ก๏ธ Security Features | Managed Identity, VNet integration, Private Endpoints |
| ๐ Global Reach | Deploy to any Azure region worldwide |
๐ The 30-Minute Setup
๐ Prerequisites
Before you start, you'll need:
| Requirement | Link |
|---|---|
| โ Azure subscription | Free tier works for testing |
| โ Azure CLI | Install here |
| โ Azure Developer CLI (azd) | Install here |
| โ OpenRouter API Key | openrouter.ai/keys (recommended) |
| โ Discord Account | For bot creation |
๐ก Why OpenRouter? OpenRouter provides access to multiple AI models (Claude, GPT-4, Gemini) through a single API. It's the recommended provider for ClawdBot on Azure.
0๏ธโฃ Create Your Discord Bot First! (5 minutes)
โ ๏ธ Important: Do this before running azd up - you'll need the bot token during deployment.
| Step | Action |
|---|---|
| 1 | Go to Discord Developer Portal |
| 2 | Click New Application โ Name it (e.g., "ClawdBot-Azure") |
| 3 | Go to Bot โ Click Add Bot |
| 4 | Enable Privileged Gateway Intents: Message Content โ , Server Members โ |
| 5 | Click Reset Token โ Copy the bot token (save it securely!) |
| 6 | Go to OAuth2 โ URL Generator |
| 7 | Select Scopes: bot, applications.commands |
| 8 | Select Permissions: Send Messages, Read Message History, View Channels |
| 9 | Copy the generated OAuth2 URL (you'll need this to invite the bot) |
Get Your Discord User ID:
| Step | Action |
|---|---|
| 1 | In Discord: Settings โ Advanced โ Enable Developer Mode |
| 2 | Right-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.
1๏ธโฃ Get the Sample (2 minutes)
Clone the deployment template:
git clone https://github.com/BandaruDheeraj/clawdbot-azure-container-apps
cd clawdbot-azure-container-apps
2๏ธโฃ Provision Infrastructure (5-7 minutes)
Run the initial provisioning:
azd provision
You'll be prompted for:
| Prompt | What to Enter |
|---|---|
| Environment name | clawdbot-prod |
| Azure subscription | Select from your list |
| Azure location | eastus2 (recommended) |
Note:
azd provisioncreates the Azure infrastructure without deploying the app. We need to build the image first.
This creates:
| Step | What Happens |
|---|---|
| 1๏ธโฃ | Creates a Resource Group |
| 2๏ธโฃ | Deploys Azure Container Registry |
| 3๏ธโฃ | Sets up Azure Storage for persistent data |
| 4๏ธโฃ | Creates a Container Apps Environment |
| 5๏ธโฃ | Configures Log Analytics for monitoring |
2.5๏ธโฃ Build the Container Image (Required - 3-5 minutes)
โ ๏ธ 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-clawdbot-prod --query "[0].name" -o tsv)
# Build the image in Azure Container Registry (no local Docker needed!)
az acr build --registry $ACR_NAME --image "clawdbot:latest" --file src/clawdbot/Dockerfile src/clawdbot/
Understanding this command:
| Part | What It Does |
|---|---|
--registry $ACR_NAME |
Build in your Azure Container Registry (in the cloud) |
--image "clawdbot:latest" |
Name the output image clawdbot:latest (we choose this name) |
--file src/clawdbot/Dockerfile |
Use the Dockerfile from our sample repo |
src/clawdbot/ |
Send this folder as the build context |
๐ก What happens during the build? The Dockerfile in our sample (at
src/clawdbot/Dockerfile) automatically:
- Starts from a Node.js base image
- Clones the official ClawdBot source code from GitHub
- Installs dependencies with pnpm
- Builds the TypeScript application
- Builds the Control UI
- Adds our custom
entrypoint.shthat generates config from Azure environment variablesYou don't need to download ClawdBot separately - it's pulled fresh from GitHub during the ACR build. The resulting image is stored in your ACR as
clawdbot:latest.
2.6๏ธโฃ Configure Your Credentials (Required)
Set your secrets before deploying:
cd clawdbot-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:
| Variable | Where to Get It |
|---|---|
OPENROUTER_API_KEY |
openrouter.ai/keys |
DISCORD_BOT_TOKEN |
Discord Developer Portal โ Your App โ Bot โ Reset Token |
DISCORD_ALLOWED_USERS |
Discord โ Settings โ Advanced โ Developer Mode โ Right-click your username โ Copy User ID |
Optional settings:
# Change the AI model
azd env set CLAWDBOT_MODEL "openrouter/anthropic/claude-3.5-sonnet"
# Change the bot's name
azd env set CLAWDBOT_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"
2.7๏ธโฃ Deploy the Application
Now deploy with your configuration:
azd deploy
This deploys ClawdBot to Container Apps with all your secrets configured.
โ ๏ธ Important: If you change any environment variables later, run
azd deployagain to apply them.
3๏ธโฃ Invite Your Bot to a Server (2 minutes)
โ ๏ธ Critical: Discord requires bots and users to share a server before DMs work!
| Step | Action |
|---|---|
| 1 | Open the OAuth2 URL you copied in Step 0 |
| 2 | Select a server to invite the bot to (or create a new one) |
| 3 | Click Authorize |
4๏ธโฃ Start Chatting! ๐ฌ
| Step | Action |
|---|---|
| 1 | Find your bot in the server's member list (right sidebar) |
| 2 | Right-click the bot โ Message to open a DM |
| 3 | Send: Hello! |
| 4 | Wait a few seconds for the response ๐ |
๐ You're now chatting with your personal AI assistant running 24/7 on Azure!
๐ Troubleshooting Common Issues
We encountered these issues during testing - here's how to fix them:
Container Image Not Found (MANIFEST_UNKNOWN)
Problem: Logs show MANIFEST_UNKNOWN: manifest tagged by "latest" is not found
Cause: The container image wasn't built before deployment.
Solution: Build the image manually:
ACR_NAME=$(az acr list --resource-group rg-clawdbot-prod --query "[0].name" -o tsv)
az acr build --registry $ACR_NAME --image "clawdbot:latest" --file src/clawdbot/Dockerfile src/clawdbot/
azd deploy
Windows Line Endings Breaking entrypoint.sh
Problem: Logs show exec /app/entrypoint.sh: no such file or directory
Cause: Windows CRLF line endings in shell scripts break Linux containers.
Solution: Convert to Unix line endings before building:
# PowerShell - convert CRLF to LF
$content = Get-Content src/clawdbot/entrypoint.sh -Raw
$content -replace "`r`n", "`n" | Set-Content src/clawdbot/entrypoint.sh -NoNewline
Then rebuild the image:
az acr build --registry $ACR_NAME --image "clawdbot:latest" --file src/clawdbot/Dockerfile src/clawdbot/
Secrets Not Applied (Discord Application ID Error)
Problem: Logs show Failed to resolve Discord application id
Cause: azd env set stores values locally, but they weren't applied to the container.
Solution: Manually set secrets on the container app:
RESOURCE_GROUP="rg-clawdbot-prod"
APP_NAME="clawdbot"
az containerapp secret set --name $APP_NAME --resource-group $RESOURCE_GROUP \
--secrets "discord-bot-token=YOUR_ACTUAL_TOKEN"
az containerapp update --name $APP_NAME --resource-group $RESOURCE_GROUP \
--set-env-vars "DISCORD_ALLOWED_USERS=YOUR_DISCORD_USER_ID"
# Restart to apply
REVISION=$(az containerapp show --name $APP_NAME --resource-group $RESOURCE_GROUP \
--query "properties.latestRevisionName" -o tsv)
az containerapp revision restart --name $APP_NAME --resource-group $RESOURCE_GROUP --revision $REVISION
"Unknown model" Error
Problem: ClawdBot logs show Unknown model: openrouter/anthropic/claude-sonnet-4-5
Cause: Model IDs must be exact. There's no model called claude-sonnet-4-5.
Solution:
azd env set CLAWDBOT_MODEL "openrouter/anthropic/claude-3.5-sonnet"
azd deploy
| โ Correct Model IDs | โ These Don't Exist |
|---|---|
openrouter/anthropic/claude-3.5-sonnet |
claude-sonnet-4-5 |
openrouter/anthropic/claude-3-opus |
openrouter:anthropic/claude-3.5-sonnet |
openrouter/openai/gpt-4-turbo |
anthropic/claude-opus-4-5 |
๐ก Tip: Check openrouter.ai/models for current model names.
HTTP 401 Authentication Error
Problem: Logs show HTTP 401: authentication_error
Cause: Invalid or missing OpenRouter API key.
Solution:
# Verify your key at openrouter.ai/keys first
azd env set OPENROUTER_API_KEY "sk-or-v1-your-actual-key"
azd deploy
Can't DM the Bot
Problem: Discord says "Unable to send messages to this user"
Cause: Discord requires a shared server before you can DM a bot.
Solution:
- Invite the bot to a server using the OAuth2 URL
- Then DM the bot from that server's member list
Bot Doesn't Respond to DMs
Problem: Bot is online but ignores your messages.
Cause: Your Discord user ID isn't in the allowlist.
Solution:
azd env set DISCORD_ALLOWED_USERS "your-discord-user-id"
azd deploy
๐๏ธ What You Just Deployed
Here's what's running in your Azure subscription:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Azure Resource Group โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ Azure Container Apps Environment โโ
โ โ โโ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโ
โ โ โ ๐ฆ ClawdBot 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) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ช Why This is So Powerful
โ๏ธ 1. It Actually Does Things
Unlike ChatGPT or other chat interfaces, ClawdBot can:
| Capability | Example |
|---|---|
| ๐ฅ๏ธ Execute shell commands | Deploy code, manage files |
| ๐ Browse the web | Fill forms, extract data |
| ๐ง Connect to services | Gmail, Calendar, GitHub |
| ๐ Manage files | Create, edit, organize |
| โฐ Run scheduled tasks | Cron jobs, reminders |
| ๐ Call you on the phone | With ElevenLabs integration |
๐ 2. It Learns and Improves
ClawdBot uses a "skills" system. Teach it something new:
"Create a skill that checks my flight status and texts me if there are delays"
It will create that skill, test it, and run it whenever you ask (or on a schedule).
๐ง 3. It Remembers Context
Unlike stateless AI chats, ClawdBot maintains persistent memory:
- โ Your preferences
- โ Past conversations
- โ Files you've shared
- โ Skills you've taught it
This context persists across sessions, even if the container restarts.
๐ 4. Secure by Default
Running on Azure Container Apps means:
| Security Feature | Benefit |
|---|---|
| ๐ SOC 2 / ISO 27001 | Azure's security certifications apply |
| ๐ VNet integration | Keep traffic on private networks |
| ๐ชช Managed Identity | No secrets in code |
| ๐ฅ RBAC | Fine-grained access control |
| ๐ Audit logs | Everything logged to Log Analytics |
๐ต Cost Efficiency Deep Dive
๐ Detailed Cost Breakdown
| Resource | What It Does | Monthly Cost |
|---|---|---|
| Container Apps | Runs ClawdBot 24/7 | ~$30-50 |
| Container Registry (Basic) | Stores the image | ~$5 |
| Storage Account | Persists data | ~$1-2 |
| Log Analytics | Stores logs | ~$2-5 |
| Total | ~$40-60/month |
๐ ROI Comparison
| Solution | Monthly Cost | Capabilities | Best For |
|---|---|---|---|
| Azure Container Apps | $40-60 | Full AI assistant | Production use |
| AWS EC2 | $30-40 | Same, but you manage | AWS shops |
| DigitalOcean | $24-48 | Same, manual setup | Simple deployments |
| Local machine | $10-20 | Requires 24/7 uptime | Hobbyists |
| ChatGPT Plus | $20 | Chat only | Q&A only |
| Claude Max | $100-200 | Great but no tasks | Heavy AI users |
๐ก Key Insight: $40-60/month for a 24/7 AI assistant that actually does work is incredibly cheap compared to any human alternative.
๐งช Quick Test Drive
Once deployed, try these commands with your ClawdBot:
๐ Basic Tasks
"What's the weather in New York?"
"Set a reminder for tomorrow at 9am to call the dentist"
๐ Research
"Research the top 5 project management tools and give me a comparison"
๐ง Automation
"Check my last 10 emails and tell me which ones need a response"
๐ ๏ธ Skills
"Create a skill that summarizes any webpage I send you"
โ๏ธ Advanced Configuration
๏ฟฝ How It Works Under the Hood
When you run azd up, the deployment does something clever: it builds ClawdBot from source in Azure Container Registry, then injects your configuration at runtime via an entrypoint script.
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ azd up โโโโโโถโ ACR Build โโโโโโถโ Container App โ
โ โ โ (from source) โ โ (your config) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ entrypoint.sh โ
โ โ
โ Generates JSON โ
โ config from โ
โ env variables โ
โโโโโโโโโโโโโโโโโโโ
The entrypoint script converts your environment variables into ClawdBot's JSON configuration format at startup. This means:
- Secrets stay out of the image - Configuration is injected at runtime
- Easy updates - Just change env vars and redeploy
- No manual config files - The script handles schema changes
๐ฑ Adding More Channels
Discord (Recommended):
azd env set DISCORD_BOT_TOKEN "your-discord-token"
azd env set DISCORD_ALLOWED_USERS "user-id-1,user-id-2" # Comma-separated for multiple users
azd deploy
Telegram:
azd env set TELEGRAM_BOT_TOKEN "your-telegram-token"
azd env set TELEGRAM_ALLOWED_USER_ID "your-telegram-user-id"
azd deploy
WhatsApp: Requires the desktop wizard to scan a QR code - not supported in headless container deployments.
๐ง Supported Models (via OpenRouter)
| Model | ID | Notes |
|---|---|---|
| Claude 3.5 Sonnet | openrouter/anthropic/claude-3.5-sonnet |
Recommended - Best balance of speed/quality |
| Claude 3 Opus | openrouter/anthropic/claude-3-opus |
Most capable, slower |
| GPT-4 Turbo | openrouter/openai/gpt-4-turbo |
Good alternative |
| Gemini Pro | openrouter/google/gemini-pro |
Fast, lower cost |
Change model:
azd env set CLAWDBOT_MODEL "openrouter/anthropic/claude-3-opus"
azd deploy
โ ๏ธ Important: Model IDs must be exact. Check openrouter.ai/models for current names.
๐ญ Custom Persona
Change your bot's personality:
azd env set CLAWDBOT_PERSONA_NAME "Jarvis"
azd deploy
๐ Viewing Logs
az containerapp logs show \
--name clawdbot \
--resource-group rg-clawdbot-prod \
--follow --tail 50
# What healthy logs look like:
# Discord channel configured: yes (DM allowlist: 123456789)
# [discord] logged in to discord as 987654321
# [gateway] agent model: openrouter/anthropic/claude-3.5-sonnet
# [gateway] listening on ws://0.0.0.0:18789
๐ Updating Secrets
After changing secrets, you must restart the container:
# Update a secret
az containerapp secret set --name clawdbot --resource-group rg-clawdbot-prod \
--secrets "openrouter-api-key=sk-or-v1-new-key"
# Get current revision
REVISION=$(az containerapp show --name clawdbot --resource-group rg-clawdbot-prod \
--query "properties.latestRevisionName" -o tsv)
# Restart to apply
az containerapp revision restart --name clawdbot --resource-group rg-clawdbot-prod \
--revision $REVISION
๐ Security Best Practices
Azure Container Apps includes several security features by default. Here's how to use them effectively for ClawdBot:
๏ฟฝ Addressing Common Security Concerns
The community has raised several valid security concerns about self-hosting AI assistants. Here's how our Azure Container Apps deployment addresses each one:
| Security Concern | How ACA Addresses It | Configuration |
|---|---|---|
| 1. Close ports / IP allowlist | โ Built-in IP restrictions on ingress | ALLOWED_IP_RANGES parameter |
| 2. Auth (JWT/OAuth/strong secret + TLS) | โ Gateway token auth + automatic HTTPS | CLAWDBOT_GATEWAY_TOKEN + free TLS certs |
| 3. Rotate keys (assume compromise) | โ Container App secrets + easy rotation | az containerapp secret set |
| 4. Rate limiting + logs + alerts | โ Log Analytics + Azure Monitor alerts | Preconfigured alerts included |
Let's dive into each:
๐ 1. IP Restrictions / VPN Access
The Concern: "Close the port/firewall to VPN or IP allowlist"
ACA Solution: Container Apps supports IP security restrictions at the ingress level - no need for external firewalls.
# Restrict access to your home IP and VPN
azd env set ALLOWED_IP_RANGES "1.2.3.4/32,10.0.0.0/8"
azd deploy
This creates ingress rules that:
- Allow traffic only from specified CIDR ranges
- Block all other IP addresses at the edge
- Apply before traffic reaches your container
For maximum security (internal-only):
# Deploy with no public ingress at all
azd env set INTERNAL_ONLY "true"
azd deploy
This makes ClawdBot accessible only from within your Azure VNet - perfect for corporate environments with VPN access.
๐ 2. Authentication (Gateway Token + TLS)
The Concern: "Add auth - JWT/OAuth at least a strong secret + TLS"
ACA Solution: Multiple layers of authentication are enabled by default:
| Layer | What It Does | How It Works |
|---|---|---|
| HTTPS/TLS | Encrypts all traffic | Automatic Let's Encrypt certificates |
| Gateway Token | Authenticates Control UI access | 32-char random token in secret |
| DM Allowlist | Restricts who can message the bot | Discord/Telegram user ID whitelist |
| Managed Identity | Authenticates to Azure services | No passwords in config |
The gateway token is auto-generated if not provided:
# Auto-generate (recommended)
azd up # Token generated automatically
# Or specify your own
azd env set CLAWDBOT_GATEWAY_TOKEN "your-strong-secret-here"
azd deploy
Why this is better than JWT/OAuth:
- JWT/OAuth requires identity provider setup and maintenance
- Gateway token is simpler but equally secure for single-user scenarios
- DM allowlist provides identity verification at the messaging layer
- Combined with IP restrictions, attack surface is minimal
๐ 3. Key Rotation (Assume Compromise)
The Concern: "Rotate keys regularly, assume compromise"
ACA Solution: Container App secrets can be rotated without rebuilding or redeploying:
# Rotate OpenRouter API key
az containerapp secret set --name clawdbot --resource-group rg-clawdbot \
--secrets "openrouter-api-key=sk-or-v1-new-key-here"
# Rotate Discord bot token
az containerapp secret set --name clawdbot --resource-group rg-clawdbot \
--secrets "discord-bot-token=new-discord-token"
# Rotate gateway token
az containerapp secret set --name clawdbot --resource-group rg-clawdbot \
--secrets "gateway-token=new-32-char-secret"
# Restart to apply new secrets
REVISION=$(az containerapp show --name clawdbot --resource-group rg-clawdbot \
--query "properties.latestRevisionName" -o tsv)
az containerapp revision restart --name clawdbot --resource-group rg-clawdbot \
--revision $REVISION
Rotation best practices:
- Rotate API keys monthly or after any suspected exposure
- Use Azure Key Vault for automated rotation (optional)
- Monitor for failed auth attempts (covered by alerts below)
๐ 4. Rate Limiting + Logs + Alerts
The Concern: "Rate limit + comprehensive logging + alerts for anomalies"
ACA Solution: Full observability stack included by default:
Logging (Included)
All container output flows automatically to Log Analytics:
# View real-time logs
az containerapp logs show --name clawdbot --resource-group rg-clawdbot \
--follow --tail 50
# Query historical logs
az monitor log-analytics query \
--workspace $LOG_ANALYTICS_WORKSPACE_ID \
--analytics-query "ContainerAppConsoleLogs_CL | where TimeGenerated > ago(1h)"
Alerts (Preconfigured)
Our deployment includes four security-focused alerts:
| Alert | Trigger | Indicates |
|---|---|---|
| High Error Rate | >10 auth errors in 5 min | Potential brute force attack |
| Container Restarts | >3 restarts in 15 min | Crash loop or OOM attack |
| Unusual Request Volume | >100 messages/hour | Potential abuse |
| Channel Disconnect | Discord/Telegram goes offline | Token revoked or network issue |
Enable email notifications:
azd env set ALERT_EMAIL_ADDRESS "security@yourcompany.com"
azd deploy
Rate Limiting
While Container Apps doesn't have built-in rate limiting, you get effective protection from:
- Discord/Telegram rate limits - Both platforms limit message frequency
- DM Allowlist - Only approved users can send messages
- OpenRouter rate limits - API calls are throttled by your plan
- Unusual activity alerts - Notified when volume spikes
For additional rate limiting, add Azure API Management in front of the gateway.
๐ก๏ธ Defense in Depth Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SECURITY LAYERS โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ 1. IP RESTRICT โ Only allowed IPs can reach the gateway โ
โ โโโโโโโโโโฌโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ 2. TLS/HTTPS โ All traffic encrypted with auto-renewed certs โ
โ โโโโโโโโโโฌโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ 3. DM ALLOWLIST โ Only your Discord user ID can message the bot โ
โ โโโโโโโโโโฌโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ 4. GATEWAY AUTH โ Token required for Control UI access โ
โ โโโโโโโโโโฌโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ 5. SECRETS MGMT โ API keys stored as Container App secrets โ
โ โโโโโโโโโโฌโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ 6. MANAGED ID โ Passwordless auth to Azure services (ACR) โ
โ โโโโโโโโโโฌโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ 7. HYPER-V โ Container isolation at hardware level โ
โ โโโโโโโโโโฌโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ 8. ALERTS โ Notify on auth failures, restarts, abuse โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Implementation Checklist
| Practice | How to Implement | Why It Matters |
|---|---|---|
| ๐ DM Allowlist | Set DISCORD_ALLOWED_USERS |
Prevents strangers from using your AI |
| ๐ซ Gateway Token | Auto-generated, use for Control UI | Protects web management interface |
| ๐ IP Restrictions | Set ALLOWED_IP_RANGES |
Limits network attack surface |
| ๐ Secrets in Azure | Keys stored as secrets, not env vars | Never exposed in logs or source |
| ๐ค Managed Identity | Enabled by default | No ACR passwords in config |
| ๐ Audit Logs | Log Analytics workspace | Track all API calls and access |
| ๐จ Alerts | Set ALERT_EMAIL_ADDRESS |
Immediate notification of issues |
| ๐ Key Rotation | az containerapp secret set |
Mitigate compromised credentials |
๐จ What NOT to Do
| โ Don't | โ Do Instead |
|---|---|
| Put API keys in Dockerfile | Use Container App secrets |
Use dm.policy: "open" |
Use dm.policy: "allowlist" |
| Disable gateway token auth | Always require token for Control UI |
| Skip DISCORD_ALLOWED_USERS | Always configure the allowlist |
| Leave IP restrictions empty for production | Set ALLOWED_IP_RANGES |
| Ignore alerts | Configure email notifications |
๐ Optional: Private VNet Deployment
For highly sensitive deployments, deploy entirely within a VNet:
# Create a VNet-integrated environment
az containerapp env create \
--name cae-clawdbot-private \
--resource-group rg-clawdbot \
--location eastus2 \
--infrastructure-subnet-resource-id $SUBNET_ID \
--internal-only
This makes ClawdBot:
- Inaccessible from the public internet
- Reachable only from within your Azure VNet
- Suitable for sensitive workloads
๐งน Cleaning Up
When you're done experimenting:
azd down --purge
This removes all Azure resources. Your data in Azure Storage will be deleted.
๐ฏ What's Next?
Once your ClawdBot is running, explore these capabilities:
| Next Step | Link/Action |
|---|---|
| ๐ง Browse Skills | clawdhub.com |
| ๐ Create Custom Skills | Teach through natural language |
| ๐ Add Integrations | Gmail, Calendar, GitHub |
| โฐ Set Up Cron Jobs | Schedule recurring tasks |
| ๐ค Enable Voice | Add ElevenLabs for voice |
๐ Resources
| Resource | Link |
|---|---|
| ๐ ClawdBot Docs | docs.clawd.bot |
| ๐ป ClawdBot GitHub | github.com/clawdbot/clawdbot |
| ๐ฌ ClawdBot Discord | discord.gg/clawd |
| โ๏ธ Azure Container Apps | Documentation |
| ๐ฆ Sample Repository | GitHub |
๐ฏ Key Takeaways
๐ฆ ClawdBot on Azure Container Apps gives you the best of both worlds:
| Benefit | What It Means |
|---|---|
| ๐ Open-source flexibility | Full control over your AI assistant |
| ๐ข Managed infrastructure | Azure's scalability and reliability |
| ๐ฐ Cost efficiency | ~$40-60/month for 24/7 operation |
| ๐ง Zero maintenance | No servers to patch, no Kubernetes to manage |
| ๐ Security by default | Managed identity, secrets management, DM allowlist |
๐ Key Learnings from Our Deployment
During the development and testing of this sample, we discovered several important details that will save you hours:
1. ClawdBot Requires Config File, Not Just Env Vars
The Problem: Setting environment variables directly doesn't configure ClawdBot.
The Solution: ClawdBot reads from ~/.clawdbot/clawdbot.json. Our entrypoint.sh script generates this file from environment variables at container startup.
2. Config Schema Matters
The Problem: Using legacy config format causes silent failures.
The Solution: Use agents.defaults and agents.list[].identity, not the older agent and identity format:
{
"agents": {
"defaults": { "model": { "primary": "..." } },
"list": [{ "id": "main", "identity": { "name": "Clawd" } }]
}
}
3. Model IDs Must Be Exact
The Problem: openrouter/anthropic/claude-sonnet-4-5 returns "Unknown model".
The Solution: Check openrouter.ai/models for exact model names. Current working model: openrouter/anthropic/claude-3.5-sonnet.
4. Discord Requires Shared Server for DMs
The Problem: Can't find how to DM the bot.
The Solution: Discord bots can only receive DMs from users who share a server with them. Invite the bot to a server first, then DM it from the member list.
5. Secrets Changes Need Container Restart
The Problem: Updated API key but still getting auth errors.
The Solution: After az containerapp secret set, restart the revision:
az containerapp revision restart --name clawdbot --resource-group rg-clawdbot --revision $REVISION
๐ฎ The future of personal AI isn't chatting with a website - it's having an always-on assistant that remembers you, learns from you, and actually gets things done.
๐ Deploy your ClawdBot today and join the 40,000+ developers who've discovered what personal AI should feel like.
๐ Try It Yourself
Deploy ClawdBot with a single command:
# Clone the sample repository
git clone https://github.com/BandaruDheeraj/clawdbot-azure-container-apps
cd clawdbot-azure-container-apps
# Deploy everything with Azure Developer CLI
azd up
๐ฆ Repository: github.com/BandaruDheeraj/clawdbot-azure-container-apps
๐ฌ Questions or feedback? Join the ClawdBot Discord or open an issue on the sample repository.