Troubleshooting
Each error below happened while building or verifying this setup, or is one
the reference repository guards against.
Automation (managed identity and workload identity)
| Symptom |
Cause |
AADSTS700213: No matching federated identity record found |
The federated credential's subject differs from GitHub's sub. The error shows what GitHub sent. Usually the repository uses immutable subjects (repo:<owner>@<id>/<repo>@<id>); read the prefix from gh api repos/<owner>/<repo>/actions/oidc/customization/sub. Also check casing, environment name, and that the job declares environment:. |
AADSTS700016 application not found |
AZURE_CLIENT_ID holds the identity's object ID instead of its client ID. |
AADSTS700024 client assertion is not within its valid time range |
The GitHub OIDC token expired before it was exchanged. Fetch a fresh one before each sign-in, and fetch Azure tokens early in long jobs. |
AADSTS500011 resource principal api://fd3f753b-... not found |
Snowflake's Entra application has no service principal in your tenant. |
Azure attestation failed ... deadline has elapsed |
The connector fell back to IMDS, which GitHub runners don't have. AZURE_FEDERATED_TOKEN_FILE, AZURE_CLIENT_ID or AZURE_TENANT_ID is missing from the job's environment. |
| Workload identity sign-in rejected |
The user's SUBJECT is the client ID instead of the object (principal) ID, or ISSUER doesn't end in /v2.0. |
390422 ... is not allowed to access Snowflake |
A network policy rejects the runner's address (part 1). |
MissingDependencyError from snow with WORKLOAD_IDENTITY |
Snowflake CLI 3.33.0 bundles connector 4.8.1, whose Azure token-file path needs azure-identity. Install it next to snowflake-cli, or use the Python connector 5.x. |
A self-hosted job logs out the machine's own az session |
az shared ~/.azure. Set AZURE_CONFIG_DIR to a per-job directory. |
Key rotation
| Symptom |
Cause |
Insufficient privileges to operate on user |
The rotation role lacks MODIFY PROGRAMMATIC AUTHENTICATION METHODS on that user. |
| Rotation refuses with 10 key pairs |
The per-user limit we observed. Prune first. |
Fingerprint mismatch after ADD KEY PAIR |
Snowflake stored a different key than the job generated, usually because of how the public key was extracted. PUBLIC_KEY takes only the base64 body, without PEM header lines. The job removes the key it added. |
| Sign-in with the new key fails |
The target user's network policy rejects the runner, or the key isn't accepted yet. The job retries, then removes the key and leaves Key Vault unchanged. |
| Prune fails: Key Vault serves a key Snowflake doesn't accept |
Someone changed the user by hand. Prune removes nothing in this state; run rotate to recover. |
| Prune keeps a key you expected it to remove |
An older, still-enabled Key Vault version references it. Disable that version. Prune also never touches keys without kvrotate's name and comment. |
A failed rotate kept the new key (KEPT in the log) |
The Key Vault write reported an error but may have landed. Check the secret's latest version; prune cleans the key up once nothing references it. |
Entra lane: Insufficient privileges to complete the operation listing or adding an app's credentials |
The identity lacks the Graph app role Application.ReadWrite.OwnedBy, or the grant hasn't reached new tokens yet. Owning the app isn't enough without it. |
- Decode a token (the GitHub OIDC token or the Entra one) without sending it anywhere:
cut -d. -f2 <<<"$TOKEN" | tr '_-' '/+' | base64 -d 2>/dev/null | jq (add =
padding if base64 complains). Don't paste tokens into online decoders.