Azure Variables
The Azure pipelines we’re creating use the same environment variables. To help reduce some of the duplication in the YAML pipeline definitions, we’ll create and use an Azure Pipelines Variable Group.
Environment Variables
Here are the variables we’ll be setting.
- ARM_CLIENT_ID: Azure client id. The client id along with the other
ARM_*
variables, give the Azure Pipelines CI machine permissions to create Azure infrastructure resources. You can create an “app client id” with these instructions Register an application with Azure AD. The Terraspace Azure Getting Started Guide: Configure also cover setting up and getting this variable. It will be on the App Registration / Overview page. - ARM_CLIENT_SECRET: Azure client secret. The client secret is on the App Registration / Certificates & secrets page, under the Client secret tab.
- ARM_SUBSCRIPTION_ID: Azure subscription id. This is under the Subscriptions portal page. Note, this is a different page than the App Registrations pages.
- ARM_TENANT_ID: Azure client id. Like the client id, the tenant is also available on the App Registration / Overview page.
- TS_TOKEN: This allows Terraspace work with Terraspace Cloud. IE: Save plans, applies, cost etimates, live streams, etc.
- INFRACOST_API_KEY: You will need an infracost API key if you are using Cost Estimation.
Here’s the App Registration / Overview page.
Here’s the App Registration / Certificates & secrets page.
Create Variable Group
To create a Variable Group:
- Go Pipelines on the left hand side
- Go to Library
- Click + Variable Group to create a new one called common-variables
- Add these variables:
ARM_CLIENT_ID
,ARM_CLIENT_SECRET
,ARM_SUBSCRIPTION_ID
,ARM_TENANT_ID
,TS_TOKEN
andINFRACOST_API_KEY
(if you’re using cost estimates)
Here’s the + Variable Group button.
Here’s the form.
Next, we’ll create and review the Main Push Pipeline.