Skip to main content

Fabric Infrastructure and Security - OneLake security and workspace automation for Microsoft Fabric

Project description

fabias - Fabric Infrastructure and Security

PyPI version Documentation Python 3.9+ License: MIT

OneLake security and workspace automation for Microsoft Fabric. Works seamlessly both inside Fabric notebooks and as a standalone library.

Why fabias?

Microsoft Fabric has no official Python SDK. The CLI is limited. fabias fills the gaps:

  • OneLake ABAC Security - Table/row/column-level access control as code
  • Workspace Automation - Create workspaces, assign roles, configure Spark
  • CI/CD Ready - Works outside Fabric for GitHub Actions and automation scripts
  • Hybrid Runtime - Same code runs in notebooks and standalone

Installation

pip install fabias

Quick Start

Inside Microsoft Fabric

Authentication is automatic:

import fabias

ws = fabias.workspace()  # Current workspace
pipeline = ws.pipeline("Daily ETL")
job = pipeline.run()
job.wait()

Standalone Usage

import fabias
from fabias import ServicePrincipalAuth

auth = ServicePrincipalAuth(
    tenant_id="your-tenant-id",
    client_id="your-client-id",
    client_secret="your-client-secret"
)
fabias.client(auth=auth)

ws = fabias.workspace("Analytics")
lakehouse = ws.lakehouse("Gold")

OneLake Data Access Roles (ABAC Security)

The killer feature. Define lakehouse security as code:

import fabias
from fabias import Role, Rule, EntraMember, FabricItem, ReadWrite, ItemAccess
from fabias import RowLevelSecurity, ColumnLevelSecurity

ws = fabias.workspace("Analytics")
lakehouse = ws.lakehouse("Sales")

# Regional managers: read-only with row filter
regional_role = Role(
    name="Regional Managers",
    rules=[
        Rule(
            path=["dbo.sales"],
            access=ReadWrite.READ,
            rls=RowLevelSecurity("region = 'West'")
        )
    ],
    members=[EntraMember("managers-group-guid")]
)

# Data engineers: full access inherited from workspace permissions
engineer_role = Role(
    name="Data Engineers",
    rules=[Rule(path=["*"], access=ReadWrite.READWRITE)],
    members=[FabricItem(access=[ItemAccess.READALL])]
)

# Apply roles
lakehouse.accessRoles.replace([regional_role, engineer_role])

Workspace Operations

import fabias

# List workspaces
for ws in fabias.workspaces():
    print(f"{ws.name}: {ws.id}")

# Create workspace
new_ws = fabias.workspaces.add("Feature Branch", capacity_id="...")

# Role assignments
new_ws.roleAssignments.add(
    principalId="spn-guid",
    principalType="ServicePrincipal",
    role="Admin"
)

# Access items
pipelines = ws.pipelines()
lakehouses = ws.lakehouses()
notebooks = ws.notebooks()

Git Integration

ws = fabias.workspace("GENESIS")

# Check status
status = ws.git.status()
print(f"Synced: {status.is_synced}")

# Pull from Git
if status.has_changes:
    ws.git.updateFromGit().wait()

Connections

# List connections
for conn in fabias.connections():
    print(f"{conn.name}: {conn.connectivity_type}")

# Manage access
conn = fabias.connection("SQL Server")
conn.roleAssignments.add(principalId="user-guid", principalType="User", role="Owner")

Spark Settings

ws = fabias.workspace("Analytics")

# Configure workspace Spark
settings = ws.spark.settings
settings.highConcurrency.enabled = True
settings.pool.starterPool.maxNodes = 10
settings.commit()

Additional Modules

Azure Data Factory

from fabias.integrations import adf
from fabias import ServicePrincipalAuth

adf.client(
    subscription_id="...",
    resource_group="rg-name",
    factory="adf-name",
    auth=ServicePrincipalAuth(...)
)

job = adf.pipeline("ETL").run(date="2026-01-01")
job.wait()

Key Vault Secrets

from fabias.integrations import keyvault

# Inside Fabric (auth is automatic)
keyvault.client(vault_url="https://my-vault.vault.azure.net/")
password = keyvault.get("database-password")

Teams Messaging

from fabias.notifications import teams
from fabias.notifications.cards import Adaptive, TextBlock

teams.client(team_id="...", channel_id="...", auth=...)
teams.send(Adaptive(body=[TextBlock("Deployment complete!")]))

Authentication Methods

Method Use Case
Automatic Inside Fabric notebooks
ServicePrincipalAuth CI/CD, automation scripts
Environment variables AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET
From Key Vault Bootstrap from secrets

Requirements

  • Python 3.9+
  • requests
  • Inside Fabric: notebookutils (pre-installed)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fabias-1.0.1.tar.gz (140.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fabias-1.0.1-py3-none-any.whl (138.5 kB view details)

Uploaded Python 3

File details

Details for the file fabias-1.0.1.tar.gz.

File metadata

  • Download URL: fabias-1.0.1.tar.gz
  • Upload date:
  • Size: 140.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fabias-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1cb90283e6e8eed5132f422266f2bcbc140f76af206107b96f30ad3365ed6045
MD5 d775927e69231337e73d0b8dac849403
BLAKE2b-256 0c713300b01b8fc2ae23511099ab216ba89ab083f50aac312321083f1cde07b4

See more details on using hashes here.

File details

Details for the file fabias-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: fabias-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 138.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fabias-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b0bc8237ce306705c13c2f95cdeeada526cc91b3ec2b58f501d20beada450d1e
MD5 aef9d7dc91eeaebb66c2ba02cff2c5d1
BLAKE2b-256 d29af3c33989c65935ab987ecbd4628c3116591df36943a5c4ceb8a5dcdf4567

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page