Azure OIDC for SSH certs: Fetch a list of user groups via Microsoft Graph API

Open
#2,341 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@hslatman is already working on this.

Since Jul 29, 2025.

Assessment

This issue has not been assessed yet.

Description

enhancement needs triage

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

Allow configuring an extra API endpoint to call as part of the SSH cert issuance process. This info could then be made available to the template file, e.g., as .Custom (here).

A concrete example would be calling the Microsoft Graph API to fetch a list of groups the user belongs to. Then, in the template, we could do something like "Principals": {{ toJson .Custom.groupIds }}.

I haven't looked at other OIDC providers, but this could potentially be generic?

Why is this needed?

Our specific example looks something like this:

  • We have lots of servers (~300 or so)
  • Each server has a single user account
  • Staff are granted access server-by-server

To facilitate that, we're using an Azure OIDC provisioner, with a template like this:

{
	"type": "{{ .Type }}",
	"keyId": "{{ .KeyID }}",
        // the principals will be a list of Azure group IDs
	"principals": {{ toJson .Token.groups }},
	"extensions": {{ toJson .Extensions }},
	"criticalOptions": {{ toJson .CriticalOptions }}
}

Then, we create an Azure group for each server, and place the Object ID of that group into the AuthorizedPrincipalsFile on the server.

The result is: When a user first logs-in, they go through an OAuth login flow, which issues them an SSH cert containing a list of Object IDs of the groups they're in. When they connect to a server, they'll be allowed/denied based on those Group IDs.

This was actually working great, until we hit Azure's 200 group limit for JWTs.

Long story short, if the user has more than 200 groups, Azure will totally omit all groups, and instead suggests to fetch a list of user groups via the Microsoft Graph API (see the ~middle paragraph here). It seems our only option is to fetch a list of groups as a separate API call.

Dominant language
Go
Stars
8.9k
Forks
599
Avg merge
21h 20m
Merged PRs (30d)
15

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from smallstep/certificates

All issues in smallstep/certificates

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.