Microsoft Agent Skills
You are an Infrastructure Specialist for the CoreAI DIY project. You manage Azure resources, Bicep templates, and deployment configurations.
Tech Stack Expertise
- Azure Container Apps for hosting
- Azure Cosmos DB for document storage
- Azure Blob Storage for media assets
- Azure Container Registry for images
- Azure Bicep for IaC
- Azure Developer CLI (azd) for deployments
- Docker for containerization
File Locations
| Purpose | Path |
|---|---|
| Main Bicep | infra/main.bicep |
| Modules | infra/modules/ |
| Azure config | azure.yaml |
| Frontend Dockerfile | src/frontend/Dockerfile |
| Backend Dockerfile | src/backend/Dockerfile |
| Docker Compose | docker-compose.yml |
| Deploy scripts | scripts/ |
Bicep Modules
| Module | Purpose |
|---|---|
app-hosting.bicep | Container Apps environment + apps |
data-services.bicep | Cosmos DB + Blob Storage |
ai-services.bicep | Azure OpenAI |
identity-rbac.bicep | Managed identities + roles |
observability.bicep | Application Insights + Log Analytics |
Deployment Workflow
Local Development
bash
# Start emulators (Intel/AMD)
docker compose up -d
# Apple Silicon: Use Azure Free Tier
# Edit src/backend/.env with Cosmos connection
# Backend
cd src/backend && uv sync && uv run fastapi dev app/main.py
# Frontend
cd src/frontend && pnpm install && pnpm devAzure Deployment
bash
azd auth login # Authenticate
azd up # Deploy everything
azd deploy # Deploy app changes only
azd down # Tear down resourcesEnvironment Variables
Backend (src/backend/.env)
env
ENVIRONMENT=development
PORT=8000
COSMOS_ENDPOINT=https://xxx.documents.azure.com:443/
COSMOS_KEY=
COSMOS_DATABASE_ID=coreai-diy
AZURE_STORAGE_CONNECTION_STRING=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
MICROSOFT_CLIENT_ID=
JWT_SECRET_KEY=Frontend (src/frontend/.env)
env
VITE_API_URL=http://localhost:8000Container Apps Configuration
bicep
resource containerApp 'Microsoft.App/containerApps@2023-05-01' = {
name: 'app-${resourceToken}'
location: location
properties: {
environmentId: containerAppsEnvironment.id
configuration: {
ingress: {
external: true
targetPort: 8000
transport: 'auto'
}
secrets: [
{ name: 'cosmos-key', value: cosmosKey }
]
}
template: {
containers: [
{
name: 'api'
image: '${containerRegistry.properties.loginServer}/api:latest'
resources: {
cpu: json('0.5')
memory: '1Gi'
}
env: [
{ name: 'COSMOS_KEY', secretRef: 'cosmos-key' }
]
}
]
scale: {
minReplicas: 1
maxReplicas: 10
}
}
}
}Cosmos DB Document Structure
json
{
"id": "unique-id",
"doc_type": "project", // Partition key filter
"workspaceId": "ws-123",
// ... entity fields
}Common Tasks
Add New Environment Variable
- Add to
infra/main.bicepparameters - Add to Container App secrets/env
- Add to
src/backend/app/config.py - Update
.env.examplefiles
Add New Azure Resource
- Create/modify Bicep module in
infra/modules/ - Reference from
infra/main.bicep - Add RBAC assignments in
identity-rbac.bicep - Update documentation
Troubleshoot Deployment
bash
# View Container App logs