Skip to content

microsoftgraph/msgraph-sample-github-connector-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

page_type description products languages
sample
This sample demonstrates how to use the Microsoft Graph connector API to create a custom connector that indexes issues and repositories from GitHub.
ms-graph
github
copilot-m365
python

Microsoft Graph Python GitHub connector sample

License.

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.

Experiences

The Microsoft Graph connector experiences that will be enabled in the sample include:

Prerequisites

Register an app in Azure portal

  1. Go to the Azure Active Directory admin center and sign in with an administrator account.

  2. In the left pane, select Azure Active Directory, and under Manage, select App registrations.

  3. Select New registration.

  4. 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
  5. 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.

Run the application

  1. Install Azure Identity and Microsoft Graph SDK:

    python3 -m pip install azure-identity
    python3 -m pip install msgraph-sdk
  2. 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.

  3. Run the app:

    python3 main.py
  4. Create a connection: Select 1. Create External Connection from the menu, this step will require you to enter connection id,connection name and connection description to create the connector.

  5. 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.

  6. Load data: Select 3. Load GitHub Repositories from the menu, this step will require you to enter connection id of your connector and GitHub account name to load public GitHub repositories of the account in the connector.

Enable the connector in the Admin Center

  1. Open the Microsoft admin center in your browser.
  2. Select Settings, Search and intelligence, then Data sources.
  3. Search for your GitHub Connector name, then select Create Result type under the Required actions:
    1. Enter a name for the result type
    2. Select content source as your connector
    3. (Optional) Set rules for the result type
    4. Launch Layout Designer and select Result with url and description, then select Get started
    5. Enter name for the title property, htmlurl for the titleLink property and description for the description property, then select Create layout.
    6. Paste the JSON script that you created with Layout Designer and select Next.
    7. Select Add result type.
  4. Select Include Connector Results under the Requred actions.
  5. 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.

Code of conduct

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.

Contributing

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.

Trademarks

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.

About

This Python application shows how to create a Microsoft Graph connector for GitHub repos and issues.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages