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.
- 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.
- sempy_labs.admin.assign_workspaces_to_capacity(source_capacity: str | UUID | None = None, target_capacity: str | UUID | None = None, workspace: str | List[str] | UUID | List[UUID] | 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 | uuid.UUID, default=None) – The name of the source capacity. If the Workspace is not specified, this is parameter mandatory.
target_capacity (str | uuid.UUID, default=None) – The name of the target capacity.
workspace (str | List[str] | uuid.UUID | List[uuid.UUID], default=None) – The name or id 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.
- 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.get_capacity_assignment_status(workspace: str | UUID | None = None) DataFrame
Gets the status of the assignment-to-capacity operation for the specified workspace.
This is a wrapper function for the following API: Capacities - Groups CapacityAssignmentStatus.
Service Principal Authentication is supported (see here for examples).
- Parameters:
workspace (str | uuid.UUID, default=None) – The Fabric workspace name or id. 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 the status of the assignment-to-capacity operation for the specified workspace.
- Return type:
- 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.
Service Principal Authentication is supported (see here for examples).
- 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:
- sempy_labs.admin.list_activity_events(start_time: str, end_time: str, activity_filter: str | None = None, user_id_filter: str | None = None, return_dataframe: bool = True) DataFrame | dict
Shows a list of audit activity events for a tenant.
This is a wrapper function for the following API: Admin - Get Activity Events.
Service Principal Authentication is supported (see here for examples).
- 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.
return_dataframe (bool, default=True) – If True the response is a pandas.DataFrame. If False returns the original Json. Default True
- Returns:
A pandas dataframe or json showing a list of audit activity events for a tenant.
- Return type:
- sempy_labs.admin.list_capacities(capacity: str | UUID | None = None) DataFrame
Shows the a list of capacities and their properties.
This is a wrapper function for the following API: Admin - Get Capacities As Admin.
Service Principal Authentication is supported (see here for examples).
- 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.
Service Principal Authentication is supported (see here for examples).
- 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:
- sempy_labs.admin.list_datasets(top: int | None = None, filter: str | None = None, skip: int | None = None) DataFrame
Shows a list of datasets for the organization.
This is a wrapper function for the following API: Admin - Datasets GetDatasetsAsAdmin.
Service Principal Authentication is supported (see here for examples).
- Parameters:
- Returns:
A pandas dataframe showing a list of datasets for the organization.
- Return type:
- 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.
Service Principal Authentication is supported (see here for examples).
- Parameters:
domain_name (str) – The domain name.
- Returns:
A pandas dataframe showing a list of workspaces within the domain.
- Return type:
- 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.
Service Principal Authentication is supported (see here for examples).
- 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:
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:
- sempy_labs.admin.list_git_connections() DataFrame
Shows a list of Git connections.
This is a wrapper function for the following API: Workspaces - List Git Connections.
Service Principal Authentication is supported (see here for examples).
- Returns:
A pandas dataframe showing a list of Git connections.
- Return type:
- sempy_labs.admin.list_item_access_details(item: str | UUID = None, type: str = None, workspace: str | UUID | None = None, **kwargs) 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.
Service Principal Authentication is supported (see here for examples).
- Parameters:
item (str) – Name or id of the Fabric item.
type (str, default=None) – Type of Fabric item.
workspace (str | uuid.UUID, default=None) – The Fabric workspace name or id. 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:
- sempy_labs.admin.list_items(capacity: str | UUID | None = None, workspace: str | UUID | None = None, state: str | None = None, type: str | None = None, item: str | UUID | None = None, **kwargs) DataFrame
Shows a list of active Fabric and Power BI items.
This is a wrapper function for the following API: Items - List Items.
Service Principal Authentication is supported (see here for examples).
- Parameters:
capacity (str | uuid.UUID, default=None) – The capacity name or id.
workspace (str | uuid.UUID, 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.
item (str | UUID, default=None) – Item id or name to filter the list.
- Returns:
A pandas dataframe showing a list of active Fabric and Power BI items.
- Return type:
- sempy_labs.admin.list_modified_workspaces(modified_since: str | None = None, exclude_inactive_workspaces: bool | None = False, exclude_personal_workspaces: bool | None = False) DataFrame
Gets a list of workspace IDs in the organization.
This is a wrapper function for the following API: Admin - WorkspaceInfo GetModifiedWorkspaces.
Service Principal Authentication is supported (see here for examples).
- Parameters:
modified_since (str, default=None) – Last modified date (must be in ISO compliant UTC format). Example: “2024-11-02T05:51:30” or “2024-11-02T05:51:30.0000000Z”.
exclude_inactive_workspaces (bool, default=False) – Whether to exclude inactive workspaces.
exclude_personal_workspaces (bool, default=False) – Whether to exclude personal workspaces.
- Returns:
A pandas dataframe showing a list of workspace IDs in the organization.
- Return type:
- sempy_labs.admin.list_reports(top: int | None = None, skip: int | None = None, filter: str | None = None) DataFrame
Shows a list of reports for the organization.
This is a wrapper function for the following API: Admin - Reports GetReportsAsAdmin.
Service Principal Authentication is supported (see here for examples).
- Parameters:
- Returns:
A pandas dataframe showing a list of reports for the organization.
- Return type:
- sempy_labs.admin.list_tenant_settings() DataFrame
Lists all tenant settings.
This is a wrapper function for the following API: Tenants - List Tenant Settings.
Service Principal Authentication is supported (see here for examples).
- Returns:
A pandas dataframe showing the tenant settings.
- Return type:
- 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.
Service Principal Authentication is supported (see here for examples).
- Parameters:
workspace (str | uuid.UUID, default=None) – The Fabric workspace name or id. 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:
- sempy_labs.admin.list_workspaces(capacity: str | UUID | None = None, workspace: str | UUID | None = None, workspace_state: str | None = None, workspace_type: str | None = None, **kwargs) DataFrame
Lists workspaces for the organization. This function is the admin version of list_workspaces.
This is a wrapper function for the following API: Workspaces - List Workspaces - REST API (Admin).
Service Principal Authentication is supported (see here for examples).
- Parameters:
capacity (str | uuid.UUID, default=None) – Returns only the workspaces in the specified Capacity.
workspace (str | uuid.UUID, default=None) – Returns the workspace with the specific name.
workspace_state (str, default=None) – Return only the workspace with the requested state. You can find the possible states in Workspace States.
workspace_type (str, default=None) – Return only the workspace of the specific type. You can find the possible types in Workspace Types.
- Returns:
A pandas dataframe showing a list of workspaces for the organization.
- Return type:
- 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
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.
- sempy_labs.admin.scan_workspaces(data_source_details: bool = False, dataset_schema: bool = False, dataset_expressions: bool = False, lineage: bool = False, artifact_users: bool = False, workspace: str | List[str] | UUID | List[UUID] | None = None) dict
Gets the scan result for the specified scan.
- This is a wrapper function for the following APIs:
Admin - WorkspaceInfo PostWorkspaceInfo. Admin - WorkspaceInfo GetScanStatus. Admin - WorkspaceInfo GetScanResult.
Service Principal Authentication is supported (see here for examples).
- Parameters:
data_source_details (bool, default=False) – Whether to return dataset expressions (DAX and Mashup queries). If you set this parameter to true, you must fully enable metadata scanning in order for data to be returned. For more information, see Enable tenant settings for metadata scanning.
dataset_schema (bool = False) – Whether to return dataset schema (tables, columns and measures). If you set this parameter to true, you must fully enable metadata scanning in order for data to be returned. For more information, see Enable tenant settings for metadata scanning.
dataset_expressions (bool, default=False) – Whether to return data source details.
lineage (bool, default=False) – Whether to return lineage info (upstream dataflows, tiles, data source IDs).
artifact_users (bool, default=False) – Whether to return user details for a Power BI item (such as a report or a dashboard).
workspace (str | List[str] | uuid.UUID | List[uuid.UUID], default=None) – The required workspace name(s) or id(s) to be scanned
- Returns:
A json object with the scan result.
- Return type:
- 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.
- sempy_labs.admin.unassign_workspaces_from_capacity(workspaces: str | List[str] | UUID | List[UUID])
Unassigns workspace(s) from their capacity.
This is a wrapper function for the following API: Admin - Capacities UnassignWorkspacesFromCapacity.
- 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.