How to Configure Microsoft Openid Configuration

Published
Length
3 min read

Luis Felipe Dias

All posts

A microsoft openid configuration lets apps check user identities and sign-in keys through a public JSON document. You set it up by registering your app, reading the discovery URL, and checking token claims. Teams use this setup so staff and automated jobs log in with one central identity provider. It removes the need to store local passwords inside every single app or tool. Instead, your app trusts the identity provider to check the user and send back a signed token. How a microsoft openid co

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

A microsoft openid configuration lets apps check user identities and sign-in keys through a public JSON document. You set it up by registering your app, reading the discovery URL, and checking token claims.

Teams use this setup so staff and automated jobs log in with one central identity provider. It removes the need to store local passwords inside every single app or tool. Instead, your app trusts the identity provider to check the user and send back a signed token.

How a microsoft openid configuration works in practice

The setup relies on a standard discovery document hosted by your identity provider. This document lists the exact web addresses where apps send users to log in. It also points to the public keys needed to check token signatures. When a user logs in, the app reads this document to find the current public keys.

This pattern affects both human users and automated cloud workloads. Human users go through a browser login flow to get an identity token. Automated workloads use workload identity federation to swap a local token for a cloud token. Both paths rely on the same discovery document to check that the token is real.

Safe defaults start with locking down which tenants can use your app. A single-tenant setup ensures only members of your own team can log in. You should also set up your app to require explicit role assignments for every user. Without this rule, any user in the directory might log in to the app by default.

Your app must check several fields inside the token before trusting the user. It must check that the issuer matches your tenant and the audience matches your app ID. It must also check the expiration time so old tokens cannot be used again.

Checking tokens and the limits of static login rules

Good security requires checking both login events and ongoing token rules. Your identity provider writes a log entry every time a user or workload asks for a token. Security teams read these logs to spot odd login times or failed checks. You should also check that your app refreshes the public keys on a regular schedule. Identity providers rotate their signing keys often to keep tokens safe.

OpenID Connect (OIDC) + Microsoft Entra ID (Azure AD): architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, OpenID Connect only solves the initial login step for an app or tool. Once the identity check passes, the user or workload gets a full session. Static role rules often map an identity group to a broad database role or server account. The identity provider cannot see what happens inside that session after login.

A user who passes the login check might run a bad query that deletes a table. An automated script might read sensitive rows like emails, phone numbers, card numbers, or national IDs. Standard token checks do not inspect single queries or block risky commands at runtime. They also do not mask sensitive fields in query results before the data leaves the database.

Managing token lifetimes and group claims

Teams must also watch how group claims travel inside identity tokens. When a user belongs to many groups, the token size can grow very large. You can fix this by filtering claims to include only the groups assigned to that specific app. This keeps the token small and prevents leaking your full directory structure to every app.

Short token lifetimes help reduce risk if a token leaks on a user device. Yet even a one-hour token gives an attacker plenty of time to dump a database. Safe teams pair strong login setup with controls that inspect every action during the live session.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

What is the discovery document used for in OpenID Connect?

The discovery document gives your app the login URLs and public signing keys for your tenant. Your app reads this file so you do not have to hardcode those values.

Why should I validate the audience and issuer claims in every token?

Checking the issuer proves the token came from your specific identity tenant. Checking the audience proves the token was minted for your app and not another tool.

Does OpenID Connect control what queries a user runs after logging in?

No, OpenID Connect only checks who the user is at login time. It does not inspect database queries, block risky commands, or mask sensitive fields during the session.

The query runs. The emails stay hidden.