This project is a complete, event-driven, AI-powered helpdesk solution. It uses FastAPI for high-performance ingestion, Azure Service Bus for decoupling, and a Python worker to enrich requests with[...]
View Solution Architecture Flowchart
flowchart LR
U["User submits Helpdesk Form<br/>(Title, Description, Category, Priority, ActionHint, RequesterEmail)"]
U --> F[FastAPI /submit handler]
F --> T["Save entity to<br/>Azure Table Storage<br/>(HelpdeskRequests)"]
F --> Q[Send compact message<br/>to Service Bus queue 'm365']
Q --> W[Worker process<br/>listens on 'm365']
W --> R[Fetch full entity<br/>from Table Storage]
R --> E["AI Enrichment<br/>(Azure OpenAI)"]
E -->|enriched title/summary/urgency| TEAMS[Send MessageCard<br/>to Teams via Webhook]
TEAMS --> A["Agent Framework<br/>decide_action(entity, enriched)"]
A -->|notify-team| ACS[Send notification email<br/>via Azure Communication Services]
A -->|create-task| PL[Create Planner task<br/>via Microsoft Graph]
A -->|create-ticket| FLOW["Trigger Power Automate<br/>HTTP Flow (ticket)"]
A -->|store-only| END["No further action<br/>(stored + Teams only)"]
- FastAPI Ingestion: A high-performance, asynchronous API endpoint for form submission.
- Event-Driven: Fully decoupled architecture using Azure Service Bus for resilience.
- AI Enrichment: Uses Azure OpenAI to summarize, re-title, and assess the urgency of user requests.
- Agentic Actions: Leverages the Microsoft Agent Framework to intelligently decide the next best action.
- Analytics Chat: An AI-powered conversational interface to query ticket data (counts by category, priority, recent tickets, etc.).
- M365 Integration:
- Posts notifications to Microsoft Teams.
- Creates tasks in Microsoft Planner via Graph API.
- Sends notification emails via Azure Communication Services.
- Triggers Power Automate flows for custom ticketing.
Before you begin, you will need:
- Python 3.10+
- An Azure Subscription
- An Azure OpenAI resource with a model deployed (e.g.,
gpt-4o) - A Microsoft 365 Tenant with admin permissions to:
- Create App Registrations
- Microsoft Teams (with a channel for notifications)
- Microsoft Planner (with a plan and bucket)
- Power Automate
- An Azure Communication Services resource configured for email.
First, clone the repository and set up your Python virtual environment.
# Clone the repository
git clone https://github.com/your-username/your-repo-name.git
cd your-repo-name
# Create a virtual environment (venv)
python -m venv .venv
# Activate the virtual environment
# On Windows:
.venv\Scripts\activate
# On macOS/Linux:
source .venv/bin/activate
# Install the required packages
pip install -r requirements.txtCreate a file named .env in the root of the project. Copy the content below into it.
# Azure Storage
AZURE_TABLE_CONN_STR=
AZURE_TABLE_NAME=HelpdeskRequests
# Azure Service Bus
AZURE_SERVICEBUS_CONN_STR=
AZURE_SERVICEBUS_QUEUE_NAME=m365
# Teams
TEAMS_WEBHOOK_URL=
# Azure OpenAI / Agent Framework
AZURE_OPENAI_ENDPOINT=
AZURE_OPENAI_API_KEY=
AZURE_OPENAI_DEPLOYMENT=
AZURE_AI_PROJECT_ENDPOINT=
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME=
# Email via ACS
ACS_CONNECTION_STRING=
ACS_SENDER_ADDRESS=
NOTIFY_EMAILS=
# Planner via Graph
GRAPH_TENANT_ID=
GRAPH_CLIENT_ID=
GRAPH_CLIENT_SECRET=
PLANNER_PLAN_ID=
PLANNER_BUCKET_ID=
# Power Automate HTTP flow
POWER_AUTOMATE_FLOW_URL=-
Azure Storage:
- Create an Azure Storage Account.
- Under Access keys, copy the Connection string.
- Create a table named
HelpdeskRequests.
-
Azure Service Bus:
- Create a Service Bus Namespace.
- Copy the Primary Connection String.
- Create a queue named
m365.
- Open Teams β go to the channel.
- Select Connectors β Incoming Webhook.
- Generate and copy the webhook URL.
- Open your Azure OpenAI resource.
- Copy the endpoint and key.
- Copy your model deployment name.
- Create an ACS resource.
- Configure Email β verified domain.
- Copy connection string + sender address.
- Create an App Registration.
- Copy:
- Tenant ID
- Client ID
- Add Graph API permission:
Tasks.ReadWrite.All
- Create a Client Secret.
- Get:
PLANNER_PLAN_IDPLANNER_BUCKET_IDvia Graph Explorer.
- Create a flow with When an HTTP request is received.
- Save β copy the generated endpoint URL.
# Build and start both services
docker compose up --buildThis starts the web app on http://localhost:8000 and the worker listening on the Service Bus queue. Both read from your .env file.
To build images individually:
docker build --target web -t helpdesk-web .
docker build --target worker -t helpdesk-worker .uvicorn app.main:app --reloadpython -m app.workerThe architecture maps naturally to Azure Container Apps β the web app and worker run as two separate container apps in a shared environment.
# Variables
RG=rg-helpdesk
LOCATION=westeurope
ENV_NAME=helpdesk-env
ACR_NAME=youracrname
# Create resource group & Container Registry
az group create -n $RG -l $LOCATION
az acr create -n $ACR_NAME -g $RG --sku Basic --admin-enabled true
az acr login -n $ACR_NAME
# Build & push both images
docker build --target web -t $ACR_NAME.azurecr.io/helpdesk-web:latest .
docker build --target worker -t $ACR_NAME.azurecr.io/helpdesk-worker:latest .
docker push $ACR_NAME.azurecr.io/helpdesk-web:latest
docker push $ACR_NAME.azurecr.io/helpdesk-worker:latest
# Create Container Apps environment
az containerapp env create -n $ENV_NAME -g $RG -l $LOCATION
# Deploy web app (with external ingress)
az containerapp create \
-n helpdesk-web -g $RG \
--environment $ENV_NAME \
--image $ACR_NAME.azurecr.io/helpdesk-web:latest \
--registry-server $ACR_NAME.azurecr.io \
--target-port 8000 \
--ingress external \
--min-replicas 1 --max-replicas 3 \
--env-vars-file .env
# Deploy worker (no ingress)
az containerapp create \
-n helpdesk-worker -g $RG \
--environment $ENV_NAME \
--image $ACR_NAME.azurecr.io/helpdesk-worker:latest \
--registry-server $ACR_NAME.azurecr.io \
--min-replicas 1 --max-replicas 5 \
--env-vars-file .envTip: For production, use Container Apps secrets or Azure Key Vault references instead of
--env-vars-file.
-
Azure Service Bus messaging overview
https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messaging-overview?wt.mc_id=MVP_365598 -
Microsoft Agent Framework overview
https://learn.microsoft.com/agent-framework/overview/agent-framework-overview?wt.mc_id=MVP_365598 -
Python Agent Tools
https://learn.microsoft.com/agent-framework/user-guide/agents/agent-tools?pivots=programming-language-python?wt.mc_id=MVP_365598

