Microsoft Fabric REST API client
Project description
Fabric PBI Client
Python client for the Microsoft Fabric REST API.
Install
pip install fabric-pbi
Quick start
from fabricpandas import FabricClient
client = FabricClient()
workspaces = client.list_workspaces()
Example .env for quick start:
FABRIC_ACCESS_TOKEN=your_access_token_here
Authentication
Authentication is loaded from a .env file (default) or your shell. You can:
- Provide a bearer token directly, or
- Use service principal credentials to request a token via MSAL, or
- Use interactive login via system browser.
Option 1: Access token
Set an access token as an environment variable:
FABRIC_ACCESS_TOKEN(preferred if you already have a token), ortenant_id,client_id,client_secret(service principal)
Example .env:
FABRIC_ACCESS_TOKEN=your_access_token_here
Option 2: Service principal (MSAL)
Set your Azure AD app credentials in .env:
tenant_id=your_tenant_id
client_id=your_client_id
client_secret=your_client_secret
The client will request a token for:
https://analysis.windows.net/powerbi/api/.default
Install MSAL if you use service principal auth:
pip install msal
Option 3: Interactive login (system browser)
Configure a public client app in Azure AD and add a redirect URI of http://localhost.
Set your app and tenant IDs in .env:
tenant_id=your_tenant_id
client_id=your_client_id
Usage:
from fabricpandas import FabricClient
client = FabricClient(interactive_login=True)
Or request a token directly:
from fabricpandas.auth import get_fabric_token_interactive
token = get_fabric_token_interactive()
Custom .env path
Pass a custom env file path when constructing the client:
from fabricpandas import FabricClient
client = FabricClient(env_file="path/to/.env")
Troubleshooting auth
Missing required environment variables: setFABRIC_ACCESS_TOKENor all oftenant_id,client_id,client_secret.Missing required environment variables for interactive login: settenant_idandclient_idand ensure your app is a public client withhttp://localhostredirect URI.msal library is required: install MSAL withpip install msal.Failed to acquire token: verify Azure AD app credentials and that the app has access to Fabric APIs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fabric_pbi-1.0.0.tar.gz.
File metadata
- Download URL: fabric_pbi-1.0.0.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eaa06b4c6942893b978f91f06ce8310a3ba824c4222b21e5b89abbd9a61f7061
|
|
| MD5 |
855b2bebe58a9978dd50c8835a57ef6a
|
|
| BLAKE2b-256 |
7cd183091c8b2957d744eaf9d0823045bfbebe71d94628a37dfbf5afa0450cdb
|
File details
Details for the file fabric_pbi-1.0.0-py3-none-any.whl.
File metadata
- Download URL: fabric_pbi-1.0.0-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88ab4cbf1d69d6b03ac2955fe360beab6c8f6d2671772bed9513415ac917e8f5
|
|
| MD5 |
2687fb5871c17ebfb0ef8095f283be91
|
|
| BLAKE2b-256 |
84757023fc4f9f3e7a570fe2bac1441ee242d574d0aaff474ab076aa36e24d43
|