agentleFS
tsubakimototsubakimoto/skills/github-entra-federated-credentials/SKILL.md

github-entra-federated-credentials

Skill2 starsChanged 8 months agoMITView on GitHub

Sets up Entra ID federated credentials so GitHub Actions can authenticate to Azure using OIDC (workload identity federation) — no client secrets required. USE THIS SKILL whenever the user wants to: connect GitHub Actions to Azure, configure Azure login from GitHub Actions, set up OIDC or workload identity federation between GitHub and Azure, avoid storing Azure credentials as GitHub secrets, configure Entra ID / Azure AD app registration for a GitHub repository, use azure/login@v2 in a workflow, or get a "AADSTS700213: No matching federated identity record" error. Invoke this skill even if the user just says "set up Azure access from GitHub", "let GitHub Actions deploy to Azure", or "configure my Actions to use Azure".

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 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.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ask the user for any missing values before running the script:

    line 34

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

What this skill does

Automates the complete Entra ID federated credentials setup for a GitHub repository:

  1. Creates an Entra app registration and service principal
  2. Fetches the GitHub owner ID and repository ID (needed for the correct OIDC subject)
  3. Creates a federated credential with the right subject format
  4. Creates the GitHub Environment if it doesn't exist
  5. Registers AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_SUBSCRIPTION_ID as secrets

Prerequisites

Before running, verify:

  • az CLI installed and logged in (az login)
  • gh CLI installed and logged in (gh auth login)
  • User has permission to create app registrations in the Entra tenant

Inputs to collect

Ask the user for any missing values before running the script:

ArgumentDescriptionExample
--app-nameDisplay name for the Entra appmy-github-actions-app
--repoGitHub repo in owner/repo formatmyorg/myapp
--environmentGitHub Environment nameProduction
--resource-groupResource group for Contributor role assignment (optional)rg-myapp

Running the setup script

Collect all required inputs from the user first, then run the script for their environment.

Windows (PowerShell):

pwsh "<skill_dir>/scripts/setup.ps1" `
  -AppName "<app name>" `
  -Repo "<owner/repo>" `
  -Environment "<env name>" `
  [-ResourceGroup "<rg name>"]

macOS / Linux (Bash):

bash "<skill_dir>/scripts/setup.sh" \
  --app-name "<app name>" \
  --repo "<owner/repo>" \
  --environment "<env name>" \
  [--resource-group "<rg name>"]

<skill_dir> is the directory containing this SKILL.md file.

OIDC subject format — why IDs matter

GitHub's OIDC tokens use a subject in this format:

repo:{owner}@{owner_id}/{repo}@{repo_id}:environment:{env}

This is not the same as repo:{owner}/{repo}:environment:{env}. The numeric owner and repository IDs must be included. The script fetches them automatically via gh api. Registering the wrong subject causes AADSTS700213 errors at runtime.

After setup

The workflow template printed by the script is ready to use. The three secrets (AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_SUBSCRIPTION_ID) are scoped to the specified GitHub Environment, so the workflow must declare environment: <env name>.

Troubleshooting

ErrorLikely causeFix
AADSTS700213Subject mismatch in federated credentialRe-run setup; check owner/repo IDs
gh secret set failsEnvironment doesn't existScript creates it via gh api PUT first
az ad app federated-credential create failsInline JSON quoting issueScript uses a temp file — should not occur
Role assignment failsInsufficient permissionsAssign manually or use a privileged account

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.