|
| 1 | +--- |
| 2 | +title: "Tutorial: Connect an ADO Repository with Managed Identity in Azure SRE Agent" |
| 3 | +description: Connect an Azure DevOps repository to your agent using managed identity authentication. |
| 4 | +ms.topic: tutorial |
| 5 | +ms.service: azure-sre-agent |
| 6 | +ms.date: 03/30/2026 |
| 7 | +author: dm-chelupati |
| 8 | +ms.author: dchelupati |
| 9 | +ms.ai-usage: ai-assisted |
| 10 | +ms.custom: managed identity, azure devops, ado, repository, tutorial |
| 11 | +--- |
| 12 | + |
| 13 | +# Tutorial: Connect an ADO repository with managed identity in Azure SRE Agent |
| 14 | + |
| 15 | +Connect an Azure DevOps repository to your agent using managed identity—no PATs to create or rotate. Your agent uses its own Azure identity to access ADO repos for code-aware investigations. |
| 16 | + |
| 17 | +**Time**: ~10 minutes (including ADO admin setup) |
| 18 | + |
| 19 | +## Prerequisites |
| 20 | + |
| 21 | +- An Azure SRE Agent in **Running** state |
| 22 | +- A managed identity enabled on your agent (system-assigned or user-assigned) |
| 23 | +- An Azure DevOps organization with at least one repository |
| 24 | +- **SRE Agent Administrator** or **Standard User** role on the agent |
| 25 | + |
| 26 | +## Step 1: Grant the managed identity access to your ADO organization |
| 27 | + |
| 28 | +Before connecting from the agent portal, your managed identity must have access to the Azure DevOps organization. |
| 29 | + |
| 30 | +1. Go to your [Azure DevOps organization settings](https://dev.azure.com/) and select your organization. |
| 31 | +2. Navigate to **Organization settings** > **Users**. |
| 32 | +3. Select **Add users**. |
| 33 | +4. Search for your agent's managed identity by its service principal name or object ID. |
| 34 | +5. Set the access level to **Basic** (or higher). |
| 35 | +6. Add the identity to projects with **Code (Read)** permissions on the target repositories. |
| 36 | + |
| 37 | +**Checkpoint:** The managed identity appears in the ADO Users list with a Basic access level. |
| 38 | + |
| 39 | +## Step 2: Navigate to Knowledge sources |
| 40 | + |
| 41 | +1. Open your agent in the [Azure SRE Agent portal](https://sre.azure.com). |
| 42 | +2. In the left sidebar, expand **Builder**. |
| 43 | +3. Select **Knowledge sources**. |
| 44 | + |
| 45 | +**Checkpoint:** The Knowledge Sources page loads showing any existing repository connections. |
| 46 | + |
| 47 | +## Step 3: Open the Add Repository dialog |
| 48 | + |
| 49 | +Select **Add repository**. |
| 50 | + |
| 51 | +**Checkpoint:** The Add repositories dialog opens showing platform selection cards (GitHub, Azure DevOps). |
| 52 | + |
| 53 | +## Step 4: Select Azure DevOps with Managed Identity |
| 54 | + |
| 55 | +1. Select the **Azure DevOps** platform card. |
| 56 | +2. Under **Sign In Methods**, select **Managed Identity**. |
| 57 | + |
| 58 | +**Checkpoint:** The managed identity configuration form appears with an organization field and identity dropdown. |
| 59 | + |
| 60 | +## Step 5: Configure the managed identity connection |
| 61 | + |
| 62 | +1. Enter your Azure DevOps **Organization** name—the part after `dev.azure.com/` in your ADO URL. |
| 63 | +2. From the managed identity dropdown, select your identity: |
| 64 | + - **System assigned**—uses the agent's built-in identity |
| 65 | + - **User assigned**—select a specific identity attached to the agent |
| 66 | +3. Select **Connect**. |
| 67 | + |
| 68 | +**Checkpoint:** The button changes to **Connected** with a checkmark. |
| 69 | + |
| 70 | +> [!NOTE] |
| 71 | +> If the dropdown is empty, your agent might not have a managed identity enabled. Select the **Add identity** link below the dropdown to open the Azure portal Identity blade for your agent resource. |
| 72 | +
|
| 73 | +## Step 6: Advance to repository selection |
| 74 | + |
| 75 | +Select **Next** to proceed to the repository selection step. |
| 76 | + |
| 77 | +**Checkpoint:** The dialog advances to show a project picker and repository grid. |
| 78 | + |
| 79 | +## Step 7: Select a project and add repositories |
| 80 | + |
| 81 | +1. From the **Azure DevOps Project** dropdown, select the project containing your repositories. |
| 82 | +2. Select **Add** to add a repository row. |
| 83 | +3. From the **Repository** dropdown, select a repository from the project. |
| 84 | +4. Enter a **Display name** for the repository. |
| 85 | +5. Optionally enter a **Description**. |
| 86 | +6. Repeat for more repositories. |
| 87 | +7. Select **Save**. |
| 88 | + |
| 89 | +**Checkpoint:** Selected repositories appear in the Knowledge Sources page. |
| 90 | + |
| 91 | +## Troubleshooting |
| 92 | + |
| 93 | +| Problem | Cause | Fix | |
| 94 | +|---------|-------|-----| |
| 95 | +| Identity dropdown is empty | Agent has no managed identity enabled | Enable a system-assigned identity or attach a user-assigned identity in the Azure portal | |
| 96 | +| **Connect** button fails | Organization name is missing | Enter the ADO organization name before connecting | |
| 97 | +| Repos don't load after connecting | MI doesn't have access to the ADO organization | Add the MI service principal as a user in ADO Organization Settings > Users | |
| 98 | +| FIC connection fails | FederatedClientId and FederatedTenantId not both provided | Both fields are required when using FIC—provide both or neither | |
| 99 | + |
| 100 | +## Related content |
| 101 | + |
| 102 | +- [Managed identity for ADO repos](managed-identity-ado-repos.md) |
| 103 | +- [Connect knowledge sources](connect-knowledge.md) |
| 104 | +- [Set up Azure DevOps connector](azure-devops-connector.md) |
0 commit comments