🔥Bootstrapping Azure Cloud to Your Terraform CI/CD

This blog series focuses on presenting complex DevOps projects as simple and approachable via plain language and lots of pictures. You can do it!

Kyler Middleton
The Startup
Published in
10 min readJan 6, 2020


Pairing Terraform with a CI/CD like Azure DevOps, Terraform Cloud, or GitHub Actions can be incredibly empowering. Your team can work on code simultaneously, check it into a central repo, and once code is approved it can be pushed out by your CI/CD and turned into resources in the cloud.

Photo from Skeeze@Pixabay

When you start rolling this out, you run into an immediate catch22 — you need a storage container to store the remote state in order to run terraform, but you need to run terraform in order to build these resources.

The best method I’ve found to get around this problem I’m calling “pivoting”. The basic order is:

  1. Run terraform from your local machine, and build the required remote resources.
  2. Tell terraform to use the remote state storage, then push your local .tfstate to the remote storage.
  3. Upload your terraform to the CI/CD, where it can access its state file and start building other cool things.

Let’s walk through the steps, and you’ll have an Azure account bootstrapped into your CI/CD before you can say “terraform can do that?”

Active Directory In the Cloud: Create a User

If you thought, like me, that migrating to an all-cloud Azure environment would let you get away from interacting with Microsoft’s Active Directory, you and I were both incorrect. The Azure cloud is deeply tied to Active Directory, and Microsoft presents it to you in a blade called “Azure Active Directory”.

Permissions for users and devices are managed here, so let’s start in the Azure Active Directory blade.

Along the left column, you’ll see all sorts of familiar active directory names. A local AD admin would call the functionality we’re looking for a “service account”. Because in the cloud we…



Kyler Middleton
The Startup

DevNetSecOps, DevRel, cloud security chick. I will teach you, it’s unavoidable. She/Her 🏳️‍🌈🏳️‍🌈, INFJ-A, support the EFF!