Configuring Entra ID SAML SSO with Self-Hosted Supabase
This guide walks through configuring Microsoft Entra ID (formerly Azure AD) as a SAML identity provider for your self-hosted Supabase instance to enable SSO authentication with sfp pro CLI/codev
Prerequisites
Before starting the configuration, ensure you have:
Self-Hosted Supabase Requirements:
Running Supabase instance (Docker or Kubernetes)
Access to modify environment variables and configuration files
SSL certificates configured (SAML requires HTTPS)
Ability to restart services
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 Self-Hosted Supabase
Generate Private Key
SAML requires a private key for signing. Generate one:
bash
Configure Environment Variables
Add to your .env file (in the same directory as docker-compose.yml):
bash
Update Docker Compose Configuration
In your docker-compose.yml, pass the SAML environment variables to the auth container:
yaml
Configure Kong API Gateway
Edit /docker/volumes/api/kong.yml to expose SAML endpoints:
yaml
Configure Reverse Proxy (if applicable)
If using Nginx as a reverse proxy, add:
nginx
Restart Services
bash
Verify SAML is Enabled
bash
You should see "saml_enabled": true in the response.
# Restart Docker services
docker-compose down
docker-compose up -d
# If using Nginx
sudo systemctl restart nginx
# Get your service role key from .env or docker-compose.yml
API_KEY=<your-service-role-key>
# Check settings
curl -X GET https://your-supabase-instance.com/auth/v1/settings \
-H "APIKey: $API_KEY" \
-H "Authorization: Bearer $API_KEY"
# Your Supabase instance URL
SUPABASE_URL=https://your-supabase-instance.com
# Your Supabase anon key (from .env or docker-compose.yml)
SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
# SAML endpoints
Entity ID: https://your-supabase-instance.com/auth/v1/sso/saml/metadata
ACS URL: https://your-supabase-instance.com/auth/v1/sso/saml/acs
Metadata URL: https://your-supabase-instance.com/auth/v1/sso/saml/metadata
# Set your service role key
API_KEY=<your-service-role-key>
# Add SAML provider using metadata URL
curl -X POST https://your-supabase-instance.com/auth/v1/admin/sso/providers \
-H "APIKey: $API_KEY" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "saml",
"metadata_url": "https://login.microsoftonline.com/<tenant-id>/federationmetadata/2007-06/federationmetadata.xml",
"domains": ["yourdomain.com"]
}'