Home / Creating an Azure Service Principal for use with an Azure Resource Manager service connection

Overview

In this lab, you will learn about how to create an Azure service principal that can be used to integrate Azure DevOps Server with Azure services hosted in the cloud.

Exercise 1: Creating an Azure Service Principal for use as an Azure Resource Manager service connection

Task 1: Creating an Azure Resource Manager service connection

  1. Open a browser window to your Azure DevOps Server 2019.

  2. Navigate to Project settings.

  3. Navigate to Pipelines | Service connections.

  4. From the New service connection dropdown, select Azure Resource Manager.

  5. Set the Connection name to something descriptive. You will need to create a service principal in Azure in the next task to fill out the remaining fields.

Task 2: Creating an Azure service principal

  1. Log in to your Azure account at https://portal.azure.com in a new browser tab.

  2. Click the Cloud Shell button to launch the Cloud Shell.

  3. Make sure the Environment is set to Bash.

  4. The command below will create a service principal with the name ‚ÄúServicePrincipalName‚ÄĚ. Replace the value and execute the command in the cloud shell.

     az ad sp create-for-rbac --name ServicePrincipalName
    
  5. Azure will generate an appID, which is the Service principal client ID used by Azure DevOps Server. It will also generate a strong password, which is the Service principal key. The final value of interest is the tenant, which is the Tenant ID. Copy these values to the service connection form in the other tab.

  6. Execute the command below to retrieve details about your Azure subscription.

     az account show
    
  7. The id is the Subscription ID you need to create the service connection. The name is the Subscription name you need. Copy these values as well.

  8. The form should now be complete. Click Verify connection to make sure the values work as expected. Click OK when verified. You will now be able to reference this connection from release pipeline tasks.