Rayfin

Adding a connector

Discover Fabric sources, add a connector to rayfin.yml, choose its identity, install its pinned packages, review the generated app wiring, and re-add or remove connectors safely.

Add a connector when a Rayfin app needs to reach existing Fabric data. Start with connector search if you do not already have the workspace ID, item ID, and connector type. See Connectors for the connector-type catalog.

Changed in 1.36

rayfin connector is always registered and needs no connector opt-in gate.

Find a source

connector search lists Fabric items the signed-in identity can add and prints the exact connector add command for each result.

npx rayfin connector search [query] [--workspace-id <ws-id> --type <type>] [--limit <n>] [--json]

Choose one scope:

ScopeCommand shapeNotes
One workspacenpx rayfin connector search "sales" --workspace-id <ws-id> --type fabric-warehouse--type is required so the CLI makes a bounded request.
Every accessible workspacenpx rayfin connector search --all-workspaces --type fabric-warehouse,fabric-sqldatabase--type is required because it is the server-side filter for a tenant-wide scan.
Deployed project workspacesnpx rayfin connector searchRun inside a deployed Rayfin project with no scope flag. The CLI searches the workspaces recorded in the deployments registry.

Use --limit <n> to cap plain or JSON output. Interactive output ignores the limit because the picker paginates the full result set.

Search returns warehouses, SQL databases, Lakehouses, and semantic models. It does not return Eventhouse KQL databases, whose authoring is held in 2.0.0, or Fabric IQ, which is not tied to a Fabric item.

Use --json when an agent or script will choose the result. The JSON envelope includes status, query, scope, count, and sources. Each source includes workspaceId, itemId, connectorType, suggestedName, and a ready-to-run addCommand.

{
  "status": "ok",
  "query": "sales",
  "scope": { "workspaceId": "<ws-id>" },
  "count": 1,
  "limit": 5,
  "sources": [
    {
      "workspaceId": "<ws-id>",
      "workspaceName": "Finance",
      "itemId": "<item-id>",
      "itemType": "Warehouse",
      "displayName": "Inventory",
      "connectorType": "fabric-warehouse",
      "suggestedName": "inventory",
      "addCommand": "rayfin connector add --type fabric-warehouse --workspace-id <ws-id> --item-id <item-id> --name inventory"
    }
  ]
}

Add the connector

Run connector add with literal Fabric IDs. The flag is --type <type>, not --connector.

npx rayfin connector add --type <type> --workspace-id <ws-id> --item-id <item-id>
FlagRequiredPurpose
--type <type>YesConnector type: fabric-warehouse, fabric-sqldatabase, fabric-sqlanalytics, fabric-semanticmodel, or fabriciqmcp. Eventhouse authoring is held in 2.0.0.
--workspace-id <id>For item-backed typesFabric workspace ID. It must be a literal value; ${VAR} placeholders are rejected. fabriciqmcp takes none.
--item-id <id>For item-backed typesFabric item ID. It must be a literal value. fabriciqmcp takes none.
--name <name>For fabriciqmcpConnector name, stored in lowercase. When omitted, the CLI derives it from the Fabric item display name.
--operations <ops>NoComma-separated subset of the catalog operations, for example read,update. Omit it to use every allowed operation.
--auth <type>Nodelegated (run each call as the signed-in caller) or application (run each call as the app owner). Omit it to use the type's default. New in 2.0
-y, --yesNoAccept overwrite and confirmation prompts.
-v, --verboseNoPrint verbose diagnostics.
--jsonNoEmit machine-readable output.

Connector names must match /^[a-zA-Z0-9\-_]+$/ and can be at most 256 characters.

To add a Fabric IQ connector, pass only the type and a name:

npx rayfin connector add --type fabriciqmcp --name assistant

Choose the identity with --auth

New in 2.0

--auth sets auth.type at add time instead of hand-editing rayfin.yml afterwards. The CLI validates it against the connector type's allowed identities:

npx rayfin connector add --type fabric-warehouse --workspace-id <ws-id> --item-id <item-id> --auth delegated

An identity the type does not allow fails before anything is written:

Invalid --auth "application" for connector type "fabric-semanticmodel". Allowed: [delegated].

See Connector authentication for each type's default and allowed identities.

Name the connector

Changed in 1.36

connector add normalizes connector names to lowercase. A supplied --name SalesDW is written as salesdw.

Changed in 2.0

Connector names are case-insensitive. On success, connector add prints the name to use in app code, for example Use it in app code as client.connectors.salesdw. With --json, name is the name written to rayfin.yml, and requestedName is added when the name you passed was spelled differently.

A name that matches an existing entry in any casing refers to the same connector, so the command treats it as re-adding that connector and keeps the existing spelling โ€” for example Inventory from an older CLI. If several entries differ from the name only by case, an exact spelling picks one of them; otherwise the command fails and lists them.

Keep connectors off the app's own database

New in 2.0

Connectors are for external data. The app's managed database belongs to its data service: use client.data for it. Before adding a connector, the CLI reads the runtime settings of the app's recorded deployments in the target workspace and rejects an item that is their managed database โ€” including from the search picker and with --yes.

  • If the settings cannot be read or the database identity cannot be verified, the command fails without changing project files. Check your access to the deployment and retry.
  • A recorded deployment whose app no longer exists is skipped with a warning; run npx rayfin up to recreate the app and refresh the record.
  • Projects with no recorded deployment in that workspace can add external connectors as before.

Backends that enforce this rule also reject an existing Category A connector that points at the app's managed database when settings or schemas are applied, even when the data service is disabled. Before redeploying such an app, run npx rayfin connector remove <name> for each conflicting connector and move that code to the data service.

Know what the command writes

connector add verifies the Fabric item, writes a connectors: entry in rayfin/rayfin.yml, and scaffolds rayfin/connectors/<name>/schema.ts.

For Category A connectors, it also runs schema discovery and writes rayfin/connectors/<name>/metadata.json. For fabric-semanticmodel and fabriciqmcp, it writes a complete generated schema.ts.

The rayfin.yml entry uses an array. Operations are objects, not bare strings:

rayfin/rayfin.yml
connectors:
  - name: inventory
    type: fabric-warehouse
    config:
      workspaceId: <ws-id>
      itemId: <item-id>
    auth:
      type: application
    operations:
      - name: read
      - name: update
  - name: salesmodel
    type: fabric-semanticmodel
    config:
      workspaceId: <ws-id>
      itemId: <semantic-model-item-id>
    auth:
      type: delegated
    version: "1"
    operations:
      - name: executeQuery
  - name: assistant
    type: fabriciqmcp
    config: {}
    auth:
      type: delegated
    version: "1"
    operations:
      - name: executeQuery

New in 2.0

A Category B entry can also declare additionalPayload, a connector-defined JSON object that Rayfin saves with the connector's runtime settings. Eventhouse is the only connector type that uses it, for its saved queries. connector add never writes it: it keeps an existing additionalPayload when you re-add a connector of the same type, removes it with a warning when the type changes, and refuses to re-add a Category A connector that declares one. See Save queries in additionalPayload.

Scope operations

Use --operations to narrow a connector below the catalog default:

npx rayfin connector add --type fabric-warehouse --workspace-id <ws-id> --item-id <item-id> --operations read,update

Rules:

  • You can narrow below the catalog default, but you cannot widen above it.
  • There is no all meta-operation. List every action explicitly, or omit --operations to accept the catalog default.
  • The host validator rejects unknown or duplicate operation names at rayfin up time.

For the current connector types, the default operations are listed in Connectors.

Install the pinned packages

connector add scaffolds files but installs nothing. On success, it prints an exact version-pinned install command:

๐Ÿ“ฆ Install the packages this connector needs:
   npm install @microsoft/rayfin-connector-fabric-semanticmodel@2.0.0 @microsoft/rayfin-connectors@2.0.0

Run the command verbatim. Do not drop the version.

Connector packages ship in lockstep with the CLI, but their npm latest and preview tags can lag. An unversioned install can pull an older connector that hard-pins its own @microsoft/rayfin-data, leaving two Rayfin version lines in one app.

With --json, the same data appears under install.packages and install.command, and rayfin connector types --json carries the same packages array, so an agent can rebuild the exact install list from the live catalog when needed.

Review generated app wiring

New in 1.36

After it writes the connector files, connector add โ€” and connector remove โ€” keeps the app's src/lib/connectors.ts in step with rayfin.yml. The file exports the AppConnectorsSchema, connectorConfigs, and connectorRuntimes that the frontend client imports. In an npm workspace, the CLI uses the file in the package that depends on @microsoft/rayfin-connectors.

What happens depends on who owns the file. With --json, the outcome is wiring.action:

FileWhat the CLI doeswiring.action
Generated by the CLI (it carries the @generated by marker line), or the empty templateRewrites it and prints ๐Ÿ”Œ Wired N connector(s), or leaves it when it is already currentwritten or unchanged
Hand-written, and builds its maps with import.meta.glob over rayfin/connectors/*/schema.tsLeaves it alone and prints that the file discovers connectors automatically. If a rayfin/connectors/<name>/ directory outlives its rayfin.yml entry, the glob still registers it, so the CLI warns and lists it under undeclared. New in 2.0discovered
Any other hand-written fileLeaves it alone, warns that it has manual edits, and prints the maps to merge in. Until you do, the app renders nothing for the new connector.manual
No such fileWarns that nothing was wired; the connector is registered in rayfin.yml onlyabsent
More than one workspace package has oneChanges nothing and lists the candidate filesambiguous

The generator wires only connectors whose rayfin/connectors/<name>/schema.ts exports connectorConfig, so a Category A placeholder joins the wiring once you replace it with the aggregate schema. It preserves the app-owned region at the top of the file and prunes imports for connectors you removed.

When the CLI reports absent or manual, wire the same maps yourself as shown in Wiring connectors into your app.

Re-add a connector

Changed in 2.0

Running connector add with a name already in rayfin.yml refreshes that declaration. It prompts before overwriting, or requires --yes when non-interactive.

  • Entity files under rayfin/connectors/<name>/ are preserved. Schema discovery rewrites metadata.json, so re-adding is how you refresh it after the source schema changes.
  • A hand-written Category A aggregate schema.ts is preserved unless you pass --yes, which replaces it with a fresh placeholder. In a non-interactive shell, back the file up before you re-add and restore it afterwards.
  • A generated Category B schema.ts is always regenerated.
  • auth.type is reset to the type's default unless you pass --auth. Reapply an explicit delegated setting on a Category A connector.

Eventhouse connectors cannot be re-added while authoring is held: do not remove one to regenerate its files.

List and remove connectors

connector list reads the local rayfin.yml file and does not make network calls.

npx rayfin connector list
npx rayfin connector list -v
npx rayfin connector list --json

--json and --verbose cannot be combined.

Changed in 2.0

connector remove removes the rayfin.yml entry and regenerates the app wiring, but keeps the whole rayfin/connectors/<name>/ directory, including entity files you wrote. It needs confirmation; pass --yes in non-interactive shells:

npx rayfin connector remove <name> --yes

Files left in that directory can still be compiled when you run rayfin up. Keep their dependencies installed until you have backed them up and deleted or excluded them. With --json, the output reports directoryDeleted: false and this guidance under recovery.

Next step

After the connector entry and packages are in place, wire it into your app with Wiring connectors into your app. For the complete CLI flag reference, see rayfin connector.

PromptAdd a connector to a Rayfin project
In my Rayfin 2.0 project, add a connector to an existing Microsoft Fabric source. If I have not provided a connector type, workspace ID, and item ID, run `npx rayfin connector search` with the right scope (`--all-workspaces --type <type> --json`, or `--workspace-id <id> --type <type> --json`) to find candidates, and use the `addCommand` from the JSON output rather than inventing IDs. If I ask for a KQL database (Eventhouse), stop and report that new Eventhouse authoring is held in Rayfin 2.0.0. Run the add command with `--type <type>`, `--workspace-id <workspace-id>`, and `--item-id <item-id>` using literal IDs. Use `--name <name>` only if I provided a name or the derived name is unsuitable. Use `--operations <ops>` only to narrow below the catalog default. Pass `--auth delegated` if queries should run as the signed-in user, or `--auth application` to run as the app owner; omit it to keep the type's default. If the CLI rejects the item as the app's own managed database, stop and use client.data instead. After the add command succeeds, run the exact version-pinned `npm install` command it prints; do not drop package versions. Report the `wiring.action` from `--json` (or the wiring line it printed). Then list the configured connectors with `npx rayfin connector list` and prepare to register them with `connectorsService` from @microsoft/rayfin-connectors in `RayfinClient.create`.
Something wrong on this page?Report an issueEdit this page

On this page