This was written by Jack Roper, a guest blogger.
Getting Scalr working with Azure DevOps takes three stages. This series of three posts walks through each one step by step.
This is the second post in the series that will focus on stage 2 — how to add Azure credentials and link them to an environment.
If you missed the first post in the series, check it out here — picking a workflow.
Post 3 covers how to execute your Terraform code and create a workspace, both with PR automation and by plugging the CLI into Azure DevOps. There is a third way to create a workspace using the module registry, but that still relies on the VCS connection.
To authenticate with our cloud provider (Microsoft Azure), we need to give Scalr some credentials. Scalr stores credentials in a central location so you can share them across workspaces. They can also be shared across environments, and with provider configurations you can define multiple configurations of the same provider type within an environment. The credentials are encrypted and are stored securely. Credentials are passed to all workspaces in the environment as shell variables. That way the team can restrict who has access to the credentials, and new workspaces inherit them automatically.
This post also covers how to create those credentials in Azure as an Azure Active Directory app registration and assign it an appropriate role.
We will be using Terraform with Scalr to deploy infrastructure to Azure. In the third and final post, we will show how, when a Terraform run is executed within a workspace, the provider credentials are passed to the run automatically as a shell variable.


Alternatively, if you already have credentials added, hit the icon top left again, and select 'provider credentials' from the drop-down.




Press register. On the next screen copy the details shown in the essentials section.

Next click on secrets -> new client secret

Enter the description and the expiry date.

Press add, then copy the secret value. You will only be able to see this once.
Next, we need to give the app registration permission to the Azure Subscription we want to use with Scalr. Browse to your subscription, and click on Access Control (IAM).

Click role assignments, then add -> add role assignment.

Here I choose contributor (has full access to the subscription but cannot change permissions) then hit next.
Choose 'Select members and in the search bar type the name of the app registration you set up earlier.


Press select, then review & assign.


Press save. If the connection is successful, your subscription will show in the drop-down subscription menu. Select it and press Save.


Select the environment, and then the Provider Credentials tab.

Across from the Azure provider, hit Link, then select the tickbox next to the provider credential we created earlier.


Lastly, press save!
In this post, we have shown how to create an App Registration in Azure, assign it a role in the subscription, and successfully add it to Scalr as a provider credential. We then linked the provider credential to the Scalr environment.
In the previous post, we linked Scalr to our Azure DevOps VCS provider.
In the next post, we will execute some Terraform code to deploy infrastructure to Azure!
Cheers! 🍻