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.0.tar.gz (140.4 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.0-py3-none-any.whl (138.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fabias-1.0.0.tar.gz
  • Upload date:
  • Size: 140.4 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.0.tar.gz
Algorithm Hash digest
SHA256 d3be12164f006ef682e38819d82a8885ec9bbf82f052fda9dfc6aeb04a11c93a
MD5 b8d3704146e6a782d4556be856dc74b1
BLAKE2b-256 a369b6af56c513b1723e48a440f954c16394a697e8789fe9a9a6ab0a3879680b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabias-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd65f5f108d732904b7df8a2936257027fe8febfc4cb16ad455435c75ddb9a1f
MD5 1c068255e17221037035e170f7a3d57d
BLAKE2b-256 d0143382aa051dbd35d9b28da3e712b559947be587862b7ae52a643277cfae4f

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