Failed to add federated credential for GitHub

Michiel Oda 25 Reputation points
2026-07-31T11:29:52.6366667+00:00

In the past we have added federated credentials like this:

Issuer: https://token.actions.githubusercontent.com

Type: Claims matching expression (Preview)

Value: claims['sub'] matches 'repo:{Organization}/*:ref:refs/heads/*' and claims['job_workflow_ref'] matches '{Organization}/{Repository}/*'

This properly worked. Then on July 15, GitHub changed the behaviour for new repositories so that the subject becomes immutable. On the 22th of July when I came back from holiday, I was able to add other credentials where the value was the following:

Value: claims['sub'] matches 'repo:{Organization}@*/*:ref:refs/heads/*' and claims['job_workflow_ref'] matches '{Organization}/{Repository}/*'

Today, I wanted to add another credential, but neither of the above syntaxes work anymore and I have the following error:

Failed to add federated credential. Error detail: The FederatedIdentityCredential.ClaimsMatchingExpression.Value is invalid. Rule exception: Expression configured for issuer 'https://token.actions.githubusercontent.com' either lacks all required claims or contains unallowed claims. paramName: FederatedIdentityCredential.ClaimsMatchingExpression.Value, paramValue: claims['sub'] matches 'repo:{Organization}/*:ref:refs/heads/*' and claims['job_workflow_ref'] matches '{Organization}/{Repository}/*', objectType: Microsoft.Online.DirectoryServices.Application

According to the documentation this should be correct, and it is correct as it worked before to add them.

This is blocking us as new repositories have immutable subjects by default (and can't be disabled anymore).

Microsoft Security | Microsoft Entra | Microsoft Entra ID

Answer accepted by question author
Zachary Muehlich 80 Reputation points
2026-08-03T18:24:31.21+00:00

New requirement in this doc here states you need to have one or the other of repository_id or repository_owner_id in the claims matching expression. I validated it works for me now once I added that.

Add required claims to a flexible federated identity credential

For GitHub, a flexible federated identity credential must match the sub claim and one or both of the following additional claims:

  • repository_id identifies the repository where the workflow runs.
  • repository_owner_id identifies the repository owner.

These additional claims are required regardless of whether sub uses a name-based, customized, or immutable format. Include the claims that represent the intended trust boundary.

Was this answer helpful?

5 people found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.