Requiring two-factor authentication in Metabase

Metabase can require authenticator-app 2FA for password and LDAP logins, with an optional enforcement deadline. This page covers how to plan, configure and verify it on a self-hosted instance.

On this page

When teams need two-factor authentication in Metabase

A self-hosted Metabase that holds analytics on sensitive databases is a place where a password alone is often not enough. Anyone who signs in can read the saved questions, dashboards and data sources their group allows, so the sign-in step is a control in its own right. Metabase lets admins leave two-factor authentication (2FA) optional, require it immediately, or require it by a deadline, using the MB_MFA_ENFORCEMENT and MB_MFA_REQUIREMENT_DEADLINE settings. The requirement applies to password and LDAP logins.

This decision fits security and compliance owners who need a documented sign-in control, and platform admins who will run the rollout. The owner should decide the enforcement mode before anyone is locked out, since a forced requirement changes how every user enrolls. Platform admins need to know which users sign in with passwords, which come through LDAP, and which already use SSO, because the setting does not reach the other paths. Confirm your edition and plan first, and check the Metabase two-factor authentication documentation for the current options before you write the configuration.

The topic covers password and LDAP logins only. Requiring 2FA does not affect API keys, so any automation or integration that authenticates with a key continues to work without a second factor. Treat API keys as a separate access path to manage through key rotation, scoping and revocation. Plan that work alongside the 2FA rollout rather than assuming the requirement covers it. Also confirm with your identity team how SSO sign-ins are protected, since those are governed by the identity provider and not by this Metabase setting.

Enforcement options and when each fits

This table compares the three ways to set two-factor authentication in self-hosted Metabase: leaving it optional, requiring it now, or requiring it by a set date through MB_MFA_ENFORCEMENT and MB_MFA_REQUIREMENT_DEADLINE. Read each column against your user population and how much change your support team can absorb in the same week. Requiring 2FA does not affect API keys, so service access needs its own review.

OptionRollout riskWhat users need to hearWhen it fits
Optional 2FALowest. Users see no change to sign-in, but adoption depends on individual choice.That 2FA is available, how to enroll, and that it is recommended for their account.Pilot phases, small admin groups, or while you confirm authenticator app support across your user base.
Immediate enforcementHighest. Users without an enrolled authenticator may be blocked at their next sign-in.The exact date enforcement starts, the enrollment steps, and who to contact if they lose access to their device.Small instances where every user can enroll in one sitting, or after a deadline period has already run.
Deadline-based enforcementModerate. Risk is concentrated near the deadline, so late enrollers can still be locked out.The deadline date, a reminder schedule, and a clear escalation path for anyone who cannot enroll in time.Organizations with many users, shared devices or contractors who need time to install and enroll an authenticator.
Effect on API keysRequiring 2FA does not affect API keys, so integrations keep working after enforcement starts.Admins should be told that scripts and automations are not covered by the 2FA requirement.Plan separate key rotation and access review for service accounts, independent of the enforcement setting.

How a 2FA-enforced login proceeds

The diagram starts when a user submits a password or LDAP credential to the Metabase sign-in page. Under enforcement, Metabase checks whether the account already has an authenticator app enrolled. If it does, the user passes the authenticator check before the session opens. If it does not, the user is prompted to enroll, and the enrollment deadline set by MB_MFA_REQUIREMENT_DEADLINE decides whether that step is optional or blocking. API key requests skip the login prompt entirely, so check that automation and integrations do not rely on interactive sign-in.

Login decision path under 2FA enforcement, with API keys shown separately.

Configuring 2FA enforcement step by step

This sequence turns optional two-factor authentication into an enforced control for password and LDAP logins, with each change checked before the next one starts. It ends with users enrolled on a known timeline and API access confirmed as unaffected.

  1. Confirm the instance uses password or LDAP login

    Before changing anything, the admin confirms which sign-in methods the instance uses for each group of people. Two-factor enforcement applies to password and LDAP logins, so accounts that only sign in through SSO or Google Sign-In need a separate check with your identity provider. Record the Metabase version and the sign-in methods in use, and confirm you can reach a test account that signs in with a password. The step is done when you have a written list of login paths and a test account you can use for verification.

  2. Choose the enforcement mode and deadline

    Decide whether 2FA stays optional, becomes required immediately, or becomes required by a deadline. Metabase controls this through the MB_MFA_ENFORCEMENT and MB_MFA_REQUIREMENT_DEADLINE environment variables, so the choice is made in your deployment configuration rather than only in the admin interface. Agree the mode with your security and compliance owners and write down who is affected. The step is done when the chosen mode and any deadline value are documented in the change record.

  3. Set the enforcement variables in your deployment

    The platform team sets MB_MFA_ENFORCEMENT and, if a deadline is used, MB_MFA_REQUIREMENT_DEADLINE in the environment that runs Metabase, such as the container definition, systemd unit or Kubernetes manifest. Apply the change through your normal release process and restart the instance so the new values load. Check the exact value formats in the two-factor authentication documentation before you deploy. The step is done when the running instance reflects the new settings and the change is recorded in version control.

  4. Verify enrollment prompts with an unenrolled test user

    Sign in with a test account that has no authenticator app enrolled. In the required-now mode, the user should be prompted to enroll at sign-in. In a deadline mode, the account should continue to work until the deadline, then be prompted. Note the exact screen, the time of each prompt and whether the account can finish enrollment. The step is done when the observed behavior matches the mode you chose, and any mismatch is fixed before users are notified.

  5. Confirm API key access is unaffected

    Requiring 2FA does not affect API keys, so test that an existing API key still returns data for a test account after enforcement is active. Use a request that matches a real integration, such as a query or a dashboard read, and record the result. This check matters because scripts and automations often run without an interactive sign-in. The step is done when the API key call succeeds and you have confirmed that the affected integrations do not need changes.

  6. Communicate enrollment steps to users

    Send users a short guide that covers installing an authenticator app, scanning the enrollment code, storing recovery material, and what to do if a code fails. Include the deadline if one applies, the support contact for lockouts, and how fallback codes sent by email work in your environment. Confirm the guide against a fresh test enrollment so the steps match the current screens. The step is done when the guide is published and the support queue knows how to handle lockouts.

  7. Review enrollment status and lockout handling

    After users begin enrolling, review which accounts have finished and which are still pending, and check the support requests for lockouts. Test the email fallback path with a test account so you know it works before the deadline. Record any gaps and resolve them with a targeted reminder or a support procedure. The step is done when the pending list is understood, the fallback path is proven, and the owners agree that enforcement is operating as planned.

Email fallback codes and API keys under 2FA

Before you enforce two-factor authentication, confirm how a user recovers access when they lose their authenticator. The Metabase two-factor documentation covers the enforcement model: admins can leave 2FA optional, require it immediately, or require it from a deadline set through MB_MFA_ENFORCEMENT and MB_MFA_REQUIREMENT_DEADLINE. Email fallback codes are the recovery path your team should verify against that model, not assume. Check the current documentation for how fallback codes are issued, how long they remain valid, and what an admin can do for a locked-out user, then run a full test on a non-production instance: enroll an account, sign in, simulate a lost device, and recover. Record each step so the runbook reflects the version you actually deploy.

Requiring 2FA does not affect API keys, according to the Metabase documentation. Scripts, scheduled reporting jobs and integrations that authenticate with API keys keep working after you enforce 2FA, which means the enforcement setting alone does not govern automated access. Treat API keys as a separate control. Decide who may create keys, which group or service owner is accountable for each key, how keys are rotated and revoked when an employee leaves or a project ends, and where secrets are stored. Review the list of active keys on a schedule, because a key created before enforcement carries no 2FA requirement at all.

Put both decisions in writing before the enforcement date. For recovery, document who can reset a user's second factor, what identity check the help desk performs, and how the fallback path is audited. For keys, document the naming convention, the owner field, the rotation interval and the revocation procedure. Test the revocation path too: confirm that disabling a key stops the calling integration in a staging environment. If your organization's access review depends on this evidence, keep the test results and the review records together. Ask your Metabase partner or internal team to confirm each step against the version you plan to run, since behavior can differ between releases.

Security and operational considerations

Turning on enforcement is the easy part. The cards below cover the operational work that keeps administrators from locking themselves out, closes gaps that enforcement does not reach, and shows whether every login path is actually covered. Review them before the enforcement change goes live, then again after each upgrade or identity change.

Plan lockout and recovery

Before setting MB_MFA_ENFORCEMENT to require 2FA, confirm that at least two administrators have enrolled authenticator apps and have tested a login with them. Record who can reset a user's enrollment and through which channel, since an administrator who loses their device and has no second admin to help will be locked out. Agree on a documented recovery path for the case where every administrator is unavailable, and rehearse it on a staging instance first. Ask the vendor or your own runbook owner to confirm the exact reset steps for your version.

2FA docs

Close the API key gap

Requiring 2FA does not affect API keys, so any integration or script that authenticates with a key keeps working without a second factor. Inventory every API key in use, including those created for reporting tools, CI jobs and automation, and note the account and permissions each one carries. Rotate keys that belong to people who have left, and move long-lived automation to narrowly scoped keys owned by a service account. Treat this inventory as a standing control, not a one-time cleanup.

2FA docs

Protect enforcement environment variables

Enforcement is controlled by MB_MFA_ENFORCEMENT and MB_MFA_REQUIREMENT_DEADLINE. If someone can change these values in your container platform, configuration management or hosting console, they can quietly switch enforcement back to optional. Restrict write access to the deployment definition, store it in version control with review, and alert on changes to these two keys. Confirm after each deployment that the running process reports the values you approved.

Audit who is enrolled

Enrollment status should be checked against your user directory on a regular schedule, not assumed from the enforcement setting. Export the active user list from the Metabase admin area, compare it with your identity source, and identify accounts that are active but not enrolled, along with any that are dormant. Pay attention to shared or service-style accounts, which often have no person attached to a device. Record each review with a date and the name of the reviewer so that you can show the control operated over time.

Cover LDAP and password users

Confirm that 2FA enforcement applies to both password logins and LDAP logins in your tested configuration, rather than relying on the setting name alone. Sign in as one test user from each path after enforcement is enabled, and confirm that the second factor is requested. Check how users who authenticate through Google Sign-In or another SSO method are handled, and document whether your identity provider already enforces a second factor for those users. Gaps between paths are the most common reason a control looks complete on paper but is not.

Set a deadline and communicate it

A required-by deadline set through MB_MFA_REQUIREMENT_DEADLINE gives users time to enroll, but it also creates a hard cutover date that support staff must be ready for. Announce the date with enrollment instructions, and confirm which users are not yet enrolled as the date approaches. Decide in advance whether the deadline will be extended for anyone, who approves that exception, and how long it may last. Keep a record of the decision so the exception does not become permanent.

Questions teams ask before requiring 2FA

Is requiring two-factor authentication in Metabase a configuration task or a project?

For a small instance with a few admins and a clear user list, it is usually a configuration task: you choose an enforcement mode, set a deadline if you want one, and tell users how to enroll. It becomes a project when the instance has many users, password and LDAP logins mixed together, several deployment environments, or a rollout that must be coordinated with help desk and compliance teams. The Metabase docs describe the settings as optional, required now, or required by a deadline, set through MB_MFA_ENFORCEMENT and MB_MFA_REQUIREMENT_DEADLINE. Confirm your version's exact behavior in the Metabase two-factor authentication docs before you plan the rollout.

What drives the effort of enforcing 2FA in Metabase?

Effort rises with the number of users who must enroll, the number of login paths in use, and the volume of questions your support team will field. The main drivers are:

  • User count and how many people have never used an authenticator app
  • Whether LDAP logins are in scope alongside password logins
  • Whether email delivery works, since email fallback codes depend on it
  • How much communication, training and help desk time the rollout needs
  • Whether API keys and automated jobs need a separate review, because requiring 2FA does not affect API keys

Ask any provider to break its quote down along these lines.

Does enforcing 2FA in Metabase affect LDAP logins and API keys?

Enforcement applies to password and LDAP logins, so LDAP users are not exempt by default. Requiring 2FA does not affect API keys, which means scripts and integrations that authenticate with keys keep working without a second factor. That is useful for automation, but it also means API keys remain a credential to protect with rotation, scoping and storage controls. Test LDAP sign-in on a staging copy first, because a misconfigured directory or a second factor that users cannot complete can lock people out. Confirm the LDAP and API key behavior for your Metabase version in the Metabase documentation.

What does the client team need to provide for a 2FA rollout?

The client team owns the decisions and the environment. Expect to provide:

  • A named owner who approves the enforcement mode and deadline
  • Access to the Metabase admin settings and the environment variables or configuration source for the instance
  • Working outbound email if email fallback codes are part of the plan
  • A user list or directory group that shows who must enroll
  • A communication plan, enrollment instructions and a support queue for the first weeks

Without these inputs, a partner can only estimate the work, not scope it.

Can our own team enforce 2FA in Metabase without a partner?

Yes, if you have an administrator who can change configuration, test sign-in and manage a rollout. The setting itself is small, so the real work is planning, testing and user support. Teams that do it internally usually need to decide the enforcement mode, set a deadline that gives users time to enroll, test with a pilot group, and document the recovery path for users who lose their device. A partner adds value when the instance is complex, when compliance evidence must be prepared, or when the team lacks capacity to run a controlled rollout alongside other work.

When does an implementation partner add value for Metabase 2FA?

A partner is most useful when 2FA is one part of a wider authentication change. Examples include moving users from password logins to SSO, aligning Metabase sessions and password policy with your access rules, or preparing evidence that an assessor will ask for. The engagement scope and deliverables are agreed in writing before work starts, and most DeployOpen engagements are fixed-scope. For a quote, ask for the scope, the environments covered, the testing approach and what the client team must supply.

What breaks most often when 2FA is first enforced?

The most common problems are users who cannot find or set up an authenticator app, email codes that never arrive, and LDAP users whose sign-in path behaves differently from password users. A deadline that arrives before users have enrolled also creates a surge of help desk tickets. Plan for these by testing enrollment on a staging copy, confirming outbound email, publishing clear instructions, and keeping an admin recovery procedure documented before enforcement starts.

Does 2FA enforcement in Metabase need ongoing support?

Enforcement itself is not a recurring task, but support load recurs whenever new users join, devices change or upgrades touch authentication settings. Ask whether your team will own user recovery, how new hires enroll, and who reviews the settings after each Metabase upgrade. Ongoing support, upgrades and testing can be covered by a retainer if your team wants continuing help rather than a one-time change.

How the scope is agreed before work starts

DeployOpen typically agrees scope, deliverables and timelines in writing before any configuration starts, so the two-factor work is defined by what your organization actually runs. The first decision is the login methods in use. Enforcement applies to password and LDAP logins, so an instance that signs everyone in through SAML, OIDC or Google Sign-In has a different two-factor picture than one that still allows email and password. The scope should record which methods are enabled today, which are planned, and whether password logins will be kept as a fallback for any group of users.

The second group of inputs covers the user population and identity source. The scope needs the number of active accounts, which groups or departments they belong to, whether service or shared accounts exist, and where the authoritative user record lives, such as Active Directory, OpenLDAP or an identity provider. Users who are managed in a directory may need enrollment steps handled through that directory's own processes. Ask your team to confirm how accounts are created and disabled, since enforcement deadlines are easier to manage when account lifecycle is already reliable.

The third input is the email delivery path. Email fallback codes depend on Metabase sending mail through your SMTP relay, so the scope should name the mail server, the sending address, and who owns the relay. Confirm that outbound mail from the Metabase host is allowed and tested before enforcement is switched on. Finally, agree on the change window, who approves the enforcement date, and how users will be told about it. Those items are easier to price and to verify when they are written down before the work begins, and a quote should follow directly from that written scope.

How DeployOpen delivers Metabase 2FA enforcement

DeployOpen plans and builds two-factor authentication for a self-hosted Metabase inside your own infrastructure, starting from your access policy and the login methods your users already rely on. The work covers enforcement settings, enrollment rollout, API key handling and the configuration kept as code, with written evidence your security team can review.

How we scope

  • Confirm which login paths need 2FA, including password and LDAP sign-in, and which are out of scope
  • Agree the enforcement mode, whether optional, required now or required by a deadline, in writing before build
  • Document how API keys, service accounts and existing sessions will be treated, and who approves the exceptions

How we build

  • Set enforcement through the MB_MFA_ENFORCEMENT and MB_MFA_REQUIREMENT_DEADLINE configuration settings in your environment
  • Test enrollment, fallback email codes and lockout recovery on a non-production instance that mirrors your setup
  • Express the settings as code so changes go through review and can be rebuilt after a redeploy

How we hand over

  • Deliver a runbook covering enrollment steps, recovery for lost authenticators and admin contacts for each step
  • Provide a test record showing each login path behaves as the agreed policy requires, ready for your reviewers
  • Walk your administrators through changing the deadline and the process for granting temporary exceptions

How we support

  • Offer ongoing support and upgrade work as a retainer, so 2FA settings are rechecked after each Metabase upgrade
  • Retest the login paths after identity provider, LDAP or Metabase configuration changes that could affect enforcement
  • Agree in the written scope what support is included, how requests are logged and who on your side approves changes

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.