Step 4: GitHub and Pulumi state
Create the GitHub environments, set their variables and secrets, then initialize one Pulumi stack per environment.
Environments
- Create environments dev, test, prod and preview. Create only the ones you bootstrapped.
- Require a production reviewer.
- Restrict dev/test/prod deployments to protected
v*tags. This also blocks PR-controlled workflows from requesting them. - Require a reviewer for preview.
- For the first rollout, also require a test reviewer to validate dev before promotion.
- Restrict release-tag creation to maintainers.
- After configuring protected preview, set repository variable
ENABLE_AZURE_PREVIEW=true. Without it, public CI runs local checks and skips Azure previews.
- If you deploy only dev, or dev and test, set repository variable
LAST_ENVIRONMENTtodevortest(step 5).
Warning: Only prod has Pulumi deletion protection and a delete lock. Use an installation without prod for trials, not for data you must keep.
Variables and secrets
Set these in each environment:
| Type | Name | Value |
|---|---|---|
| Variable | AZURE_CLIENT_ID | That environment’s deployment identity from bootstrap |
| Variable | AZURE_TENANT_ID | Company tenant ID |
| Variable | AZURE_SUBSCRIPTION_ID | Target subscription |
| Variable | AZURE_STORAGE_ACCOUNT | Bootstrap state-storage account |
| Variable | PULUMI_BACKEND_URL | azblob://pulumi-dev, azblob://pulumi-test or azblob://pulumi-prod |
| Variable | PULUMI_STACK_CONFIG | The full contents of that environment’s infra/Pulumi.<env>.yaml |
| Secret | PULUMI_DEV_CONFIG_PASSPHRASE, PULUMI_TEST_CONFIG_PASSPHRASE or PULUMI_PROD_CONFIG_PASSPHRASE | Only the matching environment’s distinct passphrase |
| Secret | ADMIN_GROUP_ID | Entra administrator group object ID |
| Secret, if using an existing registration | AUTH_CLIENT_SECRET | Its client secret value |
- To build your own image, also set repository variable
AZURE_CONTAINER_REGISTRYto the registry name from bootstrap. - Use a different state-encryption passphrase for each environment.
Initialize Pulumi state
When initializing a stack locally, use that environment’s matching passphrase and backend.
-
Grant the setup operator Storage Blob Data Contributor on the state container. For dev, grant it to the signed-in account:
az role assignment create --assignee-object-id "$(az ad signed-in-user show --query id --output tsv)" --assignee-principal-type User --role "Storage Blob Data Contributor" --scope "/subscriptions/YOUR-SUBSCRIPTION-ID/resourceGroups/YOUR-STATE-RESOURCE-GROUP/providers/Microsoft.Storage/storageAccounts/youruniquestorageaccount/blobServices/default/containers/pulumi-dev" - Set
AZURE_STORAGE_ACCOUNTandPULUMI_CONFIG_PASSPHRASEin the terminal from the approved settings/secret store. -
Run from the repository root:
cd infra && pulumi login azblob://pulumi-dev && pulumi stack init dev - Repeat separately for test and prod with their matching backend and passphrase.
- For existing stacks, run
pulumi stack select ENVIRONMENTinstead of initializing again. - Set up the protected preview environment as described in the operator guide.
- Return to the repository root for Make commands.
Local preview
For a local preview, set the dev administrator-group secret interactively:
cd infra && pulumi config set --stack dev --secret isa9000:adminGroupId
- Pulumi writes this encrypted value into the local stack file.
- The release workflow injects it from GitHub secrets.
Warning: Keep the stack file value out of commits. Back up the private backend state together with its passphrase.