This guide describes how to configure Microsoft Entra ID as the upstream identity provider of a PhotoPrism® Portal, so that users sign in with their Microsoft account and are admitted to instances based on their Entra ID security groups. For an overview of the authentication methods and how access is decided, see Access & Authentication.

Only the Portal is registered in Entra ID. The instances need no registration of their own, because they sign users in through the Portal, which passes on the groups that admit a user.

Registering the Portal

In the Microsoft Entra admin center, create one app registration for the Portal and note its Application (client) ID and Directory (tenant) ID. The table summarizes the settings; Step by Step in the Entra Admin Center below walks through each page:

Setting Value
Redirect URI (Web) https://portal.example.com/api/v1/oidc/redirect, using the Portal’s public site URL.
Client secret Create a secret under Certificates & secrets and copy its Value, which is shown only once. The Secret ID next to it looks like a UUID and is not the secret. Client secrets expire, so note the expiry date and renew the secret in time.
API permissions The delegated Microsoft Graph permissions openid, email and profile, together with the default User.Read. No further permissions are needed.
Groups claim Under Token configuration, select Add groups claim, choose Groups assigned to the application, keep Group ID for the ID token and leave Emit groups as role claims unchecked.

Then open the matching enterprise application, set Assignment required to Yes in its properties, and assign the security groups whose members should use PhotoPrism. Only members of the assigned groups can then sign in, and the token contains only these groups. Assigning groups to an application requires an Entra ID P1 license or higher.

Without a groups claim, Entra ID sends no groups at all. If PHOTOPRISM_OIDC_GROUP is set on the Portal, every sign-in is then refused with missing required group membership.

Step by Step in the Entra Admin Center

The following steps set up the registration in the Microsoft Entra admin center. The pages named below are found under Entra ID in the navigation menu, or under Identity in older versions of the menu. You need a role that may register applications and manage enterprise applications, such as Application Administrator.

1. Register the application

  1. Open App registrations and select New registration.
  2. Enter a Name, for example “PhotoPrism Portal”, and keep Accounts in this organizational directory only as the supported account type.
  3. Under Redirect URI, select the platform Web and enter https://portal.example.com/api/v1/oidc/redirect, using the Portal’s public site URL.
  4. Select Register. The Overview page of the new registration shows the Application (client) ID and the Directory (tenant) ID for the Portal configuration.

2. Create a client secret

  1. In the registration, open Certificates & secrets, select the Client secrets tab and then New client secret.
  2. Enter a description, choose an expiry period and select Add.
  3. Copy the value in the Value column right away; it is shown only once. Do not use the Secret ID column.

3. Check the API permissions

  1. Open API permissions. A new registration already has the Microsoft Graph permission User.Read (Delegated).
  2. Select Add a permission › Microsoft Graph › Delegated permissions, tick openid, email and profile under OpenId permissions, and select Add permissions.
  3. If your directory requires administrator consent, select Grant admin consent for your organization.

4. Add the groups claim

  1. Open Token configuration and select Add groups claim.
  2. Under Select group types to include in Access, ID, and SAML tokens, tick only Groups assigned to the application.
  3. Under Customize token properties by type, keep Group ID for ID, Access and SAML, and leave Emit groups as role claims unchecked.
  4. Select Add. The list on the Token configuration page now shows the claim groups for the token types ID, Access and SAML.

5. Assign the groups to the application

  1. Open Enterprise applications and select the application with the same name. Entra ID created it together with the registration.
  2. Open Properties, set Assignment required? to Yes and select Save.
  3. Open Users and groups, select Add user/group, select the security groups whose members should use PhotoPrism, and select Assign. Assign the groups rather than individual users, since only group membership admits a user when PHOTOPRISM_OIDC_GROUP is set.

6. Note the group object IDs

Open Groups › All groups, select each assigned group and copy its Object ID from the Overview page. These IDs go into PHOTOPRISM_OIDC_GROUP on the Portal and into the group mappings of the instances.

7. Check the result

After configuring the Portal, start it with PHOTOPRISM_LOG_LEVEL=debug and sign in once with a member of an assigned group. The Portal log then lists the groups it received, as shown under Troubleshooting; they should be the object IDs noted in step 6. Changes to group memberships and assignments in Entra ID can take a few minutes to reach new tokens.

Portal Configuration

Set these options on the Portal, for example in its compose.yaml or Helm values file. The issuer URL contains your directory (tenant) ID:

PHOTOPRISM_OIDC_URI: "https://login.microsoftonline.com/8bade08a-a954-44f4-bf40-668f435c426f/v2.0"
PHOTOPRISM_OIDC_CLIENT: "84a69916-315a-4302-b688-fc55bc67b331"
PHOTOPRISM_OIDC_SECRET: "<client secret value>"
PHOTOPRISM_OIDC_PROVIDER: "Entra ID"
PHOTOPRISM_OIDC_SCOPES: "openid email profile"
PHOTOPRISM_OIDC_GROUP_CLAIM: "groups"
PHOTOPRISM_OIDC_GROUP: "9c27485d-f3a0-42e7-a53e-af04b3740fbf,69beef27-6b11-412d-a323-656cd173c63f,e4c06a32-1bcb-45d4-8fe4-ffb8a373c2aa"
PHOTOPRISM_OIDC_ROLE: "guest"
PHOTOPRISM_OIDC_REGISTER: "true"
PHOTOPRISM_OIDC_PROMPT: "select_account"
Variable Recommended Description
PHOTOPRISM_OIDC_URI Issuer URL https://login.microsoftonline.com/<tenant-id>/v2.0.
PHOTOPRISM_OIDC_CLIENT Application (client) ID The ID of the app registration.
PHOTOPRISM_OIDC_SECRET Client secret value The secret’s Value, not its Secret ID. Keep it in a secret store rather than in a file under version control.
PHOTOPRISM_OIDC_SCOPES openid email profile Entra ID has no groups scope. Groups are included through the token configuration, so do not add groups here.
PHOTOPRISM_OIDC_GROUP_CLAIM groups The claim that carries the group IDs.
PHOTOPRISM_OIDC_GROUP All groups that use PhotoPrism Comma-separated list of groups; only their members may sign in, and others are refused before an account is created. Add the groups of each new instance here as well.
PHOTOPRISM_OIDC_ROLE guest Portal role of accounts created at a first sign-in (default guest). Instance roles come from the group mappings described below, not from this setting.
PHOTOPRISM_OIDC_REGISTER true Creates a Portal account at the first sign-in. With false, only users with an existing account can sign in.
PHOTOPRISM_OIDC_PROMPT select_account Shows the Microsoft account picker at sign-in instead of continuing the current Microsoft session. See Authorization Prompt.

Keep PHOTOPRISM_OIDC_URI, PHOTOPRISM_OIDC_CLIENT and PHOTOPRISM_OIDC_SECRET empty on the instances: they derive their sign-in settings from the Portal. Restart the Portal after changing these options.

Group Identifiers

With Group ID selected, the token contains the object ID of each group, shown as “Object ID” on the group’s overview page. PhotoPrism then lists the same object IDs in its settings. Since they are not readable, name each group in a comment next to it.

  • Groups created in Entra ID are sent with their object ID. Formats such as sAMAccountName apply only to synchronized groups, so selecting one does not change how these groups are sent. Entra ID can emit names for cloud-only groups assigned to the application if you enable that option, but display names may contain spaces and need not be unique, so object IDs are the safer choice.
  • Groups synchronized from an on-premises Active Directory can be sent by name instead, with sAMAccountName selected. The settings must then use the same names, and the names must not contain spaces, because several settings treat spaces as separators.
  • Letter case does not matter. PhotoPrism compares group IDs and names without regard to case.
  • Direct assignments do not count as group membership. A user assigned to the enterprise application directly, without being a member of one of the listed groups, is refused when PHOTOPRISM_OIDC_GROUP is set.
  • Users in many groups. If a user belongs to more groups than Entra ID includes in a token, it sends no groups and marks the token instead (group overage). The Portal then refuses the sign-in if PHOTOPRISM_OIDC_GROUP is set, or admits no instance access through groups otherwise. Choosing Groups assigned to the application keeps the claim to the assigned groups and avoids this.

Instance Access by Group

Signing in to the Portal does not admit a user to any instance by itself; access is closed by default. Each instance declares which groups it admits and with which role, in its own configuration:

# 9c27485d-f3a0-42e7-a53e-af04b3740fbf  Photos Admins
# 41706292-352b-41e3-b07f-be34fda6a2a6  Photos Managers
# 69beef27-6b11-412d-a323-656cd173c63f  Photos Viewers
PHOTOPRISM_CLUSTER_ALLOW_GROUP_ROLES: "9c27485d-f3a0-42e7-a53e-af04b3740fbf=admin,41706292-352b-41e3-b07f-be34fda6a2a6=manager,69beef27-6b11-412d-a323-656cd173c63f=viewer"

Group access can also be granted centrally on the Portal with photoprism cluster nodes allow-group, and individual users can be given explicit grants. See Mapping Security Groups to Roles for the options and Access & Authentication for the order in which grants, Portal group mappings and instance group mappings apply.

Group changes in Entra ID take effect at the user’s next sign-in to the Portal, since the Portal keeps the groups of a sign-in with its session and uses them whenever the user opens an instance. A Portal session created with Entra ID expires 24 hours after sign-in, regardless of PHOTOPRISM_SESSION_MAXAGE, so a change applies at the latest then; to apply it sooner, the user signs out of the Portal and in again. See Session Lifetime.

Portal Administrators

Administering the Portal requires the role cluster_admin, which is never assigned through a group or a group mapping. To make a user a Portal administrator:

  1. The user signs in to the Portal with Entra ID once, which creates their account with the role from PHOTOPRISM_OIDC_ROLE, or from PHOTOPRISM_OIDC_GROUP_ROLE if one of their groups is mapped there.
  2. An existing administrator changes the account’s role to cluster_admin in the Portal’s user management, or runs photoprism users mod --role cluster_admin <username> on the Portal.

Removing a user from their groups in Entra ID does not remove cluster_admin from their account. Change the role back as well, or delete the account.

The Portal’s local administrator account (PHOTOPRISM_ADMIN_USER, by default admin) keeps working with its password, which makes it the way back in if signing in with Entra ID fails. To let an Entra ID identity sign in as this account, set PHOTOPRISM_ADMIN_OIDC_SUB to the identity’s subject (sub claim). Entra ID issues a different subject per application, so read it from the account the Portal creates when that identity first signs in: photoprism users show <username> lists it as AuthID. Once the administrator account is linked, that account is detached and can no longer sign in, so delete it if it is not needed. The identity must also be a member of a group in PHOTOPRISM_OIDC_GROUP.

Network Access

The Portal connects to two Microsoft endpoints over HTTPS (TCP port 443) at sign-in, so both must be reachable from the Portal, including through any egress proxy or firewall:

  • login.microsoftonline.com for the sign-in itself, the discovery document and the signing keys;
  • graph.microsoft.com, which serves the Entra ID userinfo endpoint.

The instances do not connect to Microsoft; they only connect to the Portal.

Troubleshooting

To see which groups arrive, start the Portal with PHOTOPRISM_LOG_LEVEL=debug and sign in once. Before the group check, the Portal then logs a line such as:

oidc: received groups in claim groups (id token 2, userinfo 0, overage false): 69beef27-6b11-412d-a323-656cd173c63f, 9c27485d-f3a0-42e7-a53e-af04b3740fbf

Compare the listed IDs with PHOTOPRISM_OIDC_GROUP and the instance group mappings. The line is not written at the default log level, so set the log level back to info afterwards.

Portal Log Message Cause & Solution
failed to exchange token for user info The Portal could not complete the sign-in after returning from Entra ID. Usually the client secret is not accepted, because PHOTOPRISM_OIDC_SECRET contains the Secret ID instead of the Value, or the secret has expired. If the Entra ID sign-in logs show the sign-in as successful, check that the Portal can reach graph.microsoft.com.
missing required group membership The token contains none of the groups in PHOTOPRISM_OIDC_GROUP. Check that the app registration has a groups claim, that the user is a member of a listed group assigned to the enterprise application, and that the settings use the format the token carries (object IDs with Group ID).
IdP omitted some or all groups; cannot validate required groups The user has more groups than Entra ID includes in the token. Select Groups assigned to the application in the token configuration.
required groups are not valid group IDs PHOTOPRISM_OIDC_GROUP contains no valid entry. List group object IDs or names, separated by commas.
denied access to node The user signed in to the Portal, but no grant or group mapping admits them to the instance they opened. Check the instance’s group mappings and whether the user signed in again after a group change.

A user who enters their Microsoft email address and password in the Portal’s username and password fields is refused with “Invalid credentials”, since these fields are for local accounts. Select the “Continue with Entra ID” button instead.

PhotoPrism® Documentation

For more information on specific features, services and related resources, please refer to the other documentation available in our Knowledge Base and User Guide: