Microsoft Azure Power BI Embedded Management Client Library for Python

3.0.0 · active · verified Sat Apr 11

This is the Microsoft Azure Power BI Embedded Management Client Library for Python, providing client-side functionality to manage Power BI Embedded workspace collections and retrieve workspaces within an Azure subscription. The library is currently at version 3.0.0 and follows the Azure SDK release cadence, with updates typically driven by new features or breaking changes in the underlying Azure API.

Warnings

Install

Imports

Quickstart

Initializes the PowerBIEmbeddedManagementClient using `DefaultAzureCredential` for authentication. This example assumes environment variables like `AZURE_SUBSCRIPTION_ID`, `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, and `AZURE_CLIENT_SECRET` are set for authentication. The client is used to manage Azure Power BI Embedded resources. Note that Power BI Embedded A SKUs and Workspace Collections have largely transitioned to Fabric F SKUs.

import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.powerbiembedded import PowerBIEmbeddedManagementClient

# Set environment variables for authentication and subscription ID:
# AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET (for service principal)
# AZURE_SUBSCRIPTION_ID

# For local development, DefaultAzureCredential will try various methods (env vars, managed identity, VS Code, Azure CLI, etc.)
credential = DefaultAzureCredential()

subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "")
if not subscription_id:
    raise ValueError("AZURE_SUBSCRIPTION_ID environment variable is not set.")

client = PowerBIEmbeddedManagementClient(credential=credential, subscription_id=subscription_id)

# Example: List Power BI Embedded workspace collections (replace with actual operation)
# This is a placeholder as Power BI Embedded workspace collections are largely deprecated
# and modern Power BI embedding relies on other APIs or Fabric capacity.
# The management library is for managing the *Azure resource* itself, not the Power BI content.
# For Power BI content interaction, refer to Power BI REST APIs and SDKs.
# https://learn.microsoft.com/en-us/rest/api/power-bi/ 

# The Power BI Embedded A SKUs were deprecated in favor of Fabric F SKUs.
# The management client would typically manage resources like capacity or workspace collections.
# As workspace collections are deprecated, direct management with this client for new scenarios is less common.
# For illustrative purposes, an older operation might look like:
# collections = client.workspace_collections.list_by_resource_group(resource_group_name="myResourceGroup")
# for collection in collections:
#     print(collection.name)

print("PowerBIEmbeddedManagementClient initialized. Operations may vary based on current Azure API status.")

view raw JSON →