Building a Conversational AI Experience in Microsoft Teams using Power Automate and Microsoft Foundry
Modern enterprises want AI embedded directly into everyday collaboration tools. One of the most effective places to integrate AI is Microsoft Teams.
This blog walks through a hands-on demo from an enterprise training program that demonstrates how to connect Microsoft Teams, Power Automate, and Microsoft Foundry (earlier called Azure Ai Foundry) to create a conversational AI experience without building a custom bot.
Overview
Demo Name
Teams → AI Response via Power Automate → Teams Reply
What this demo demonstrates
A user types a natural language command in Microsoft Teams (for example, /ai summarize this). A Power Automate flow detects the command, invokes an Azure AI Foundry Prompt Flow, and posts the AI-generated response back into the same Teams conversation thread.
Key takeaway
Microsoft Teams can be transformed into an AI interaction layer using low-code automation and enterprise AI services.
End-to-End Flow
User posts
/ai <query>in Microsoft TeamsPower Automate trigger fires
Flow checks if the message starts with
/aiFlow calls Azure AI Foundry Prompt Flow
AI generates a response
Power Automate posts the response back to the same Teams thread
Architecture
Microsoft Teams
↓
Power Automate (Trigger + Logic)
↓
Azure AI Foundry Prompt Flow (Chat API)
↓
Power Automate
↓
Microsoft Teams (Reply)
Step-by-Step Implementation
Step 1: Create an Azure AI Foundry Resource
Go to the Azure portal
Create a Microsoft AI Foundry resource
Choose subscription, region, and resource group
Create an AI Foundry Hub
Step 2: Create a Project
Open the AI Foundry portal
Create a new Project under the Hub
Verify project permissions
Step 3: Deploy a Model
Open the Model catalog
Select a GPT model
Deploy the model and note the deployment name
Step 4: Create a Prompt Flow
Go to Prompt Flows
Create a new Standard Flow
Add inputs and outputs:
Input:
userMessage(string)Output:
${llm.output}
Configure the LLM tool:
API: Chat
Deployment name: Deployed GPT model
Temperature: 0.7
Response format:
{ "type": "text" }
Prompt Template
system:
You are an enterprise assistant. Respond clearly and concisely.
user:
{{userMessage}}
- Test the Prompt Flow
Step 5: Deploy the Prompt Flow
Select Deploy
Choose Online endpoint
Wait for deployment to succeed
Copy the following values:
Target URI (ends with
/score)Deployment API Key
This endpoint will be used by Power Automate.
Prerequisites Checklist
Before configuring Power Automate, ensure:
AI Foundry Hub is created
Project is created
Prompt Flow is created and tested
Prompt Flow uses the Chat API
Input parameter
userMessageexistsPrompt Flow is deployed as an Online endpoint
Deployment state is Succeeded
Target URI and API key are available
Power Automate Configuration
Step 6: Create the Power Automate Flow
Go to Power Automate
Select Create → Automated cloud flow
Flow name:
Teams-AI-Foundry-DemoTrigger: When a new message is added to a chat or channel
Step 7: Get Message Text from Teams
Add action:
Configure:
Message ID from trigger
Message type: Channel
Team and Channel from trigger
Step 8: Extract Plain Text
Add a Compose action with the following expression:
body('Get_message_details')?['body']?['plainTextContent']
Example output:
/ai What is Azure AI Foundry?
Step 9: Check if Message Is an AI Command
Add a Condition action:
startsWith(outputs('Compose'), '/ai')
Proceed only if the condition evaluates to true.
Step 10: Call Azure AI Foundry Prompt Flow
Add an HTTP action:
Method: POST
URI:
<Prompt Flow Target URI>/scoreHeaders:
Content-Type: application/json
Authorization: Bearer
<DEPLOYMENT_API_KEY>
Body
{
"userMessage": "@{trim(replace(outputs('Compose'), '/ai', ''))}"
}
Step 11: Parse the AI Response
Add a Parse JSON action using this schema:
{
"type": "object",
"properties": {
"output": {
"type": "string"
}
}
}
Step 12: Reply Back to Teams
Add action:
- Microsoft Teams – Reply with a message in a channel
Configure:
Reply to message ID from trigger
Message:
AI Response:
@{body('Parse_JSON')?['output']}
Testing the Demo
In Microsoft Teams, post:
/ai What is Azure AI Foundry?
Expected outcome
Power Automate flow runs successfully
Prompt Flow is invoked
AI response is posted in the same Teams conversation thread
Why This Approach Works Well for Enterprises
No custom bot framework required
Low-code and easy to maintain
Secure, Azure-native AI integration
Easily extensible for summarization, RAG, HR, IT support, or internal assistants




