![]()
Integrating Copilot into your Power Pages allows content managers, designers, and developers to leverage AI for writing, editing, summarizing, and customizing portal content. This greatly enhances productivity, maintains tone consistency, and simplifies the creation of user-friendly experiences across public or internal-facing portals.
This guide explores how to implement Copilot-style content assistance using Power Platform capabilities, OpenAI models, Power Automate, and Dataverse, while maintaining security and responsiveness.
1. Use Case Overview
The goal is to use AI to assist with content creation within a Power Pages portal. Potential use cases include:
- Auto-generating section headers, descriptions, or FAQs
- Summarizing large blocks of existing content
- Improving accessibility by rephrasing text
- Supporting multilingual translations
- Creating dynamic help content based on user input
- Assisting authors during portal design with intelligent suggestions
2. Solution Architecture Overview
The integration uses the following architecture:
| Component | Role |
|---|---|
| Power Pages | Front-end interface for content interaction |
| Power Automate | Backend processing and secure API interaction |
| OpenAI API | Source of generative AI responses |
| Dataverse | Stores queries, responses, and logs (optional) |
| Environment Variables / Azure Key Vault | Secure key storage |
3. Setting Up the Prerequisites
Before building the integration:
- Provision Power Pages site with content editing pages or forms
- Obtain OpenAI API key from https://platform.openai.com
- Create a Power Automate premium flow for API interaction
- (Optional) Create a Dataverse table for logging prompts and results
- Set up Azure Key Vault or Power Platform environment variables to store API keys securely
4. Creating the Power Automate Flow
Step 1: Trigger
- Trigger: When an HTTP request is received
- Request schema example:
{
"type": "object",
"properties": {
"prompt": {
"type": "string"
}
}
}
Step 2: HTTP (OpenAI) Action
- Method: POST
- URL:
https://api.openai.com/v1/chat/completions - Headers:
- Authorization:
Bearer [Your_OpenAI_API_Key] - Content-Type:
application/json
- Authorization:
- Body:
{
"model": "gpt-3.5-turbo",
"messages": [
{ "role": "system", "content": "You are a helpful assistant for portal content creation." },
{ "role": "user", "content": "@{triggerBody()?['prompt']}" }
]
}
Step 3: Return AI Response
- Add a
Responseaction to return the content:
{
"aiResponse": "@body('HTTP')?['choices']?[0]?['message']?['content']"
}
5. Connecting Power Pages to Copilot Flow
Step 1: Add HTML Interface in Web Page
<textarea id="promptBox" placeholder="Describe what content you need..."></textarea>
<button onclick="generateContent()">Generate</button>
<div id="responseArea"></div>
Step 2: JavaScript to Call Flow
<script>
async function generateContent() {
const prompt = document.getElementById("promptBox").value;
const responseArea = document.getElementById("responseArea");
const result = await fetch("YOUR_FLOW_URL", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ prompt: prompt })
});
const data = await result.json();
responseArea.innerText = data.aiResponse;
}
</script>
6. Example Prompts for Authors
Here are some author-friendly prompts you can embed or suggest:
- “Write a short welcome message for a portal homepage.”
- “Summarize this section: [paste paragraph].”
- “Translate this into French: [text].”
- “Make this content easier to understand.”
- “Create a FAQ section for [topic].”
7. Improving the Experience with UI Features
- Add dynamic placeholders that change based on portal section type
- Use modals or collapsible panels to display generated content
- Provide ‘Copy to clipboard’ functionality
- Integrate form-based AI prompts (e.g., topic, tone, length sliders)
8. Logging and Auditing with Dataverse
(Optional but recommended)
- Create a table: AI Content Suggestions
- Columns: Prompt, Response, Created By, Timestamp, Section
- Log each AI call via additional step in Power Automate
- Use for insights, auditing, or improving prompt effectiveness
9. Best Practices and Considerations
- Use short, clear prompts to get relevant results
- Guide users with sample phrases
- Store OpenAI key securely using environment variables or Azure Key Vault
- Avoid overuse by limiting calls per user per session
- Add disclaimer: “AI-generated content – please review before publishing”
- Optionally, use moderation to check inappropriate outputs
10. Expanding with Role-Based Assistance
You can tailor the experience by dynamically modifying prompts based on user roles:
| Role | Example Prompt Modifier |
|---|---|
| Content Creator | “You are writing a customer-facing web section.” |
| Developer | “Generate technical documentation.” |
| Analyst | “Write a summary of this data report.” |
