Skip to content
Get Started for Free

Overview

Running integration tests against real Azure in CI means maintaining subscriptions and service principals, waiting on slow provisioning, and sharing test environments with every other pipeline. LocalStack replaces all of that with an emulator that runs inside the CI job itself. Deploy with the same Azure CLI scripts, Bicep templates, or Terraform configurations you already use in production, run your test suite against the emulated Azure APIs, and discard the environment when the job ends. Every run gets a fresh emulator instance, and no test ever needs a real Azure subscription.

The following diagram illustrates a typical CI workflow, using LocalStack instead of the Azure cloud:

A CI/CD workflow using LocalStack for Azure: a push to GitHub triggers a GitHub Actions workflow, which installs lstk, starts the Azure emulator, deploys resources, runs the tests, and collects the logs; when the tests pass, the CD pipeline deploys to a real Azure subscription.

A CI build is triggered when you push source code to your version control repository (such as GitHub). The CI runner checks out the source code, then runs a sequence of build and test steps. Where those tests depend on Azure services, they run against the LocalStack emulator rather than the real Azure cloud. You create the resources they need with the same tools you use with Azure, such as the Azure CLI, Bicep, or Terraform.

If the tests pass, your CD pipeline takes over and deploys the application to real Azure infrastructure. A deployment therefore only ever starts from a build that has already been validated against emulated Azure, which increases your confidence in the code you ship.

The steps required to run LocalStack in CI are largely the same, no matter which CI provider you use:

  1. Expose a CI Auth Token
  2. Install the lstk CLI and related tools
  3. Start the emulator
  4. Deploy the resources you need
  5. Run your tests
  6. Collect the output logs

Start with the CI Best Practices page for the commands behind each step. GitHub Actions is the CI provider tested with the Azure emulator so far, and its page shows a complete workflow.

Was this page helpful?