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 field | Where it comes from in Entra ID |
|---|---|
| Issuer URL | https://login.microsoftonline.com/<Directory (tenant) ID>/v2.0 |
| Client ID | The app registration's Overview, Application (client) ID |
| Credential | Federated 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 ID | The 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 one | Certificates & secrets, Client secrets, the Value column (not the Secret ID) |
| Redirect URI to give Entra ID | https://api.plotwork.dev/auth/sso/callback, as a Web platform redirect |
| SAML: Identifier (Entity ID) and Reply URL to give Entra ID | The Entity ID and the ACS URL on Plotwork's Single sign-on tab |
| SAML: Metadata URL | The enterprise application's Single sign-on page, SAML Certificates, App Federation Metadata Url |
1. Register the app
- In the Microsoft Entra admin center, open Identity, then Applications, then App registrations, and press New registration.
- Fill in the form:
| Entra ID field | Value |
|---|---|
| Name | Plotwork |
| Supported account types | Accounts in this organizational directory only (single tenant) |
| Redirect URI | Platform Web, address https://api.plotwork.dev/auth/sso/callback |
- 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.
- In the app registration, open Certificates & secrets, then Client secrets, and press New client secret.
- Give it a description and an expiry, and press Add.
- 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
- Open API permissions and check that Microsoft Graph has the delegated permissions
openid,emailandprofile. Add the ones that are missing, and grant admin consent. - 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
- On the app registration's Overview, copy the Application (client) ID and the Directory (tenant) ID.
- In Plotwork, open your organisation's Single sign-on tab and fill in Identity provider:
| Plotwork field | Value |
|---|---|
| Issuer URL | https://login.microsoftonline.com/<Directory (tenant) ID>/v2.0 |
| Client ID | The Application (client) ID |
| Credential | Client secret |
| Client secret | The Value you copied |
- 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)).
- Register the app as in step 1, and skip step 2. Do step 3 as usual.
- 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.
- In the Microsoft Entra admin center, open the app registration, then Certificates & secrets, then the Federated credentials tab, and press Add credential.
- For Federated credential scenario, choose Other issuer, and fill in the form:
| Entra ID field | Value |
|---|---|
| Issuer | The Issuer from Plotwork, https://api.plotwork.dev/sso/oidc/<organisation id>, exactly, with no slash at the end |
| Type | Explicit subject identifier |
| Value (the subject identifier) | The Subject identifier from Plotwork: your organisation's id |
| Name | plotwork, or any name you like. It cannot be changed later. |
| Audience | api://AzureADTokenExchange, the default. Leave it. |
- 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)).
- 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:
| Claim | Value |
|---|---|
iss | Plotwork's issuer for your organisation |
sub | Your organisation's id |
aud | api://AzureADTokenExchange |
exp | Five minutes after it was made |
jti | New for every sign-in |
| Signature | RS256, 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
- 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. - Open Single sign-on and choose SAML.
- In Plotwork's Single sign-on tab, choose SAML 2.0 under Identity provider, then edit Basic SAML Configuration in Entra ID:
| Entra ID field | Value |
|---|---|
| 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 Url | Leave empty |
- 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, useuser.userprincipalnameinstead. - Under SAML Certificates, keep Signing Option at Sign SAML assertion and Signing Algorithm at SHA-256, and copy the App Federation Metadata Url.
- In Plotwork, paste it under Metadata URL, leave Email attribute empty, and press Save provider. Then turn on Sign in with single sign-on.
- 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 see | What 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 assertion | No 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 issuer | The 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 audience | The credential's Audience is not api://AzureADTokenExchange. Set it back to the default. |
| AADSTS700213: No matching federated identity record found for presented assertion subject | The 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 range | Rare: the assertion lives five minutes. Try again; if it repeats, tell Plotwork support the time it happened. |
| AADSTS700027: Client assertion failed signature validation | Entra 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 day | The 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 user | The 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 SAML | The Identifier or the Reply URL is not Plotwork's, or token encryption is on under Token encryption. Turn it off. |
See also
| Page | Why |
|---|---|
| Single sign-on | Domains, the switches, Require single sign-on and the way back in |
| SCIM with Microsoft Entra ID | Adding and removing members from Entra ID, with roles by group |
| Single sign-on with Okta | The 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 Workspace | The same for Google Workspace |