Microsoft 365 Copilot connectors for people data allows you to enrich or extend the views of people in your tenant with your own data and have it power various Microsoft 365 experiences, including the profile card, people search and Microsoft 365 Copilot chat. This .NET applications shows you how to build a Microsoft 365 Copilot connector for people data.
NOTE: This capability is currently in public preview.
For additional details please see the Build connectors with people data article.
Follow these instructions to configure, build and run the example.
This connector requires an Entra ID application to registered. Follow these steps to create a new Entra ID app registration for your people connector.
- Log in to the Azure Entra ID portal using a global administrator role.
- Select Applications > App registrations and click on + New registration.
- Type the name of your application in the Name text box. Ex ContosoHrConnector.
- Click Register to complete the registration.
- Select API Permissions and choose + Add a permission to add permissions to the app.
- Choose Microsoft Graph and then Application permissions and select the following permission scopes:
- ExternalConnection.ReadWrite.OwnedBy (required to create the connection and schema)
- ExternalItem.ReadWrite.OwnedBy (required to ingest people data)
- PeopleSettings.ReadWrite.All (required to add the connection as a profile source)
- Click Add Permissions and then click Grant admin consent for Contoso (replace Contoso with your organization’s name) to grant these permissions to the application. Select Yes to complete the grant.
- Select Certificates & secrets and create a new secret with + New client secret. Give it an appropriate description and expiry length and click Add.
- Note the Secret value and store it in a safe location.
- Click Overview and record the Application (client) ID and Directory (tenant) ID.
Tip
For production scenarios, consider modify the code and create two different applications—one to create the connection, schema, and perform the profile source registration, and another for the actual ingestion. Use Managed Identities for credentials instead of storing client secrets.
To connect the application to Microsoft Graph using the Entra ID app registration, run the following commands in the terminal window, in the src directory of the console application where you cloned or copied the sample code. Replace the client ID, tenant ID, and client secret with the values you stored in a safe location.
dotnet user-secrets init
dotnet user-secrets set settings:clientId <client-id>
dotnet user-secrets set settings:tenantId <tenant-id>
dotnet user-secrets set settings:clientSecret <client-secret>Next is to modify the code to match your tenants details. All places referred to below are marked with TODO: in the sample code.
- Update
src/appsettings.jsonto reflect the id and name of your connection (settings:connectorIdandsettings:connectorName). - Update the people data in
src/people.csv(or provide your own file path via--people-csv). The CSV must include a header row with these columns:UPN,Department,Position,FavoriteColor. Changes to the CSV must be reflected inPersonRecord.cs, for more information see below. - Update the schema registration and the sync command in
Program.csto reflect any changes to the CSV andPersonRecord.cs. - If you decide to add additional columns/properties for your people data, you must also update the schema (in the
setupCommand) and the people sync logic (in thesyncCommand).
This sample uses a command line interface (CLI).
- Use
dotnet run setupto create the Copilot connector using Microsoft Graph. - Use
dotnet run registerto register the connection as a source of people data. - Use
dotnet run syncto ingest the people data into Microsoft Graph. By default it readspeople.csvfrom the current directory; override withdotnet run sync --people-csv ./path/to/people.csv.
This sample loads people data from a CSV file using the PersonRecord type as the source of truth.
- Each public, writable property on
PersonRecordbecomes a CSV column. - Column names must match property names (case-insensitive). Example:
UPNmaps toPersonRecord.UPN.
PeopleCsvLoader supports these property types (including nullable variants like int?):
stringintdoubleDateTime(recommended format: ISO 8601 / round-trip, e.g.2026-01-08T13:45:00Z)bool(acceptstrue/false,1/0,yes/no,y/n,t/f)
Parsing uses invariant culture. For example, use 3.14 for doubles (not 3,14).
- Non-nullable value types (e.g.,
int,bool,DateTime) are required. - Nullable value types (e.g.,
int?,bool?,DateTime?) are optional. - For
string, non-nullablestringis required andstring?is optional.
If an optional column is missing from the CSV header entirely, it will be ignored and the property will keep its default value.
When you add/rename/remove a property in PersonRecord, you should:
- Update the CSV header to add/rename/remove the corresponding column.
- Update existing CSV rows to include values for any new required columns.
- If the new property is meant to flow into Microsoft Graph, update:
- the schema in the
setupcommand, and - the mapping logic in the
synccommand.
- the schema in the
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.