Authentication and Azure Managed Identities
Learn how to create a service connection and enable MSI.
Setting up an Azure DevOps service connection
In this lesson, we will configure our Azure DevOps service connection. It is necessary for our pipelines to get access to our subscription and to be able to create resources.
PowerShell vs. CLI
Until now, we have been using PowerShell to run our commands using the terminal. However, DevOps requires us to use the CLI so we will be using that moving forward. This means that we will have to authenticate the CLI interactively. We will use the az login
command to log in.
CLI
To set up a service connection, we will need to create a service principal. This can be done with the following command:
az ad sp create-for-rbac --name ServicePrincipalName
The output for this command includes a password key. Copy this value and paste it somewhere safe as it can not be retrieved again.
Before running the code below, you may notice that there are three API keys required. Once you run your code and get your output, please update these keys so that they may be used again in the upcoming terminals.
Get hands-on with 1400+ tech skills courses.