Azure AI Foundry in 2025: Building Your First AI Agent – Part 4 (Final)

Azure AI Foundry in 2025: Building Your First AI Agent – Part 4 (Final)

Welcome to the final part of our Azure AI Foundry agent series! We’ve built and coded our agent—now let’s deploy it to production with Docker, CI/CD, and monitoring.

Step 1: Create Dockerfile

FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY src/ ./src/
ENV PYTHONUNBUFFERED=1
CMD ["python", "src/main.py"]

Step 2: Create Azure Resources

az login
RESOURCE_GROUP="rg-support"
LOCATION="eastus"
REGISTRY="acrsupport"

az group create --name $RESOURCE_GROUP --location $LOCATION
az acr create --name $REGISTRY --resource-group $RESOURCE_GROUP --sku Basic
az containerapp env create --name env-support --resource-group $RESOURCE_GROUP --location $LOCATION

Step 3: Deploy

docker build -t $REGISTRY.azurecr.io/agent:latest .
az acr login --name $REGISTRY
docker push $REGISTRY.azurecr.io/agent:latest

az containerapp create \
  --name app-agent \
  --resource-group $RESOURCE_GROUP \
  --environment env-support \
  --image $REGISTRY.azurecr.io/agent:latest \
  --cpu 0.5 --memory 1.0Gi \
  --min-replicas 0 --max-replicas 10

Series Complete!

You’ve built a production-ready AI agent with intelligence, security, observability, and scalability!


Part 4 (Final) of 4-part series on Azure AI Foundry agents.

Step 4: GitHub Actions CI/CD

Create .github/workflows/deploy.yml:

name: Deploy
on:
  push:
    branches: [main]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: azure/docker-login@v1
      with:
        login-server: acrsupport.azurecr.io
        username: ${{ secrets.ACR_USERNAME }}
        password: ${{ secrets.ACR_PASSWORD }}
    - run: |
        docker build -t acrsupport.azurecr.io/agent:${{ github.sha }} .
        docker push acrsupport.azurecr.io/agent:${{ github.sha }}
    - uses: azure/login@v1
      with:
        creds: ${{ secrets.AZURE_CREDENTIALS }} - run: |
        az containerapp update --name app-agent --resource-group rg-support \
          --image acrsupport.azurecr.io/agent:${{ github.sha }}

Step 5: Security & Monitoring

# Enable managed identity
az containerapp identity assign --name app-agent --resource-group rg-support --system-assigned

# Add secrets
az containerapp secret set --name app-agent --resource-group rg-support \
  --secrets project-endpoint="YOUR_ENDPOINT"

# View logs
az containerapp logs show --name app-agent --resource-group rg-support --follow

Production Checklist

  • ✅ Secrets stored securely
  • ✅ Managed identity enabled
  • ✅ Monitoring configured
  • ✅ Auto-scaling enabled
  • ✅ CI/CD working

References

  • Azure Container Apps (https://learn.microsoft.com/azure/container-apps/)
  • GitHub Actions for Azure (https://github.com/Azure/actions)

Written by:

373 Posts

View All Posts
Follow Me :
How to whitelist website on AdBlocker?

How to whitelist website on AdBlocker?

  1. 1 Click on the AdBlock Plus icon on the top right corner of your browser
  2. 2 Click on "Enabled on this site" from the AdBlock Plus option
  3. 3 Refresh the page and start browsing the site