🤖 Agentic AI · Enterprise Use Case

Building a Copilot Studio
HR Agent from Scratch

End-to-end guide: knowledge sources, topics, authentication, and Power Automate integration in a production-ready agent.

May 2026 ~15 min read Intermediate · Enterprise
Copilot Studio SharePoint KB Power Automate Microsoft Teams Entra ID Auth HR Onboarding

Most Copilot Studio tutorials end at "Hello World." This one doesn't. We're building a production HR agent — connected to a real SharePoint knowledge base, triggering Power Automate flows for leave requests, authenticated via Entra ID, and deployed to Microsoft Teams. Every step is the way you'd actually do it in an enterprise environment.

70%
HR ticket reduction in 90 days
4–6hrs
Saved per new hire onboarding
$200/mo
Starting cost · 25K messages
01
Before You Start

Prerequisites & Licensing

Before opening Copilot Studio, make sure your environment has the following. Skipping this causes broken flows and auth failures later.

⚠️

Environment tip: Never build production agents in the Default environment. Create a dedicated Power Platform environment (e.g., "HR-Production") with its own DLP policies. This is the most common enterprise governance mistake.

Before building, verify your Power Platform DLP policy allows the connectors you'll use:

Power Platform Admin Center · DLP Check
# Power Platform Admin Center → Policies → Data policies
# Verify these connectors are in "Business" data group:

✓ SharePoint           ← Knowledge base reads
✓ Microsoft Teams      ← Deployment channel
✓ Office 365 Users     ← User profile lookup
✓ Office 365 Outlook   ← Leave approval emails
✓ Approvals            ← Manager approval flow

# If any are in "Non-business" — move them before proceeding
# Cross-group connectors will block flow execution silently

✦
02
Design

Agent Architecture Overview

Before writing a single topic, understand what you're building. Our HR agent has three layers: a conversation layer (Copilot Studio topics), a knowledge layer (SharePoint), and an action layer (Power Automate flows).

👤
Employee
via Teams
→
🤖
Copilot Studio
Agent
→
📚
SharePoint
Knowledge
→
⚡
Power Automate
Flow
→
✅
Manager
Approval
💡

2026 update: Copilot Studio now supports autonomous triggers — agents that fire proactively on events (new employee record created in Dataverse, email received) rather than waiting for a user message. We'll show how to configure this for the onboarding flow.


✦
03
Setup

Create the Agent in Copilot Studio

Paste this in the "Describe your agent" field

You are an HR Assistant for a mid-size enterprise. You help employees with onboarding questions, leave requests, HR policy questions, and benefits information. You are professional, friendly, and concise. You have access to HR policy documents on SharePoint. For leave requests, you collect the employee's name, leave type, start date, and end date, then submit for manager approval. If you cannot answer a question, escalate to the HR team at hr-support@company.com. Never discuss payroll figures, disciplinary actions, or performance review details.

Copilot Studio · Agent Settings
# Settings → General
Agent Name:        "HR Assistant"
Icon:              Upload your company HR logo or use 👥
Language:          English (United States)  ← set primary language

# Settings → AI capabilities
Generative AI:     Enabled   ← powers policy Q&A without manual topics
Orchestration:     Generative ← agent dynamically routes intent (2026 default)

# Settings → Security
Authentication:    Azure Active Directory  ← configure in Step 07
Require sign-in:   Yes  ← essential for leave requests (identity verification)
✅

Pro tip: Enable Generative Orchestration (now default in 2026). This lets the agent dynamically decide which topic or knowledge source to use based on intent — you don't need to manually map every possible phrase to a trigger.


✦
04
Knowledge Sources

Connect SharePoint Knowledge Base

This is where your agent gets its intelligence. Instead of manually authoring answers for every possible HR question, you point the agent at your SharePoint document library and it uses generative AI to answer naturally.

SharePoint · HR Site Structure
HR Site (https://company.sharepoint.com/sites/HR)
├── HR Policies/
│   ├── Leave-Policy-2026.pdf
│   ├── Code-of-Conduct.pdf
│   ├── Remote-Work-Policy.pdf
│   └── Performance-Review-Process.pdf
├── Benefits/
│   ├── Health-Insurance-Guide.pdf
│   ├── Retirement-Plan-401k.pdf
│   └── Benefits-Enrollment-Deadlines.pdf
└── Onboarding/
    ├── New-Hire-Checklist.pdf
    ├── IT-Setup-Guide.pdf
    └── First-90-Days-Guide.pdf

# Keep documents in PDF or Word format — best indexing quality
# Use descriptive filenames — they influence search relevance
# Update documents in SharePoint → agent automatically re-indexes
⚠️

Permissions note: The agent respects SharePoint permissions. If an employee doesn't have access to a document, the agent won't surface its content to them. For broad HR Q&A, ensure your HR Policies library grants read access to all employees.


✦
05
Conversation Design

Build Topics & Conversation Flows

Topics are structured conversation paths for actions that need to collect specific data — like a leave request. Unlike policy Q&A (handled by generative AI from SharePoint), topics give you precise control over the flow.

Copilot Studio · Leave Request Topic
# Topic: Leave Request
# Trigger phrases (add at least 5 variations):
"I want to apply for leave"
"request time off"
"submit a leave request"
"I need to take leave"
"annual leave request"
"sick leave"

# Conversation nodes (in order):

Message:
  "I can help you submit a leave request. Let me collect a few details."

Question: LeaveType
  "What type of leave are you requesting?"
  Options: Annual Leave | Sick Leave | Parental Leave | Unpaid Leave

Question: StartDate
  "What is your leave start date?"
  Type: Date

Question: EndDate
  "What is your leave end date?"
  Type: Date

Question: LeaveReason
  "Would you like to add a reason? (Optional)"
  Type: Text

Confirm message:
  "You're requesting {LeaveType} from {StartDate} to {EndDate}.
  Shall I submit this for manager approval?"
  Options: Yes, Submit | No, Cancel

Call flow: Submit-Leave-Request  ← Power Automate (Step 06)

Message (on success):
  "Your leave request has been submitted. Your manager will receive
  an approval request and you'll be notified via Teams."

Add these as conversation starters in your agent settings — they appear as quick-reply buttons when employees first open the agent in Teams:

Copilot Studio · Conversation Starters
🏖️  "I want to request leave"
📋  "Show me the new hire onboarding checklist"
❓  "What is our work from home policy?"
💊  "When is benefits enrollment?"
📞  "I need to speak to someone in HR"
Live Preview · HR Agent · Policy Q&A via SharePoint
👤
How many days of annual leave do I get per year?
🤖
According to the Leave Policy 2026 document, full-time employees are entitled to 20 days of annual leave per calendar year. This increases to 25 days after 5 years of service. Leave accrues monthly and unused days can be carried over up to a maximum of 10 days. Would you like to submit a leave request?
👤
Yes please
🤖
I can help you submit a leave request. Let me collect a few details. What type of leave are you requesting?

🏖️ Annual Leave    🤒 Sick Leave    👶 Parental Leave    📋 Unpaid Leave

✦
06
Automation

Power Automate Integration

This is where the agent stops being a chatbot and becomes an actual business tool. The leave request flow collects data from the conversation, creates a SharePoint record, sends a manager approval, and notifies the employee — all automatically.

Power Automate · Leave Request Flow Steps
Trigger:  When Copilot Studio calls a flow
  Inputs: LeaveType, StartDate, EndDate, LeaveReason, EmployeeEmail

Step 1:  Get user profile (Office 365 Users)
  # Lookup employee's manager using EmployeeEmail
  Action: Get manager (V2)
  User: EmployeeEmail

Step 2:  Create SharePoint list item
  Site: https://company.sharepoint.com/sites/HR
  List: "Leave Requests"
  Fields:
    Employee:    EmployeeEmail
    LeaveType:   LeaveType
    StartDate:   StartDate
    EndDate:     EndDate
    Reason:      LeaveReason
    Status:      "Pending"
    SubmittedOn: utcNow()

Step 3:  Start approval (Approvals connector)
  Title:    "Leave Request: {EmployeeEmail} — {LeaveType}"
  Assigned: Manager email from Step 1
  Details:  "{LeaveType} from {StartDate} to {EndDate}. Reason: {LeaveReason}"

Step 4:  Condition — Approved or Rejected?
  If Approved:
    → Update SharePoint item Status = "Approved"
    → Send Teams message to employee: "✅ Your leave was approved!"
  If Rejected:
    → Update SharePoint item Status = "Rejected"
    → Send Teams message to employee: "Your leave request was not approved. Please contact HR."

Return to Copilot Studio:
  Output: Status  # "Submitted" — agent confirms to user
💡

SharePoint Leave Requests list setup: Create a list at your HR SharePoint site with columns: Employee (Person), LeaveType (Choice), StartDate (Date), EndDate (Date), Reason (Text), Status (Choice: Pending/Approved/Rejected), SubmittedOn (Date). The flow writes to this list automatically.


✦
07
Security

Authentication with Entra ID

Without authentication, any user could interact with the agent — and leave requests wouldn't know who's submitting them. We use Entra ID (Azure AD) so the agent knows exactly who it's talking to, automatically.

Entra ID · App Registration Setup
# Entra ID (portal.azure.com) → App registrations → New registration

Name:           "HR-Copilot-Agent"
Account type:   Accounts in this org directory only
Redirect URI:   Web → https://token.botframework.com/.auth/web/redirect

# After creation — note these values (needed in Copilot Studio):
Application (client) ID:  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Directory (tenant) ID:    xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

# Certificates & secrets → New client secret
Description:  "Copilot Studio Auth"
Expires:      24 months  ← calendar a renewal reminder now
Value:        copy immediately — only shown once

# API permissions → Add permission → Microsoft Graph → Delegated:
✓ User.Read           ← employee profile
✓ People.Read         ← manager lookup
✓ offline_access      ← token refresh
# Grant admin consent for all permissions
Copilot Studio · Authentication Settings
# Settings → Security → Authentication

Authentication type:  Azure Active Directory v2
Client ID:            paste Application (client) ID from App Registration
Client secret:        paste the secret value
Tenant ID:            paste Directory (tenant) ID
Scopes:               User.Read People.Read offline_access

Require authentication: Yes
# This means the agent always knows who the employee is
# You can use System.User.DisplayName in messages:
# "Hello {System.User.DisplayName}, how can I help you today?"
⚠️

Secret expiry: Client secrets expire. Set a calendar reminder for 2 months before expiry to rotate the secret. An expired secret silently breaks authentication — employees see "sign-in failed" with no clear error.


✦
08
Deployment

Deploy to Microsoft Teams

Deploying to Teams is where your agent becomes a first-class citizen in the employee's daily workflow — available in the Teams sidebar like any other app, with zero friction to start a conversation.

Teams Admin Center · App Approval
# Teams Admin Center (admin.teams.microsoft.com)
# Teams apps → Manage apps → Upload new app

# Upload the manifest .zip from Copilot Studio
# Set these policies before approving:

App status:     Allowed
Permissions:    Review and accept on behalf of org

# App setup policy → Add to pinned apps for HR-related groups
# This pins the agent in the Teams left sidebar for all employees
# Consider a phased rollout: pilot group first → full org

# Recommended Teams app description:
"Your HR Assistant — ask policy questions, request leave,
and get onboarding help. Available 24/7."
✅

Phased rollout tip: Use Teams app setup policies to deploy to a pilot group (e.g., one department) for 2 weeks before org-wide rollout. Monitor the Analytics dashboard in Copilot Studio for unrecognized intents and missed topics — this tells you what to add before scaling.


✦
09
Testing

Test Scenarios & Sample Prompts

Before go-live, run through these test scenarios in Copilot Studio's test pane. Each one validates a different capability of the agent.

Test · SharePoint Knowledge Retrieval
👤
Can I work from home every day?
🤖
According to our Remote Work Policy, employees may work from home up to 3 days per week, subject to manager approval. Fully remote arrangements require VP-level sign-off and are reviewed annually. Would you like me to send you a link to the full policy document?
Test · Leave Request Flow + Approval Trigger
👤
I need to take annual leave next week
🤖
I can help you submit a leave request. What type of leave are you requesting?

🏖️ Annual Leave   🤒 Sick Leave   👶 Parental Leave
👤
Annual leave
🤖
What is your leave start date?
👤
May 20
🤖
And your end date?
👤
May 23
🤖
You're requesting Annual Leave from May 20 to May 23 (4 days). Shall I submit this for manager approval?

✅ Yes, Submit    ❌ Cancel
Test · Graceful Escalation Handling
👤
I have a complaint about my manager
🤖
I understand. This type of concern is best handled directly by our HR team to ensure confidentiality and proper process. I've noted your request and will send your details to hr-support@company.com. A member of the HR team will reach out within 1 business day. Is there anything else I can help you with?
Test Pane · Prompts to Validate
# Onboarding
"What do I need to do on my first day?"
"How do I set up my laptop?"
"Where do I find the IT setup guide?"

# Policy Q&A
"What is the dress code policy?"
"How many sick days do I get?"
"What happens to unused leave at year end?"

# Leave
"I need maternity leave"
"Can I check the status of my leave request?"
"I need to cancel my leave"

# Edge cases (make sure these escalate gracefully)
"What is my salary?"           ← should NOT answer
"Who got a bonus this year?"    ← should NOT answer
"I want to report harassment"   ← must escalate to HR team

You've Built a Production-Ready HR Agent

What you've deployed isn't a demo. It's a fully authenticated, SharePoint-grounded, Teams-integrated agent that handles real HR workflows — with a Power Automate backbone and proper escalation handling for sensitive topics.

The same architecture scales to IT helpdesk (60% L1 auto-resolution), finance procurement Q&A, and compliance policy assistants. The pattern is identical — swap the knowledge source, redesign the topics, rewire the flows.

In 2026, the question isn't whether your organization should deploy Copilot Studio agents. It's how many are already running without governance. Build them right the first time.

Read next · More write-ups
Top 5 M365 Misconfigurations
Legacy auth, guest sprawl, missing DLP, over-privileged admins and email-auth gaps — each with detection and remediation.
12 min read
How I Passed the CLLMSP
A practitioner’s tour of the nine LLM-security domains, mapped to real enterprise AI and Copilot Studio deployments.
18 min read
Entra ID Conditional Access Gaps
Common Conditional Access bypass conditions — and how to build policies that actually hold under pressure.
14 min read
View all write-ups ↗