sempy_labs.admin package
Module contents
- sempy_labs.admin.add_user_to_workspace(user: str | UUID, role: str = 'Member', principal_type: str = 'User', workspace: str | UUID | None = None)
Grants user permissions to the specified workspace.
This is a wrapper function for the following API: Admin - Groups AddUserAsAdmin.
- Parameters:
user (str | uuid.UUID) – The user identifier or email address. For service principals and groups you must use the user identifier.
role (str, default="Member") – The role of the user in the workspace. Options are: ‘Admin’, ‘Contributor’, ‘Member’, ‘None’, ‘Viewer’.
principal_type (str, default="User") – The principal type of the user. Options are: ‘App’, ‘Group’, ‘None’, ‘User’.
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.
- sempy_labs.admin.assign_domain_workspaces(domain: str | UUID, 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: str | UUID, capacity_names: str | List[str], **kwargs)
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: str | UUID | None = None, **kwargs)
Creates a new domain.
This is a wrapper function for the following API: Domains - Create Domain.
- sempy_labs.admin.delete_capacity_tenant_setting_override(capacity: str | UUID, tenant_setting: str)
Remove given tenant setting override for given capacity Id.
This is a wrapper function for the following API: Tenants - Delete Capacity Tenant Setting Override.
Service Principal Authentication is supported (see here for examples).
- sempy_labs.admin.delete_domain(domain: str | UUID | None, **kwargs)
Deletes a domain.
This is a wrapper function for the following API: Domains - Delete Domain.
- sempy_labs.admin.delete_user_from_workspace(user: str | UUID, workspace: str | UUID | None = None, is_group: bool | None = None, profile_id: str | None = None)
Removes user permissions from the specified workspace.
This is a wrapper function for the following API: Admin - Groups DeleteUserAsAdmin.
- Parameters:
user (str | uuid.UUID) – The user identifier or email address. For service principals and groups you must use the user identifier.
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.
is_group (bool, default=None) – Whether a given user is a group or not. This parameter is required when user to delete is group.
profile_id (str, default=None) – The service principal profile ID to delete.
- 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 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.get_capacity_state(capacity: str | UUID | None = None)
Gets the state of a capacity.
Service Principal Authentication is supported (see here for examples).
- 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_app_users(app: str | UUID) DataFrame
Shows a list of users that have access to the specified app.
This is a wrapper function for the following API: Admin - Apps GetAppUsersAsAdmin.
Service Principal Authentication is supported (see here for examples).
- Parameters:
- Returns:
A pandas dataframe showing a list of users that have access to the specified app.
- Return type:
- sempy_labs.admin.list_apps(top: int | None = 1000, skip: int | None = None) DataFrame
Shows a list of apps in the organization.
This is a wrapper function for the following API: Admin - Apps GetAppsAsAdmin.
Service Principal Authentication is supported (see here for examples).
- Parameters:
- Returns:
A pandas dataframe showing a list of apps in the organization.
- 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.
NOTE: This function is to be deprecated. Please use the list_capacity_tenant_settings_overrides function instead.
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_capacity_tenant_settings_overrides(capacity: str | UUID | None = None, 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:
- Returns:
A pandas dataframe showing a list of tenant setting overrides that override at the capacities.
- Return type:
- sempy_labs.admin.list_capacity_users(capacity: str | UUID) DataFrame
Shows a list of users that have access to the specified workspace.
This is a wrapper function for the following API: Admin - Capacities GetCapacityUsersAsAdmin.
Service Principal Authentication is supported (see here for examples).
- sempy_labs.admin.list_dataset_users(dataset: str | UUID) DataFrame
Shows a list of users that have access to the specified dataset.
This is a wrapper function for the following API: Admin - Datasets GetDatasetUsersAsAdmin.
Service Principal Authentication is supported (see here for examples).
- Parameters:
- Returns:
A pandas dataframe showing a list of users that have access to the specified dataset.
- 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_tenant_settings_overrides() DataFrame
Shows a list of domain delegation setting overrides.
This is a wrapper function for the following API: Tenants - List Domains Tenant Settings Overrides.
Service Principal Authentication is supported (see here for examples).
- Returns:
A pandas dataframe showing a list of domain delegation setting overrides.
- Return type:
- sempy_labs.admin.list_domain_workspaces(domain: str | None = None, **kwargs) 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:
- 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_report_subscriptions(report: str | UUID) DataFrame
Shows a list of report subscriptions along with subscriber details. This is a preview API call.
This is a wrapper function for the following API: Admin - Reports GetReportSubscriptionsAsAdmin.
Service Principal Authentication is supported (see here for examples).
- Parameters:
- Returns:
A pandas dataframe showing a list of report subscriptions along with subscriber details. This is a preview API call.
- Return type:
- sempy_labs.admin.list_report_users(report: str | UUID) DataFrame
Shows a list of users that have access to the specified report.
This is a wrapper function for the following API: Admin - Reports GetDatasetUsersAsAdmin.
Service Principal Authentication is supported (see here for examples).
- Parameters:
- Returns:
A pandas dataframe showing a list of users that have access to the specified report.
- 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_unused_artifacts(workspace: str | UUID | None = None) DataFrame
Returns a list of datasets, reports, and dashboards that have not been used within 30 days for the specified workspace.
This is a wrapper function for the following API: Admin - Groups GetUnusedArtifactsAsAdmin.
Service Principal Authentication is supported (see here for examples).
- Returns:
A pandas dataframe showing a list of datasets, reports, and dashboards that have not been used within 30 days for the specified workspace.
- Return type:
- sempy_labs.admin.list_user_subscriptions(user: str | UUID) DataFrame
Shows a list of subscriptions for the specified user. This is a preview API call.
This is a wrapper function for the following API: Admin - Users GetUserSubscriptionsAsAdmin.
Service Principal Authentication is supported (see here for examples).
Returns a list of Power BI reports that are shared with the whole organization through links or a list of Power BI items (such as reports or dashboards) that are published to the web.
This is a wrapper function for the following APIs: Admin - WidelySharedArtifacts LinksSharedToWholeOrganization. Admin - WidelySharedArtifacts PublishedToWeb.
Service Principal Authentication is supported (see here for examples).
- Parameters:
api_name (str, default = "LinksSharedToWholeOrganization") – The name of the API to call. Either “LinksSharedToWholeOrganization” or “PublishedToWeb”.
- Returns:
A pandas dataframe showing a list of Power BI reports that are shared with the whole organization through links or a list of Power BI items (such as reports or dashboards) that are published to the web.
- 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 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_workspace_users(workspace: str | UUID | None = None) DataFrame
Shows a list of users that have access to the specified workspace.
This is a wrapper function for the following API: Admin - Groups GetGroupUsersAsAdmin.
Service Principal Authentication is supported (see here for examples).
- Parameters:
workspace (str | uuid.UUID, default=None) – The 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 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.list_workspaces_tenant_settings_overrides() DataFrame
Shows a list of workspace delegation setting overrides. In order to run this function, you must enable the workspace’s delegated OneLake settings. To do this, navigate to the workspace, Workspace Settings -> Delegated Settings -> OneLake settings -> Set to ‘On’.
This is a wrapper function for the following API: Tenants - List Workspaces Tenant Settings Overrides.
Service Principal Authentication is supported (see here for examples).
- Returns:
A pandas dataframe showing a list of workspace delegation setting overrides.
- Return type:
- sempy_labs.admin.patch_capacity(capacity: str | UUID, tenant_key_id: UUID)
Changes specific capacity information. Currently, this API call only supports changing the capacity’s encryption key.
This is a wrapper function for the following API: Admin - Patch Capacity As Admin.
- sempy_labs.admin.resolve_domain_id(domain: str | UUID | None = None, **kwargs) UUID
Obtains the domain Id for a given domain name.
- sempy_labs.admin.restore_deleted_workspace(workspace_id: UUID, name: str, email_address: str)
Restores a deleted workspace.
This is a wrapper function for the following API: Admin - Groups RestoreDeletedGroupAsAdmin.
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 | List[UUID], default=None) – The required workspace name(s) or id(s) to be scanned. It supports a limit of 100 workspaces and only IDs in GUID format.
- Returns:
A json object with the scan result.
- Return type:
- sempy_labs.admin.unassign_all_domain_workspaces(domain: str | UUID)
Unassigns all workspaces from the specified domain.
This is a wrapper function for the following API: Domains - Unassign All Domain Workspaces.
- sempy_labs.admin.unassign_domain_workspaces(domain: str | UUID, 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_capacity_tenant_setting_override(capacity: str | UUID, tenant_setting: str, enabled: bool, delegate_to_workspace: bool | None = None, enabled_security_groups: List[dict] | None = None, excluded_security_groups: List[dict] | None = None)
Update given tenant setting override for given capacity.
This is a wrapper function for the following API: Tenants - Update Capacity Tenant Setting Override.
Service Principal Authentication is supported (see here for examples).
- Parameters:
tenant_setting (str) – The tenant setting name. Example: “TenantSettingForCapacityDelegatedSwitch”
enabled (bool) – The status of the tenant setting. False - Disabled, True - Enabled.
delegate_to_workspace (bool, default=None) – Indicates whether the tenant setting can be delegated to a workspace admin. False - Workspace admin cannot override the tenant setting. True - Workspace admin can override the tenant setting.
enabled_security_groups (List[dict], default=None) –
A list of enabled security groups. Example: [
{ “graphId”: “f51b705f-a409-4d40-9197-c5d5f349e2f0”, “name”: “TestComputeCdsa” }
]
excluded_security_groups (List[dict], default=None) –
A list of excluded security groups. Example: [
{ “graphId”: “f51b705f-a409-4d40-9197-c5d5f349e2f0”, “name”: “TestComputeCdsa” }
]
- sempy_labs.admin.update_domain(domain: str | UUID | None = None, description: str | None = None, contributors_scope: str | None = None, **kwargs)
Updates a domain’s properties.
This is a wrapper function for the following API: Domains - Update Domain.
- Parameters:
description (str, default=None) – The domain description.
contributors_scope (str, default=None) – The domain contributor scope.
- sempy_labs.admin.update_tenant_setting(tenant_setting: str, enabled: bool, delegate_to_capacity: bool | None = None, delegate_to_domain: bool | None = None, delegate_to_workspace: bool | None = None, enabled_security_groups: List[dict] | None = None, excluded_security_groups: List[dict] | None = None, properties: List[dict] | None = None)
Update a given tenant setting.
This is a wrapper function for the following API: Tenants - Update Tenant Setting.
Service Principal Authentication is supported (see here for examples).
- Parameters:
tenant_setting (str) – The tenant setting name. Example: “TenantSettingForCapacityDelegatedSwitch”
enabled (bool) – The status of the tenant setting. False - Disabled, True - Enabled.
delegate_to_capacity (bool, default=None) – Indicates whether the tenant setting can be delegated to a capacity admin. False - Capacity admin cannot override the tenant setting. True - Capacity admin can override the tenant setting.
delegate_to_domain (bool, default=None) – Indicates whether the tenant setting can be delegated to a domain admin. False - Domain admin cannot override the tenant setting. True - Domain admin can override the tenant setting.
delegate_to_workspace (bool, default=None) – Indicates whether the tenant setting can be delegated to a workspace admin. False - Workspace admin cannot override the tenant setting. True - Workspace admin can override the tenant setting.
enabled_security_groups (List[dict], default=None) –
A list of enabled security groups. Example: [
{ “graphId”: “f51b705f-a409-4d40-9197-c5d5f349e2f0”, “name”: “TestComputeCdsa” }
]
excluded_security_groups (List[dict], default=None) –
A list of excluded security groups. Example: [
{ “graphId”: “f51b705f-a409-4d40-9197-c5d5f349e2f0”, “name”: “TestComputeCdsa” }
]
properties (List[dict], default=None) –
Tenant setting properties. Example: [
{ “name”: “CreateP2w”, “value”: “true”, “type”: “Boolean” }
]