Skip to content
Connect an agent

Single sign-on

Single sign-on with Microsoft Entra ID

Connect an Enterprise organisation to Microsoft Entra ID (formerly Azure Active Directory) with OpenID Connect or SAML 2.0. Prove your email domain in Plotwork first, as the single sign-on guide describes.

TL;DR

Plotwork fieldWhere it comes from in Entra ID
Issuer URLhttps://login.microsoftonline.com/<Directory (tenant) ID>/v2.0
Client IDThe app registration's Overview, Application (client) ID
CredentialFederated credential (Microsoft Entra ID), recommended: no secret to store or renew. See Use a federated credential.
Federated credential: Issuer, Subject identifier, Audience to give Entra IDThe values Plotwork shows once you save: https://api.plotwork.dev/sso/oidc/<organisation id>, your organisation's id, and api://AzureADTokenExchange
Client secret, if you use oneCertificates & secrets, Client secrets, the Value column (not the Secret ID)
Redirect URI to give Entra IDhttps://api.plotwork.dev/auth/sso/callback, as a Web platform redirect
SAML: Identifier (Entity ID) and Reply URL to give Entra IDThe Entity ID and the ACS URL on Plotwork's Single sign-on tab
SAML: Metadata URLThe enterprise application's Single sign-on page, SAML Certificates, App Federation Metadata Url

1. Register the app

  1. In the Microsoft Entra admin center, open Identity, then Applications, then App registrations, and press New registration.
  2. Fill in the form:
Entra ID fieldValue
NamePlotwork
Supported account typesAccounts in this organizational directory only (single tenant)
Redirect URIPlatform Web, address https://api.plotwork.dev/auth/sso/callback
  1. Press Register.

2. Make a client secret

Skip this step if you use a federated credential, which needs no secret: see Use a federated credential.

  1. In the app registration, open Certificates & secrets, then Client secrets, and press New client secret.
  2. Give it a description and an expiry, and press Add.
  3. Copy the Value at once: Entra ID shows it only now. The Secret ID is not the secret.

Note the expiry. When the secret expires, sign-in stops; make a new one and paste it into Plotwork before then.

3. Send the address in the ID token

  1. Open API permissions and check that Microsoft Graph has the delegated permissions openid, email and profile. Add the ones that are missing, and grant admin consent.
  2. Open Token configuration, press Add optional claim, choose ID as the token type, tick email, and press Add.

Entra ID puts the address in the email claim only for a person whose account has a mail address. An account with no mailbox has none, so for a token from your tenant with no email claim, Plotwork reads the user principal name instead: the upn claim, then preferred_username. Either way the address must be on a domain your organisation verified in Plotwork.

4. Copy the values into Plotwork

  1. On the app registration's Overview, copy the Application (client) ID and the Directory (tenant) ID.
  2. In Plotwork, open your organisation's Single sign-on tab and fill in Identity provider:
Plotwork fieldValue
Issuer URLhttps://login.microsoftonline.com/<Directory (tenant) ID>/v2.0
Client IDThe Application (client) ID
CredentialClient secret
Client secretThe Value you copied
  1. Press Save provider, then turn on Sign in with single sign-on.

Plotwork refuses the shared issuers /common, /organizations and /consumers: they would let any Microsoft tenant's people in. Use your own tenant's issuer, as above.

Use a federated credential (no secret)

Recommended. Instead of a client secret, Entra ID trusts Plotwork as an external issuer. At each sign-in Plotwork signs a short assertion with a key it keeps for your organisation, and Entra ID checks it against Plotwork's published public keys. There is no secret to copy, store, or renew before it expires. In Entra ID this is a federated identity credential on the app registration, the same trust it gives GitHub Actions or Kubernetes (Microsoft's guide (opens in a new tab)).

  1. Register the app as in step 1, and skip step 2. Do step 3 as usual.
  2. In Plotwork, under Identity provider, fill in the Issuer URL and the Client ID as in step 4, choose Federated credential (Microsoft Entra ID) under Credential, and press Save provider. Plotwork makes the signing key and shows the values for Entra ID, each with a copy button.
  3. In the Microsoft Entra admin center, open the app registration, then Certificates & secrets, then the Federated credentials tab, and press Add credential.
  4. For Federated credential scenario, choose Other issuer, and fill in the form:
Entra ID fieldValue
IssuerThe Issuer from Plotwork, https://api.plotwork.dev/sso/oidc/<organisation id>, exactly, with no slash at the end
TypeExplicit subject identifier
Value (the subject identifier)The Subject identifier from Plotwork: your organisation's id
Nameplotwork, or any name you like. It cannot be changed later.
Audienceapi://AzureADTokenExchange, the default. Leave it.
  1. Press Add, and wait a few minutes before the first sign-in: Entra ID takes a moment to spread a new credential to all its servers, and a sign-in before then fails with AADSTS70021 (considerations (opens in a new tab)).
  2. Turn on Sign in with single sign-on, and sign in once to try it.

Entra ID reads https://api.plotwork.dev/sso/oidc/<organisation id>/.well-known/openid-configuration to find Plotwork's keys, and matches the issuer, the subject and the audience case-sensitively (what's new for authentication (opens in a new tab)). What Plotwork sends at each sign-in:

ClaimValue
issPlotwork's issuer for your organisation
subYour organisation's id
audapi://AzureADTokenExchange
expFive minutes after it was made
jtiNew for every sign-in
SignatureRS256, the key named by kid in the header

Rotate key, under Signing key in Plotwork, makes a new key at once and keeps the old public key published for a day. Entra ID reads the keys from Plotwork, so nothing changes in Entra ID.

To move a connection that uses a client secret, choose Federated credential, press Save provider, add the credential in Entra ID as above, and check that sign-in works. Plotwork deletes its copy of the secret when you save; delete the secret in Entra ID afterwards.

Or connect with SAML 2.0

  1. In the Microsoft Entra admin center, open Identity, then Applications, then Enterprise applications, press New application, then Create your own application. Name it Plotwork, choose Integrate any other application you don't find in the gallery (Non-gallery), and press Create.
  2. Open Single sign-on and choose SAML.
  3. In Plotwork's Single sign-on tab, choose SAML 2.0 under Identity provider, then edit Basic SAML Configuration in Entra ID:
Entra ID fieldValue
Identifier (Entity ID)The Entity ID from Plotwork. Make it the default.
Reply URL (Assertion Consumer Service URL)The ACS URL from Plotwork
Sign on URL, Relay State, Logout UrlLeave empty
  1. Under Attributes & Claims, edit Unique User Identifier (Name ID): set Name identifier format to Email address and Source attribute to user.mail. If your people's mail is empty and their user principal name is their address, use user.userprincipalname instead.
  2. Under SAML Certificates, keep Signing Option at Sign SAML assertion and Signing Algorithm at SHA-256, and copy the App Federation Metadata Url.
  3. In Plotwork, paste it under Metadata URL, leave Email attribute empty, and press Save provider. Then turn on Sign in with single sign-on.
  4. Under Users and groups, assign the people or groups who should sign in.

If you keep a Name ID that is not an address, put http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress under Email attribute in Plotwork: Entra ID sends the mail address in that claim by default.

Entra ID rotates the signing certificate before it expires. When it does, save the provider in Plotwork again with the same metadata URL.

Provisioning with SCIM

Entra ID can also add, update and remove your members, and push the groups that decide their roles, from the same enterprise application. SCIM with Microsoft Entra ID has every step: the Tenant URL and Secret Token from Plotwork, the attribute mappings, assigning people and groups, Provision on demand, and mapping groups to roles.

Troubleshooting

What you seeWhat to check
"The issuer could not be used: the issuer names every tenant"Replace common or organizations in the issuer with your Directory (tenant) ID.
"Your address is not on a domain your organisation verified"The person's mail address in Entra ID, or their user principal name when they have no mail address, is on another domain. Check the optional claim in step 3.
"Your identity provider sent a sign-in Plotwork could not trust"The Client ID in Plotwork is not this app's, or the issuer is another tenant's, or the token named no address at all. Check that openid, email and profile are granted in step 3.
With a federated credential, "Your identity provider could not be reached or answered something unexpected"Entra ID refused Plotwork's assertion. Open the Entra admin center, then Monitoring & health, then Sign-in logs, and find the failed sign-in for the Plotwork app. Its AADSTS code is in the rows below.
AADSTS70021: No matching federated identity record found for presented assertionNo federated credential on this app matches. Check the three values in Use a federated credential, and that the credential is on the app registration whose Client ID Plotwork has. A credential added minutes ago may not have spread yet: wait and try again (considerations (opens in a new tab)).
AADSTS700211: No matching federated identity record found for presented assertion issuerThe credential's Issuer is not Plotwork's. Copy it again from Plotwork: it is case-sensitive and has no slash at the end.
AADSTS700212: No matching federated identity record found for presented assertion audienceThe credential's Audience is not api://AzureADTokenExchange. Set it back to the default.
AADSTS700213: No matching federated identity record found for presented assertion subjectThe credential's subject identifier is not your organisation's id. Copy it again from Plotwork; the match is case-sensitive (what's new for authentication (opens in a new tab)).
AADSTS700024: Client assertion is not within its valid time rangeRare: the assertion lives five minutes. Try again; if it repeats, tell Plotwork support the time it happened.
AADSTS700027: Client assertion failed signature validationEntra ID holds an old copy of Plotwork's keys, usually just after Rotate key. Wait a few minutes and try again.
Sign-in stopped working one dayThe client secret expired. Make a new one and save it in Plotwork. For SAML, the signing certificate rotated: save the provider again with the same metadata URL.
Provisioning logs show 400 for a userThe userName Entra ID sends is not an address on a domain you verified in Plotwork. Map mail to userName, or verify the domain.
"Your identity provider sent a sign-in Plotwork could not trust" with SAMLThe Identifier or the Reply URL is not Plotwork's, or token encryption is on under Token encryption. Turn it off.

See also

PageWhy
Single sign-onDomains, the switches, Require single sign-on and the way back in
SCIM with Microsoft Entra IDAdding and removing members from Entra ID, with roles by group
Single sign-on with OktaThe same for Okta, with a private key JWT instead of a secret
Microsoft's error codes (opens in a new tab)Every AADSTS code
Single sign-on with Google WorkspaceThe same for Google Workspace