Skip to content

Commit ebfb10d

Browse files
Update OIDC setup script and tutorial to use master branch
1 parent 96ea1a5 commit ebfb10d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

blogs/series-5-devops-data/5.5-azure-oidc-github-actions.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ RESOURCE_GROUP="rg-talent-dev" # Resource group to manage
110110
LOCATION="eastus" # Azure region
111111
GITHUB_ORG="workcontrolgit" # Your GitHub username or org
112112
GITHUB_REPO="AngularNetTutorial" # Your repository name
113-
BRANCH="main" # Branch that triggers deployments
113+
BRANCH="master" # Branch that triggers deployments
114114
```
115115

116116
**`APP_NAME`** — this is the display name of the App Registration in Azure Entra ID. It appears in the Azure Portal under "App registrations" and in audit logs. Use a name that makes the purpose clear.
117117

118-
**`BRANCH`** — the federated credential is scoped to this exact branch. Tokens from `develop`, pull request branches, or forks will not be trusted. For this tutorial, `main` is the deployment branch. Article 5.6 shows how to trigger on pushes to `main`.
118+
**`BRANCH`** — the federated credential is scoped to this exact branch. Tokens from `develop`, pull request branches, or forks will not be trusted. For this tutorial, `master` is the deployment branch. Article 5.6 shows how to trigger on pushes to `master`.
119119

120120
### Step 2: Run the Script
121121

@@ -153,17 +153,17 @@ The App Registration is the identity definition. The Service Principal is the in
153153
az ad app federated-credential create \
154154
--id "$APP_ID" \
155155
--parameters '{
156-
"name": "github-actions-branch-main",
156+
"name": "github-actions-branch-master",
157157
"issuer": "https://token.actions.githubusercontent.com",
158-
"subject": "repo:workcontrolgit/AngularNetTutorial:ref:refs/heads/main",
158+
"subject": "repo:workcontrolgit/AngularNetTutorial:ref:refs/heads/master",
159159
"audiences": ["api://AzureADTokenExchange"]
160160
}'
161161
```
162162

163163
This is the trust configuration. It tells Azure Entra ID:
164164

165165
* **`issuer`** — tokens must be signed by GitHub's OIDC identity provider
166-
* **`subject`** — tokens must claim to be from exactly `repo:workcontrolgit/AngularNetTutorial:ref:refs/heads/main` — no other repo, no other branch
166+
* **`subject`** — tokens must claim to be from exactly `repo:workcontrolgit/AngularNetTutorial:ref:refs/heads/master` — no other repo, no other branch
167167
* **`audiences`** — the intended audience must be `api://AzureADTokenExchange` (Azure's OIDC exchange endpoint)
168168

169169
A token that matches all three conditions will be accepted. A token from a fork, a pull request branch, or a different repository is rejected by subject mismatch — even if it was legitimately signed by GitHub.
@@ -274,7 +274,7 @@ Find `github-actions-talent-dev`. Click it and navigate to:
274274
Certificates & secrets → Federated credentials
275275
```
276276

277-
You should see `github-actions-branch-main` with issuer `token.actions.githubusercontent.com`.
277+
You should see `github-actions-branch-master` with issuer `token.actions.githubusercontent.com`.
278278

279279
To verify the role assignment:
280280

@@ -294,7 +294,7 @@ The output should include a row with `Contributor` assigned to `github-actions-t
294294

295295
**Resource group scope, not subscription scope.** Granting `Contributor` at the subscription level would allow the deployment identity to create, modify, or delete any resource in the subscription — including the spending-limit configuration. Scoping to `rg-talent-dev` limits the blast radius: even a compromised token can only affect resources in that resource group.
296296

297-
**Branch-specific federated credential.** The `subject` claim in the federated credential locks trust to `refs/heads/main`. A pull request branch, a feature branch, or a fork cannot obtain an Azure access token using this credential. This prevents a malicious pull request from running arbitrary Azure CLI commands against the subscription.
297+
**Branch-specific federated credential.** The `subject` claim in the federated credential locks trust to `refs/heads/master`. A pull request branch, a feature branch, or a fork cannot obtain an Azure access token using this credential. This prevents a malicious pull request from running arbitrary Azure CLI commands against the subscription.
298298

299299
**GitHub CLI (`gh`) for secret management.** Using `gh secret set` in the script eliminates manual copy-pasting. Manual steps introduce transcription errors and require the person running the script to have browser access to GitHub repository settings. The script runs end-to-end from the terminal with no manual steps except the SQL password.
300300

infra/scripts/setup-oidc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ RESOURCE_GROUP="rg-talent-dev" # Resource group the deployment identity
2828
LOCATION="eastus" # Azure region for the resource group
2929
GITHUB_ORG="workcontrolgit" # GitHub organisation or username
3030
GITHUB_REPO="AngularNetTutorial" # GitHub repository name (no owner prefix)
31-
BRANCH="main" # Branch that triggers deployments
31+
BRANCH="master" # Branch that triggers deployments
3232
# ──────────────────────────────────────────────────────────────────────────────
3333

3434
echo ""

0 commit comments

Comments
 (0)