หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
Connect your GitHub or Azure DevOps repository. Your agent can now perform root cause analysis by correlating production problems to specific code.
What you accomplish
By the end of this step, your agent:
- Analyzes source code during investigations
- Provides file:line references for problems
- Creates To-Do Plans that show investigation steps
- Correlates production symptoms to code changes
Prerequisites
| Requirement | Details |
|---|---|
| Agent created | Complete Step 1 first |
| GitHub or Azure DevOps account | Access to the repositories you want to connect |
Choose your authentication method
| Method | When to use |
|---|---|
| GitHub App | Use an organization-managed app with a Key Vault-backed signing key. Required for *.ghe.com. |
| Managed Identity | Connect Azure DevOps without a long-lived user credential. |
| OAuth | Sign in with your GitHub or Azure DevOps account. |
| PAT | Provide a personal access token with the minimum permissions required by the target service. |
Connect your repository
Connect a GitHub repository so your agent can index it as a knowledge source. The dialog shows a browsable list of your repositories. Select from the dropdown instead of typing URLs manually.
Step 1: Open the Add Repository dialog
During onboarding, select the Add repository card in the Knowledge Base step.
For an existing agent, go to Build + setup > Context > Code access, choose the service tab, and select Add repository.
Step 2: Choose a platform
Select GitHub or Azure DevOps.
On the Connection step, enter the full Repository URL for GitHub, or the Organization name for Azure DevOps.
Choose an existing connection if one is available, or configure a new connection.
Select the authentication method and complete its fields. GitHub offers OAuth, Personal access token (PAT), and Use your GitHub App. Azure DevOps offers Your account, Managed Identity, and PAT.
Complete the sign-in or connection test shown by the selected method. For method-specific instructions, see Connect a source code service.
Note
If the sign-in dialog doesn't appear, check that your browser isn't blocking popups from
sre.azure.com.Confirm the connection succeeds.
Select Next.
Step 3: Select repositories
On Add repositories, review the initial repository and add more entries as needed. The Repository URL field supports repository selection and direct URL entry:
GitHub repos appear as
org/repo-name, sorted alphabetically (up to 100 repos).Azure DevOps repos appear after you select a project from the Azure DevOps Project dropdown, sorted alphabetically.
Select a repository from the dropdown. The Display name autocompletes with the repository name. You can also type any valid repository URL directly into the field.
For GitHub, select Add repository to add entries. Expand each entry to edit its Display name or use Add description. For Azure DevOps, use Add and edit those fields in the grid.
Tip
The dropdown allows freeform typing. If your repository doesn't appear in the list (for example, if you have more than 100 repos), type the full URL directly.
Step 4: Confirm and save
Select Save. The repositories appear on the Code access page with their connection and last-sync information.
Step 5: Try creating a pull request (preview)
With your repository connected, your agent can now create pull requests directly from chat.
- Open a chat thread with your agent.
- Type a prompt like: "Create a PR in
https://github.com/OWNER/REPOfrom fix/my-branch to main titled 'Fix connection timeout'". - In Review mode, select Continue to approve the PR creation.
Your agent returns a tool card with a clickable link to the created PR.
Note
Create pull requests requires Review or Autonomous run mode. The source branch must already exist with your changes committed.
Manage connected repositories
The Code access page lists connected repositories and their connection names.
To remove a repository:
Use the following steps to remove a connected repository.
- Go to Build + setup > Context > Code access.
- Select the service tab and the repository's checkbox.
- Select Delete and review the confirmation before proceeding.
To update authentication: If your PAT expires or you need to switch accounts, reopen the Add Repository dialog and re-authenticate with new credentials.
Alternative: MCP + custom agent
To get full GitHub API access (search code, read files, and list commits across all repositories), connect GitHub as an MCP server with a dedicated custom agent.
This approach uses the Model Context Protocol (MCP) to connect GitHub tools to a custom agent. Follow the step-by-step tutorial, Set Up MCP Connector.
Your agent now analyzes source code during investigations, provides file and line references for problems, creates To-do Plans showing investigation steps, correlates production symptoms to code changes, and can create pull requests in connected repos directly from chat.
What you learned
- Your agent now analyzes source code during investigations.
- It provides file and line references for problems.
- It creates To-Do Plans that show investigation steps.
- It correlates production symptoms to code changes.
Related content
| Resource | Description |
|---|---|
| Root cause analysis | How your agent uses source code to find root causes. |
| Deep investigation | Extended multihypothesis analysis using connected repos. |
| Agent Playground | Test MCP tools and custom agents interactively. |
| Custom agents | How custom agents extend your agent's capabilities. |
| Connectors | All connector types and how they work. |