sempy_labs.admin package

Module contents

sempy_labs.admin.assign_domain_workspaces(domain_name: str, workspace_names: str | List[str])

Assigns workspaces to the specified domain by workspace.

This is a wrapper function for the following API: Domains - Assign Domain Workspaces By Ids.

Parameters:
  • domain_name (str) – The domain name.

  • workspace_names (str | List[str]) – The Fabric workspace(s).

sempy_labs.admin.assign_domain_workspaces_by_capacities(domain_name: str, capacity_names: str | List[str])

Assigns all workspaces that reside on the specified capacities to the specified domain.

This is a wrapper function for the following API: Domains - Assign Domain Workspaces By Capacities.

Parameters:
  • domain_name (str) – The domain name.

  • capacity_names (str | List[str]) – The capacity names.

sempy_labs.admin.assign_workspaces_to_capacity(source_capacity: str, target_capacity: str, workspace: str | List[str] | None = None)

Assigns a workspace to a capacity. This function is the admin version.

This is a wrapper function for the following API: Admin - Capacities AssignWorkspacesToCapacity.

Parameters:
  • source_capacity (str) – The name of the source capacity.

  • target_capacity (str) – The name of the target capacity.

  • workspace (str | List[str], default=None) – The name of the workspace(s). Defaults to None which resolves to migrating all workspaces within the source capacity to the target capacity.

sempy_labs.admin.create_domain(domain_name: str, description: str | None = None, parent_domain_name: str | None = None)

Creates a new domain.

This is a wrapper function for the following API: Domains - Create Domain.

Parameters:
  • domain_name (str) – The domain name.

  • description (str, default=None) – The domain description.

  • parent_domain_name (str, default=None) – The parent domain name.

sempy_labs.admin.delete_domain(domain_name: str)

Deletes a domain.

This is a wrapper function for the following API: Domains - Delete Domain.

Parameters:

domain_name (str) – The domain name.

sempy_labs.admin.list_access_entities(user_email_address: str) DataFrame

Shows a list of permission details for Fabric and Power BI items the specified user can access.

This is a wrapper function for the following API: `Users - List Access Entities <https://learn.microsoft.com/rest/api/fabric/admin/users/list-access-entities`_.

Parameters:

user_email_address (str) – The user’s email address.

Returns:

A pandas dataframe showing a list of permission details for Fabric and Power BI items the specified user can access.

Return type:

pandas.DataFrame

sempy_labs.admin.list_activity_events(start_time: str, end_time: str, activity_filter: str | None = None, user_id_filter: str | None = None)

Shows a list of audit activity events for a tenant.

This is a wrapper function for the following API: `Admin - Get Activity Events <https://learn.microsoft.com/rest/api/power-bi/admin/get-activity-events`_.

Parameters:
  • start_time (str) – Start date and time of the window for audit event results. Example: “2024-09-25T07:55:00”.

  • end_time (str) – End date and time of the window for audit event results. Example: “2024-09-25T08:55:00”.

  • activity_filter (str, default=None) – Filter value for activities. Example: ‘viewreport’.

  • user_id_filter (str, default=None) – Email address of the user.

Returns:

A pandas dataframe showing a list of audit activity events for a tenant.

Return type:

pandas.DataFrame

sempy_labs.admin.list_capacities() DataFrame

Shows the a list of capacities and their properties. This function is the admin version.

This is a wrapper function for the following API: Admin - Get Capacities As Admin.

Returns:

A pandas dataframe showing the capacities and their properties

Return type:

pandas.DataFrame

sempy_labs.admin.list_capacities_delegated_tenant_settings(return_dataframe: bool = True) DataFrame | dict

Returns list of tenant setting overrides that override at the capacities.

This is a wrapper function for the following API: `Tenants - List Capacities Tenant Settings Overrides <https://learn.microsoft.com/rest/api/fabric/admin/tenants/list-capacities-tenant-settings-overrides`_.

Parameters:

return_dataframe (bool, default=True) – If True, returns a dataframe. If False, returns a dictionary.

Returns:

A pandas dataframe showing a list of tenant setting overrides that override at the capacities.

Return type:

pandas.DataFrame | dict

sempy_labs.admin.list_datasets() DataFrame

Shows a list of datasets for the organization.

This is a wrapper function for the following API: `Admin - Datasets GetDatasetsAsAdmin <https://learn.microsoft.com/rest/api/power-bi/admin/datasets-get-datasets-as-admin`_.

Returns:

A pandas dataframe showing a list of datasets for the organization.

Return type:

pandas.DataFrame

sempy_labs.admin.list_domain_workspaces(domain_name: str) DataFrame

Shows a list of workspaces within the domain.

This is a wrapper function for the following API: Domains - List Domain Workspaces.

Parameters:

domain_name (str) – The domain name.

Returns:

A pandas dataframe showing a list of workspaces within the domain.

Return type:

pandas.DataFrame

sempy_labs.admin.list_domains(non_empty_only: bool = False) DataFrame

Shows a list of domains.

This is a wrapper function for the following API: Domains - List Domains.

Parameters:

non_empty_only (bool, default=False) – When True, only return domains that have at least one workspace containing an item. Defaults to False.

Returns:

A pandas dataframe showing a list of the domains.

Return type:

pandas.DataFrame

sempy_labs.admin.list_external_data_shares()

Lists external data shares in the tenant. This function is for admins.

This is a wrapper function for the following API: External Data Shares - List External Data Shares.

Returns:

A pandas dataframe showing a list of external data shares in the tenant.

Return type:

pandas.DataFrame

sempy_labs.admin.list_item_access_details(item_name: str, type: str, workspace: str | None = None) DataFrame

Returns a list of users (including groups and service principals) and lists their workspace roles.

This is a wrapper function for the following API: `Items - List Item Access Details <https://learn.microsoft.com/rest/api/fabric/admin/items/list-item-access-details`_.

Parameters:
  • item_name (str) – Name of the Fabric item.

  • type (str) – Type of Fabric item.

  • workspace (str, default=None) – The Fabric workspace name. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

Returns:

A pandas dataframe showing a list of users (including groups and service principals) and lists their workspace roles.

Return type:

pandas.DataFrame

sempy_labs.admin.list_items(capacity_name: str | None = None, workspace: str | None = None, state: str | None = None, type: str | None = None) DataFrame

Shows a list of active Fabric and Power BI items.

This is a wrapper function for the following API: `Items - List Items <https://learn.microsoft.com/rest/api/fabric/admin/items/list-items`_.

Parameters:
  • capacity_name (str, default=None) – The capacity name.

  • workspace (str, default=None) – The Fabric workspace name. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

  • state (str, default=None) – The item state.

  • type (str, default=None) – The item type.

Returns:

A pandas dataframe showing a list of active Fabric and Power BI items.

Return type:

pandas.DataFrame

sempy_labs.admin.list_tenant_settings() DataFrame

Lists all tenant settings.

This is a wrapper function for the following API: Tenants - List Tenant Settings.

Returns:

A pandas dataframe showing the tenant settings.

Return type:

pandas.DataFrame

sempy_labs.admin.list_workspace_access_details(workspace: str | UUID | None = None) DataFrame

Shows a list of users (including groups and Service Principals) that have access to the specified workspace.

This is a wrapper function for the following API: `Workspaces - List Workspace Access Details <https://learn.microsoft.com/rest/api/fabric/admin/workspaces/list-workspace-access-details`_.

Parameters:

workspace (str, default=None) – The Fabric workspace name. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

Returns:

A pandas dataframe showing a list of users (including groups and Service Principals) that have access to the specified workspace.

Return type:

pandas.DataFrame

sempy_labs.admin.list_workspaces(top: int | None = 5000, filter: str | None = None, skip: int | None = None) DataFrame

Lists workspaces for the organization. This function is the admin version of list_workspaces.

This is a wrapper function for the following API: Admin - Groups GetGroupsAsAdmin.

Parameters:
  • top (int, default=5000) – Returns only the first n results. This parameter is mandatory and must be in the range of 1-5000.

  • filter (str, default=None) – Returns a subset of a results based on Odata filter query parameter condition.

  • skip (int, default=None) – Skips the first n results. Use with top to fetch results beyond the first 5000.

Returns:

A pandas dataframe showing a list of workspaces for the organization.

Return type:

pandas.DataFrame

sempy_labs.admin.resolve_domain_id(domain_name: str) UUID

Obtains the domain Id for a given domain name.

Parameters:

domain_name (str) – The domain name

Returns:

The domain Id.

Return type:

UUID

sempy_labs.admin.revoke_external_data_share(external_data_share_id: UUID, item_id: UUID, workspace: str)

Revokes the specified external data share. Note: This action cannot be undone.

This is a wrapper function for the following API: `External Data Shares - Revoke External Data Share <https://learn.microsoft.com/rest/api/fabric/admin/external-data-shares/revoke-external-data-share`_.

Parameters:
  • external_data_share_id (UUID) – The external data share ID.

  • item_id (int, default=None) – The Item ID

  • workspace (str) – The Fabric workspace name.

sempy_labs.admin.unassign_all_domain_workspaces(domain_name: str)

Unassigns all workspaces from the specified domain.

This is a wrapper function for the following API: Domains - Unassign All Domain Workspaces.

Parameters:

domain_name (str) – The domain name.

sempy_labs.admin.unassign_domain_workspaces(domain_name: str, workspace_names: str | List[str])

Unassigns workspaces from the specified domain by workspace.

This is a wrapper function for the following API: Domains - Unassign Domain Workspaces By Ids.

Parameters:
  • domain_name (str) – The domain name.

  • workspace_names (str | List[str]) – The Fabric workspace(s).

sempy_labs.admin.unassign_workspaces_from_capacity(workspaces: str | List[str])

Unassigns workspace(s) from their capacity.

This is a wrapper function for the following API: Admin - Capacities UnassignWorkspacesFromCapacity.

Parameters:

workspaces (str | List[str]) – The Fabric workspace name(s).

sempy_labs.admin.update_domain(domain_name: str, description: str | None = None, contributors_scope: str | None = None)

Updates a domain’s properties.

This is a wrapper function for the following API: Domains - Update Domain.

Parameters:
  • domain_name (str) – The domain name.

  • description (str, default=None) – The domain description.

  • contributors_scope (str, default=None) – The domain contributor scope.