Microsoft Graph connectors let you add your own data to the semantic search index and have it power various Microsoft 365 experiences. This TypeScript application shows you how to use the Microsoft Graph connector API to create a custom connector that indexes issues and repositories from GitHub. This connector sample powers experiences such as Microsoft Search, Copilot in Teams, the Microsoft 365 App, and more.
The Microsoft Graph connector experiences that will be enabled in the sample include:
- Microsoft Search
- Context IQ in Outlook on the web
- Microsoft 365 Copilot
- Microsoft 365 app: Quick Access & My Content
- Type Down Suggestions (Query formulation)
- Simplified admin experience in the Teams admin center (Microsoft 356 App)
- Install Python and pip
- A Microsoft work or school account with the Global administrator role. If you don't have a Microsoft account, you can sign up for the Microsoft 365 Developer Program to get a free Microsoft 365 subscription
- A GitHub account
- Enable the simplified admin experience in the Teams admin center
-
Go to the Azure Active Directory admin center and sign in with an administrator account.
-
In the left pane, select Azure Active Directory, and under Manage, select App registrations.
-
Select New registration.
-
Complete the Register an application form with the following values, and then select Register.
- Name:
GitHub Connector
- Supported account types: Accounts in this organizational directory only
- Redirect URI: Leave blank
- Name:
-
On the GitHub Connector overview page, copy the values of Application (client) ID and Directory (tenant) ID. You will need both in the following section.
-
Install Azure Identity and Microsoft Graph SDK:
python3 -m pip install azure-identity python3 -m pip install msgraph-sdk
-
Select config.sfg from the project root, replace
<your-client-id>
with your Application (client) ID and replace<your-tenant-id>
with your Directory (tenant) ID. -
Run the app:
python3 main.py
-
Create a connection: Select 1. Create External Connection from the menu, this step will require you to enter
connection id
,connection name
andconnection description
to create the connector. -
Create a schema: Select 2. Create Schema from the menu, this step will require you to enter the
connection id
of the connector you created earlier and create a schema for your connector. -
Load data: Select 3. Load GitHub Repositories from the menu, this step will require you to enter
connection id
of your connector andGitHub account name
to load public GitHub repositories of the account in the connector.
- Open the Microsoft admin center in your browser.
- Select Settings, Search and intelligence, then Data sources.
- Search for your GitHub Connector name, then select Create Result type under the Required actions:
- Enter a name for the result type
- Select content source as your connector
- (Optional) Set rules for the result type
- Launch Layout Designer and select Result with url and description, then select Get started
- Enter name for the title property, htmlurl for the titleLink property and description for the description property, then select Create layout.
- Paste the JSON script that you created with Layout Designer and select Next.
- Select Add result type.
- Select Include Connector Results under the Requred actions.
- Search for your repository name in Microsoft SharePoint, Microsoft Office, or Microsoft Search in Bing, you should be able to see your GitHub repository result card with name, url and description.
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 welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
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.