Rayfin

Environment variables

The canonical, exhaustive reference for every environment variable the Rayfin CLI and runtime read or write — frontend, tooling, feature flags, and file locations.

This page is the single reference for every environment variable Rayfin tooling reads or writes. Other pages in this reference link here instead of repeating the tables.

Frontend-visible variables (RAYFIN_PUBLIC_*)

These live in rayfin/.env and are the only variables exposed to frontend builds. rayfin env (or the auto-emit built into rayfin up) maps them to framework-specific names in .env.local.

VariableDescriptionPopulated by
RAYFIN_PUBLIC_API_URLDeployed Fabric backend URL.rayfin up
RAYFIN_PUBLIC_PUBLISHABLE_KEYPublic key for Rayfin SDK initialization.rayfin up
RAYFIN_PUBLIC_ITEM_IDFabric AppBackend item ID. Used for Fabric brokered auth.rayfin up
RAYFIN_PUBLIC_WORKSPACE_IDFabric workspace ID. Used for Fabric brokered auth.rayfin up
RAYFIN_PUBLIC_TENANT_IDEntra ID tenant for workspace disambiguation.rayfin up
RAYFIN_PUBLIC_PORTAL_URLFabric Portal base URL (e.g. https://app.fabric.microsoft.com/).rayfin up
RAYFIN_PUBLIC_SERVICE_MODErayfin (real backend) or mock (local testing).User-set in rayfin/.env
RAYFIN_PUBLIC_FRONTEND_PORTStable per-project frontend dev-server port, assigned once and reused so the dev server pins a deterministic origin the deployed backend can allow-list.rayfin up

Framework mapping

rayfin env --framework <fw> maps each RAYFIN_PUBLIC_* variable to a framework-specific name:

Source (rayfin/.env)Vite (.env.local)Next.js (.env.local)Plain (.env.local)
RAYFIN_PUBLIC_API_URLVITE_RAYFIN_API_URLNEXT_PUBLIC_RAYFIN_API_URLAPI_URL
RAYFIN_PUBLIC_PUBLISHABLE_KEYVITE_RAYFIN_PUBLISHABLE_KEYNEXT_PUBLIC_RAYFIN_PUBLISHABLE_KEYPUBLISHABLE_KEY
RAYFIN_PUBLIC_ITEM_IDVITE_FABRIC_ITEM_IDNEXT_PUBLIC_FABRIC_ITEM_IDITEM_ID
RAYFIN_PUBLIC_WORKSPACE_IDVITE_FABRIC_WORKSPACE_IDNEXT_PUBLIC_FABRIC_WORKSPACE_IDWORKSPACE_ID
RAYFIN_PUBLIC_TENANT_IDVITE_FABRIC_TENANT_IDNEXT_PUBLIC_FABRIC_TENANT_IDTENANT_ID
RAYFIN_PUBLIC_PORTAL_URLVITE_FABRIC_PORTAL_URLNEXT_PUBLIC_FABRIC_PORTAL_URLPORTAL_URL
RAYFIN_PUBLIC_SERVICE_MODEVITE_SERVICE_MODENEXT_PUBLIC_SERVICE_MODESERVICE_MODE
RAYFIN_PUBLIC_FRONTEND_PORTVITE_PORTPORTFRONTEND_PORT

A custom variable follows the same generic pattern: RAYFIN_PUBLIC_FOO becomes VITE_RAYFIN_FOO (Vite), NEXT_PUBLIC_RAYFIN_FOO (Next.js), or FOO (plain).

RAYFIN_PUBLIC_FRONTEND_PORT maps to the port variable each dev server reads (VITE_PORT for Vite, PORT for Next.js); the scaffolded vite.config.ts pins the server to it with strictPort, so if the assigned port is taken the dev server fails fast instead of silently drifting to another port. To use a different port, set RAYFIN_PUBLIC_FRONTEND_PORT in rayfin/.env and re-run rayfin envrayfin up registers whatever value is assigned in the deployed redirect allow-list.

Tooling overrides

Configure CLI and extension behavior. Not exposed to the frontend. Set in rayfin/.env or as shell environment variables.

VariableDescriptionDefault
RAYFIN_FABRIC_API_URLFabric REST API base URL the CLI calls. For *.fabric.microsoft.com hosts, accepts a bare origin or a full <origin>/v1 URL (extra path segments are stripped). For non-Fabric hosts — for example, a credential proxy — accepts an origin plus path prefix; the prefix is preserved and /v1 is appended only if not already present.https://api.fabric.microsoft.com/v1
RAYFIN_FABRIC_PORTAL_URLFabric portal base URL for deep links and RAYFIN_PUBLIC_PORTAL_URL.https://app.fabric.microsoft.com/
RAYFIN_ENV_FILEPath to an alternate .env file. Equivalent to --env-file.rayfin/.env

When set alone (not accompanied by a persisted rayfin login), the two Fabric endpoint variables apply only to the current process and aren't persisted — later invocations need the same shell or rayfin/.env value to keep using the override.

Resolution precedence per variable: shell env var > value in rayfin/.env > persisted environmentConfig in ~/.rayfin/auth.json > built-in default.

Warning

When RAYFIN_FABRIC_API_URL points at a non-*.fabric.microsoft.com host, the CLI sends the Fabric bearer token it acquired to that host on every REST call. Only point this at a host you trust to handle tokens responsibly, typically a first-party credential proxy you operate yourself — there is currently no trusted-host allowlist. Operations that return a 202 with a Location header are also a known limitation in proxy mode: the CLI follows the absolute URL in Location, which usually points back at the upstream Fabric host and bypasses the proxy.

Shell-only variables

Read from the shell environment. Never written to files.

VariableDescription
RAYFIN_TOKENPre-acquired bearer token for headless or non-interactive usage. Bypasses interactive Entra ID login. Prefer rayfin login --service-principal for CI; use RAYFIN_TOKEN when a token is already available from an external source (e.g. az account get-access-token).
RAYFIN_WORKSPACE_IDFabric workspace ID for non-interactive setup. Used with RAYFIN_TOKEN.
RAYFIN_TENANT_IDEntra ID tenant used by rayfin up for portal URLs and the ctid query parameter. Equivalent to -t, --tenant <id> (precedence: flag > env var > signed-in tenant).
RAYFIN_ENCRYPTION_FALLBACK_ENABLEDSet to true to allow a plaintext token cache on systems without OS credential storage. Development only. Equivalent to --encryption-fallback-enabled.
RAYFIN_FEATURE_FLAGSComma-separated list of preview feature names to enable (case-insensitive) — see the table below.
RAYFIN_APPINSIGHTS_CONNECTION_STRINGOverrides the telemetry endpoint used by the CLI and the VS Code extension.
RAYFIN_CONFIG_DIROverrides the ~/.rayfin directory where auth state and the token cache are stored.
RAYFIN_TELEMETRY_OPTOUTSet to 1 to disable CLI telemetry — see Telemetry.

Recognized RAYFIN_FEATURE_FLAGS values

FlagEffectAlso auto-enabled by
storageExposes the Storage prompt in rayfin init.services.storage.enabled: true in rayfin.yml
functionsExposes rayfin functions, rayfin up functions deploy, and the Functions prompt in rayfin init.services.functions.enabled: true in rayfin.yml
connectorsExposes the rayfin connector command group.services.connectors.enabled: true or any entry under connectors: in rayfin.yml

Combine multiple flags with a comma, for example RAYFIN_FEATURE_FLAGS=connectors,functions.

File locations

PathPurposeCommitted
rayfin/.envAll runtime and deployment values.No (gitignored)
rayfin/.env.exampleDocuments expected variables with placeholder values.Yes
rayfin/.deployments.jsonMulti-deployment registry (item IDs, API URLs, workspace IDs).No (gitignored)
rayfin/rayfin.ymlProject configuration, service toggles, static hosting and Functions settings.Yes
rayfin/.lockfile.jsonAgent-files install record — see Ai-files.Yes
.env.localFramework-specific frontend variables, auto-generated by rayfin env.No (gitignored)
~/.rayfin/auth.jsonCLI authentication state (tenant, account hints, persisted environment overrides).N/A (user home)
~/.rayfin/cache.binEncrypted MSAL token cache (OS-backed encryption when available).N/A (user home)

Resolution priority

When the same variable is defined in more than one place, the value resolves in this order (highest priority first):

  1. Shell environment variable.
  2. --env-file <path> CLI flag (or RAYFIN_ENV_FILE).
  3. rayfin/.env file.
  4. Default value (hardcoded, or from rayfin.yml interpolation defaults).

See Environment variable interpolation for how ${VAR} / ${VAR:-default} inside rayfin.yml resolves against this same priority order.

PromptFind why a frontend build has the wrong API URL
My built frontend is calling the wrong backend URL. Check rayfin/.env for RAYFIN_PUBLIC_API_URL, check whether a RAYFIN_PUBLIC_API_URL or VITE_RAYFIN_API_URL is set in my shell environment (which would take priority), and check .env.local. Tell me which value wins and why, then fix it by re-running `npx rayfin env --framework vite`.
Something wrong on this page?Report an issueEdit this page

On this page