Manually set an Azure Resource Manager workload identity service connection

When you troubleshoot an Azure Resource Manager workload identity service connection, you might need to manually configure the connection instead of using the automated tool that's available in Azure DevOps.

We recommend that you try the automated approach before you begin a manual configuration.

There are two options for authentication: use a managed identity or use a service principal with an app registration. The advantage of the managed identity option is that you can use it if you don't have permissions to create service principals or if you're using a different Microsoft Entra tenant than your Azure DevOps user.

Set a workload identity service connection to use managed identity authentication

To manually set up managed identity authentication for your Azure DevOps pipelines, follow these steps to create a managed identity in the Azure portal, establish a service connection in Azure DevOps, add federated credentials, and grant the necessary permissions. You'll need to follow these steps in this order:

  1. Create the managed identity in Azure portal.
  2. Create the service connection in Azure DevOps and save as a draft.
  3. Add a federated credential to your managed identity in Azure portal.
  4. Grant permissions to the managed identity in Azure portal.
  5. Save your service connection in Azure DevOps.

You can also use the REST API for this process.

Create a managed identity in Azure portal

  1. Sign in to the Azure portal.

  2. In the search box, enter Managed Identities.

  3. Select Create.

  4. In the Create User Assigned Managed Identity pane, enter or select values for the following items:

    • Subscription: Select the subscription in which to create the user-assigned managed identity.
    • Resource group: Select a resource group to create the user-assigned managed identity in, or select Create new to create a new resource group.
    • Region: Select a region to deploy the user-assigned managed identity (example: East US).
    • Name: Enter the name for your user-assigned managed identity (example: UADEVOPS).
  5. Select Review + create to create a new managed identity. When your deployment is complete, select Go to resource.

  6. Copy the Subscription, Subscription ID, and Client ID values for your managed identity to use later.

  7. Within your managed identity in Azure portal, go to Settings > Properties.

  8. Copy the Tenant Id value to use later.

Create a service connection for managed identity authentication in Azure DevOps

  1. In Azure DevOps, open your project and go to > Pipelines > Service connections.

  2. Select New service connection.

  3. Select Azure Resource Manager, and then select Next.

  4. Select Workload Identity federation (manual), and then select Next.

    Screenshot that shows selecting the Workload Identity service connection.

  5. For Service connection name, enter a value such as uamanagedidentity. You'll use this value in your federated credential subject identifier.

  6. For Subscription ID and Subscription Name, enter the values for the subscription in your Azure portal account.

    Screenshot that shows federated subscription credentials.

  7. In the authentication section:

    1. For Service Principal Id, enter the value of Client Id from your managed identity.

    2. For Tenant ID, enter the value of Tenant Id from your managed identity.

      Screenshot that shows Azure portal managed identity values.

  8. In Azure DevOps, copy the generated values for Issuer and Subject identifier.

    Screenshot that shows DevOps credentials for federated authentication.

  9. Select Keep as draft to save a draft credential. You can't complete setup until your managed identity has a federated credential in Azure portal.

Add a federated credential in Azure portal

  1. In a new browser window, within your managed identity in Azure portal, go to Settings > Federated credentials.

  2. Select Add credentials.

  3. Select the Other issuer scenario.

  4. Paste the values for Issuer and Subject identifier that you copied from your Azure DevOps project into your federated credentials in the Azure portal.

    Screenshot that shows a comparison of federated credentials in Azure DevOps and the Azure portal.

  5. Enter the Name of your federated credential.

  6. Select Add.

Grant permissions to the managed identity in Azure portal

  1. In Azure portal, go to the Azure resource that you want to grant permissions for (for example, a resource group).

  2. Select Access control (IAM).

    Screenshot that shows selecting Access control in the resource menu.

  3. Select Add role assignment. Assign the required role to your managed identity (for example, Contributor).

  4. Select Review and assign.

Save your Azure DevOps service connection

  1. In Azure DevOps, return to your draft service connection.

  2. Select Finish setup.

  3. Select Verify and save. Once this step successfully completes, your managed identity is fully configured.