Deploying Platform Docs to Cloudflare Pages with Entra Authentication
This document walks through the end-to-end deployment of the sparqd/platform-docs Docusaurus site to Cloudflare Pages, including Microsoft Entra ID authentication via MSAL.
Part 1: Deploy to Cloudflare Pages
1.1 Create the Pages Application
- Go to the Cloudflare dashboard → Build → Compute → Workers & Pages.
- Click Create Application.
- Under the Pages section, click Get started (next to "Looking to deploy Pages?").
- Select Import an existing Git repository → Get started.
1.2 Connect the GitHub Repository
- Click Connect GitHub.
- Select the
sparqdorganization. - Choose Only select repositories → select
sparqd/platform-docs. - Click Install and authorize.
1.3 Configure Build Settings
Click Begin setup and enter the following:
| Setting | Value |
|---|---|
| Project name | platform-docs |
| Production branch | main |
| Framework preset | Docusaurus |
| Build command | npm run build |
| Build output directory | /build |
Click Save and deploy.
Cloudflare will assign a preview URL such as https://platform-docs-4fl.pages.dev/ once the first build completes.
Part 2: Register the App in Microsoft Entra ID
2.1 Create the App Registration
-
Go to https://entra.microsoft.com/.
-
Navigate to App registrations → New registration.
-
Fill in the form:
Field Value Name Platform DocsSupported account types Single tenant only — Quant-Data Redirect URI (Platform) Single-page application Redirect URI (URL) https://platform-docs-4fl.pages.dev/ -
Click Register.
2.2 Configure Redirect URIs
-
In the left navigation, go to Authentication → Redirect URI configuration tab.
-
Add the following URIs (all as Single-page application type):
Environment URI Local development http://localhost:9000Cloudflare preview https://platform-docs-4fl.pages.dev/Add additional URIs (e.g. custom production domain) as needed.
-
Click Save.
2.3 Retrieve Credentials
- In the left navigation, go to Overview.
- Copy:
- Application (client) ID → this is your
MSAL_CLIENT_ID - Directory (tenant) ID → this is your
MSAL_TENANT_ID
- Application (client) ID → this is your
Part 3: Configure Environment Variables
3.1 Local Development
Add to your .env file (do not commit to version control):
# Microsoft Entra ID (Azure AD) app registration
MSAL_CLIENT_ID=your-application-client-id
MSAL_TENANT_ID=your-directory-tenant-id
3.2 Cloudflare Pages Secrets
-
Go to Workers & Pages → platform-docs → Settings tab.
-
Scroll to Variables and Secrets.
-
Add the following:
Type Variable Name Value Secret MSAL_CLIENT_IDYour Application (client) ID Secret MSAL_TENANT_IDYour Directory (tenant) ID -
Click Save.
These secrets will be available from the next deployment onwards. Trigger a re-deploy if the site was already live before adding them.
Part 4: Verify
- Visit
https://platform-docs-4fl.pages.dev/and confirm the site loads. - Attempt login — you should be redirected to the Microsoft login page and back.
- Check the Deployments tab in Cloudflare Pages for build logs if anything fails.
Reference Commits
- Initial Entra auth integration:
c867c324
Part 5: Set Up a Custom Domain
- Go to Workers & Pages → platform-docs → Custom domains tab.
- Click Set up a custom domain and enter the subdomain (e.g.
platform-docs.internal.cogrion.com). - Cloudflare will automatically add the required CNAME record to the
cogrion.comzone (since it is managed in the same Cloudflare account). Confirm when prompted. - Wait for DNS propagation and SSL provisioning — status will show Active with SSL enabled once complete.
- Add the new domain as a redirect URI in the Entra app registration (see Part 2.2).
If the domain is managed in a different Cloudflare account, manually add a CNAME record pointing to
platform-docs.pages.devin that zone instead.
Related Documents
- Cloudflare Pages Deployment — generalized deployment reference
- Microsoft Entra ID Authentication — generalized Entra/MSAL reference