Configuring Entra ID SAML SSO with Supabase Cloud

This guide walks through configuring Microsoft Entra ID (formerly Azure AD) as a SAML identity provider for your Supabase Cloud project to enable SSO authentication with sfp pro CLI/Codev

Prerequisites

Before starting the configuration, ensure you have:

  • Supabase Requirements:

    • Supabase Pro plan or higher (SAML support requires Pro tier)

    • Write access to your Supabase project

    • Supabase CLI version 1.46.4 or higher

    • Your project reference ID and anon key

  • Entra ID Requirements:

    • Admin access to your Microsoft Entra ID tenant

    • At least one verified domain in your Entra ID tenant

    • Ability to create Enterprise Applications

  • sfp Requirements:

    • sfp CLI installed

    • Access to your sfp server instance

    • sfp server URL (e.g., https://your-sfp-server.com)

Step 1: Enable SAML in Supabase Dashboard

  1. Navigate to your Supabase Dashboard

  2. Select your project

  3. Go to AuthenticationProviders

  4. Locate SAML 2.0 section

  5. Toggle Enable SAML 2.0 to enabled

  6. Save the configuration

Step 2: Note Your Supabase Configuration

Gather the following information from your Supabase project:

Step 3: Configure Entra ID Enterprise Application

Create the Application

  1. Sign in to Azure Portal

  2. Navigate to Microsoft Entra IDEnterprise applications

  3. Click New applicationCreate your own application

  4. Select Integrate any other application you don't find in the gallery (Non-gallery)

  5. Name it (e.g., "sfp SSO Production")

  6. Click Create

Configure SAML Settings

  1. In your application, go to Single sign-on

  2. Select SAML as the method

  3. Click Edit in Basic SAML Configuration

  4. Configure these URLs (replace <project-ref> with your actual reference):

Field
Value

Identifier (Entity ID)

https://<project-ref>.supabase.co/auth/v1/sso/saml/metadata

Reply URL (ACS URL)

https://<project-ref>.supabase.co/auth/v1/sso/saml/acs

Sign on URL

https://<project-ref>.supabase.co

  1. Click Save

Configure Attributes and Claims

  1. In Attributes & Claims, click Edit

  2. Ensure these claims are configured:

Claim Name
Source Attribute

Unique User Identifier

user.mail

emailaddress

user.mail

displayname

user.displayname

givenname

user.givenname

surname

user.surname

Download Federation Metadata

  1. In SAML Certificates section

  2. Download Federation Metadata XML

  3. Save the file locally

Assign Users

  1. Go to Users and groups

  2. Click Add user/group

  3. Select users who need sfp access

  4. Click Assign

Step 4: Configure Supabase with Entra ID

Install Supabase CLI

Login to Supabase

Add the SAML Provider

Using your downloaded metadata file and your organization's domain:

Example:

Configure Attribute Mappings

Create attribute-mapping.json:

Apply the mapping:

Verify Configuration

Ensure you see your domain listed in the output.

Step 5: Configure sfp CLI

Configure sfp to use your Supabase instance:

Example with actual values:

Step 6: Test SAML Authentication

Test the complete flow with sfp:

Example:

This command will:

  1. Contact your Supabase instance

  2. Identify the SAML provider for your domain

  3. Redirect you to Entra ID for authentication

  4. Upon successful login, create a JWT token for sfp server access

Troubleshooting

Common Issues

"No SSO provider assigned for this domain"

  • Verify domain configuration: supabase sso list --project-ref <your-project-ref>

  • Ensure the domain matches exactly what you configured

  • Check that SAML is enabled in Supabase dashboard

"SAML assertion does not contain email address"

  • Verify email claim is configured in Entra ID

  • Check attribute mappings include email

  • Ensure assigned users have email addresses in Entra ID

Authentication succeeds but sfp login fails

  • Verify sfp config points to correct Supabase instance:

  • Ensure the user's email domain matches the configured SSO domain

Certificate errors

  • Update metadata if certificates rotated:

Debug Commands

Managing Multiple Environments

For different environments (dev, staging, production), you can:

  1. Use environment variables:

  1. Or switch sfp configuration:

Security Considerations

  1. Protect your anon key: While public, avoid committing it to version control

  2. Use separate Supabase projects for different environments

  3. Regularly rotate certificates in Entra ID

  4. Monitor authentication logs in both Supabase and Entra ID

  5. Implement proper RLS policies in your Supabase database

Next Steps

After successful configuration:

  1. Document the SSO domain for your team

  2. Create user onboarding documentation

  3. Set up monitoring for authentication failures

  4. Plan for certificate rotation schedules

  5. Consider implementing automated user provisioning

Last updated