sdaf-gh-oidc-and-auth
Skill1 starsChanged 3 months agoMITView on GitHub
Action-loop skill for authenticating the SDAF GitHub Actions workflows to Azure. Two independent layers must both be right: (1) `azure/login` uses an OIDC federated credential and reads `AZURE_ENVIRONMENT` + `AZURE_AUDIENCE`; (2) Terraform and Ansible authenticate separately via either a managed identity (`USE_MSI=true`, `MSI_ID`) or a service principal with `ARM_CLIENT_SECRET`, and always read `ARM_ENVIRONMENT`. This skill resolves `AADSTS7002381` (enterprise-claim tenant policy), `AADSTS7000215` / `AADSTS700016` (missing or expired `ARM_CLIENT_SECRET`), `AADSTS900382` (sovereign-cloud `ARM_ENVIRONMENT` not exported alongside ARM creds), and "`azure/login` succeeded but hit the wrong cloud". Invoke on Azure-login failures, OIDC federated-credential questions, MSI-vs-SPN choice, or sovereign-cloud identity configuration. Do NOT invoke for bootstrap mechanics or the setup utility (use `sdaf-gh-bootstrap`) or for the workflow catalogue (use `sdaf-gh-workflow-sequence`).
- Reads credentials
In this repository4 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- sdaf-gh-bootstrapSkill
- sdaf-gh-workflow-sequenceSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 43
Do NOT invoke for:
- Very specific: line 69
Identify which layer failed: Look at the failing step name.
- Very specific: line 82
If false, verify ARM_CLIENT_SECRET is set in the failing Environment and not expired.
- Very specific: line 122
Does not describe repo-creation, template-repo mechanics, or the setup utility → sdaf-gh-bootstrap.
- Very specific: line 124
Does not enumerate every workflow's inputs → sdaf-gh-workflow-sequence.
- Very specific: line 125
Does not describe workflow-07 behaviour (blocked in current docs).
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
sdaf-gh-oidc-and-auth
Diagnoses and configures the two independent authentication layers that every
SDAF GitHub Actions workflow uses to reach Azure: azure/login (OIDC) and
Terraform / Ansible (MSI or SPN + ARM_CLIENT_SECRET).
When to invoke
Concrete triggers:
- "
azure/loginfailed" / OIDC federated-credential errors. AADSTS7002381,AADSTS7000215,AADSTS700016,AADSTS900382.- "Which of MSI or SPN should I use?" / "Do I still need
ARM_CLIENT_SECRETif I'm on OIDC?" - "How is the OIDC subject built?" / "Immutable / ID-based sub claim."
- "
azure/loginconnected to the wrong cloud" / sovereign-cloud identity.
Do NOT invoke for:
- Creating the repo, running the setup utility, provisioning the GitHub
App, dispatching workflow
00→sdaf-gh-bootstrap. - Ordered
00-12catalogue →sdaf-gh-workflow-sequence.
The two layers (canonical)
The docs/troubleshooting.md § "Azure login fails" note is unambiguous:
azure/login and Terraform authenticate independently. azure/login
reads AZURE_ENVIRONMENT; the azurerm provider reads ARM_ENVIRONMENT.
See docs/troubleshooting.md § Azure login fails.
| Layer | What it uses | Reads | Fails if |
azure/login step | OIDC federated credential from GitHub | AZURE_ENVIRONMENT, AZURE_AUDIENCE | issuer/audience/subject mismatch, or tenant blocks the claim |
| Terraform / Ansible | MSI (USE_MSI=true + MSI_ID) or SPN (ARM_CLIENT_ID + ARM_CLIENT_SECRET) | ARM_ENVIRONMENT, ARM_CLIENT_ID, ARM_TENANT_ID, ARM_SUBSCRIPTION_ID, optionally ARM_CLIENT_SECRET | secret missing/expired, wrong cloud, wrong subscription |
Terraform does not consume the workflow's OIDC token. If USE_MSI=false
the SPN's ARM_CLIENT_SECRET must be present in the control-plane
Environment and every workload-zone Environment. See
docs/troubleshooting.md § Terraform fails with AADSTS7000215 or AADSTS700016
and docs/02-00-bootstrap.md § Choose authentication.
Recipe — diagnose an authentication failure
- Identify which layer failed. Look at the failing step name.
Azure Login,azure/login@...→ layer 1.terraform plan/apply,azurermprovider, Ansible calling ARM → layer 2. - For layer-1 failures, verify
AZURE_ENVIRONMENT,AZURE_AUDIENCE, and the OIDC subject registered on the app match the workflow'ssub_claim_prefix. Seedocs/02-00-bootstrap.md§ Configure cloud and OIDC behavior. - If layer 1 returns
AADSTS7002381, this is a tenant policy requiring an enterprise claim, not a misconfiguration. Route to a repository owned by a GitHub Enterprise organisation, or a tenant that does not enforce the policy. Seedocs/troubleshooting.md§ Azure login fails with AADSTS7002381. - For layer-2 failures, decide whether
USE_MSIistrueorfalse. Iffalse, verifyARM_CLIENT_SECRETis set in the failing Environment and not expired.AADSTS7000215/AADSTS700016== missing/expired secret. Seedocs/troubleshooting.md§ Terraform fails with AADSTS7000215 or AADSTS700016. - If layer 1 succeeded but the deploy hit the wrong cloud, the
azure/loginstep is missingenvironment/audienceand defaulted toAzureCloud. SetAZURE_ENVIRONMENT+AZURE_AUDIENCE(plusARM_ENVIRONMENT) at the step. Seedocs/troubleshooting.md§ azure/login succeeds against the wrong cloud. - For
AADSTS900382(sovereign),azurermfell back to Public Azure while identity lives in the sovereign tenant. ExportARM_ENVIRONMENTalongside ARM credentials in every Terraform step. Seedocs/troubleshooting.md§ Terraform fails with AADSTS900382 in a sovereign cloud.
Verify outcomes
- The failing step (or a
testre-dispatch on workflows03,05,12) now completes past the auth boundary. - Both
AZURE_ENVIRONMENTandARM_ENVIRONMENTare visible in the step-env dump and match the target cloud. - For sovereign clouds, the cloud matrix table in
references/cloud-matrix.mdreflects the documented values.
Hard rules
- Do not conflate the two layers. Setting
ARM_ENVIRONMENTalone does not fix anazure/logincloud mismatch; settingAZURE_ENVIRONMENTalone does not fix a Terraform cloud mismatch.docs/troubleshooting.md§ azure/login succeeds against the wrong cloud. GITHUB_TOKENis not a substitute forARM_CLIENT_SECRET. Terraform does not consume the OIDC token in this template.docs/troubleshooting.md§ Terraform fails with AADSTS7000215 or AADSTS700016.- Enterprise-claim tenant policy (
AADSTS7002381) is not fixable inside the workflow. It requires org ownership or a tenant that does not enforce the policy.docs/troubleshooting.md§ Azure login fails with AADSTS7002381.
What this skill does NOT do
- Does not describe repo-creation, template-repo mechanics, or the setup
utility →
sdaf-gh-bootstrap. - Does not enumerate every workflow's inputs →
sdaf-gh-workflow-sequence. - Does not describe workflow-
07behaviour (blocked in current docs).
See also
sdaf-gh-bootstrapsdaf-gh-workflow-sequencereferences/cloud-matrix.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

