semantic-link-labs 0.12.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- semantic_link_labs-0.12.8.dist-info/METADATA +354 -0
- semantic_link_labs-0.12.8.dist-info/RECORD +243 -0
- semantic_link_labs-0.12.8.dist-info/WHEEL +5 -0
- semantic_link_labs-0.12.8.dist-info/licenses/LICENSE +21 -0
- semantic_link_labs-0.12.8.dist-info/top_level.txt +1 -0
- sempy_labs/__init__.py +606 -0
- sempy_labs/_a_lib_info.py +2 -0
- sempy_labs/_ai.py +437 -0
- sempy_labs/_authentication.py +264 -0
- sempy_labs/_bpa_translation/_model/_translations_am-ET.po +869 -0
- sempy_labs/_bpa_translation/_model/_translations_ar-AE.po +908 -0
- sempy_labs/_bpa_translation/_model/_translations_bg-BG.po +968 -0
- sempy_labs/_bpa_translation/_model/_translations_ca-ES.po +963 -0
- sempy_labs/_bpa_translation/_model/_translations_cs-CZ.po +943 -0
- sempy_labs/_bpa_translation/_model/_translations_da-DK.po +945 -0
- sempy_labs/_bpa_translation/_model/_translations_de-DE.po +988 -0
- sempy_labs/_bpa_translation/_model/_translations_el-GR.po +993 -0
- sempy_labs/_bpa_translation/_model/_translations_es-ES.po +971 -0
- sempy_labs/_bpa_translation/_model/_translations_fa-IR.po +933 -0
- sempy_labs/_bpa_translation/_model/_translations_fi-FI.po +942 -0
- sempy_labs/_bpa_translation/_model/_translations_fr-FR.po +994 -0
- sempy_labs/_bpa_translation/_model/_translations_ga-IE.po +967 -0
- sempy_labs/_bpa_translation/_model/_translations_he-IL.po +902 -0
- sempy_labs/_bpa_translation/_model/_translations_hi-IN.po +944 -0
- sempy_labs/_bpa_translation/_model/_translations_hu-HU.po +963 -0
- sempy_labs/_bpa_translation/_model/_translations_id-ID.po +946 -0
- sempy_labs/_bpa_translation/_model/_translations_is-IS.po +939 -0
- sempy_labs/_bpa_translation/_model/_translations_it-IT.po +986 -0
- sempy_labs/_bpa_translation/_model/_translations_ja-JP.po +846 -0
- sempy_labs/_bpa_translation/_model/_translations_ko-KR.po +839 -0
- sempy_labs/_bpa_translation/_model/_translations_mt-MT.po +967 -0
- sempy_labs/_bpa_translation/_model/_translations_nl-NL.po +978 -0
- sempy_labs/_bpa_translation/_model/_translations_pl-PL.po +962 -0
- sempy_labs/_bpa_translation/_model/_translations_pt-BR.po +962 -0
- sempy_labs/_bpa_translation/_model/_translations_pt-PT.po +957 -0
- sempy_labs/_bpa_translation/_model/_translations_ro-RO.po +968 -0
- sempy_labs/_bpa_translation/_model/_translations_ru-RU.po +964 -0
- sempy_labs/_bpa_translation/_model/_translations_sk-SK.po +952 -0
- sempy_labs/_bpa_translation/_model/_translations_sl-SL.po +950 -0
- sempy_labs/_bpa_translation/_model/_translations_sv-SE.po +942 -0
- sempy_labs/_bpa_translation/_model/_translations_ta-IN.po +976 -0
- sempy_labs/_bpa_translation/_model/_translations_te-IN.po +947 -0
- sempy_labs/_bpa_translation/_model/_translations_th-TH.po +924 -0
- sempy_labs/_bpa_translation/_model/_translations_tr-TR.po +953 -0
- sempy_labs/_bpa_translation/_model/_translations_uk-UA.po +961 -0
- sempy_labs/_bpa_translation/_model/_translations_zh-CN.po +804 -0
- sempy_labs/_bpa_translation/_model/_translations_zu-ZA.po +969 -0
- sempy_labs/_capacities.py +1198 -0
- sempy_labs/_capacity_migration.py +660 -0
- sempy_labs/_clear_cache.py +351 -0
- sempy_labs/_connections.py +610 -0
- sempy_labs/_dashboards.py +69 -0
- sempy_labs/_data_access_security.py +98 -0
- sempy_labs/_data_pipelines.py +162 -0
- sempy_labs/_dataflows.py +668 -0
- sempy_labs/_dax.py +501 -0
- sempy_labs/_daxformatter.py +80 -0
- sempy_labs/_delta_analyzer.py +467 -0
- sempy_labs/_delta_analyzer_history.py +301 -0
- sempy_labs/_dictionary_diffs.py +221 -0
- sempy_labs/_documentation.py +147 -0
- sempy_labs/_domains.py +51 -0
- sempy_labs/_eventhouses.py +182 -0
- sempy_labs/_external_data_shares.py +230 -0
- sempy_labs/_gateways.py +521 -0
- sempy_labs/_generate_semantic_model.py +521 -0
- sempy_labs/_get_connection_string.py +84 -0
- sempy_labs/_git.py +543 -0
- sempy_labs/_graphQL.py +90 -0
- sempy_labs/_helper_functions.py +2833 -0
- sempy_labs/_icons.py +149 -0
- sempy_labs/_job_scheduler.py +609 -0
- sempy_labs/_kql_databases.py +149 -0
- sempy_labs/_kql_querysets.py +124 -0
- sempy_labs/_kusto.py +137 -0
- sempy_labs/_labels.py +124 -0
- sempy_labs/_list_functions.py +1720 -0
- sempy_labs/_managed_private_endpoints.py +253 -0
- sempy_labs/_mirrored_databases.py +416 -0
- sempy_labs/_mirrored_warehouses.py +60 -0
- sempy_labs/_ml_experiments.py +113 -0
- sempy_labs/_model_auto_build.py +140 -0
- sempy_labs/_model_bpa.py +557 -0
- sempy_labs/_model_bpa_bulk.py +378 -0
- sempy_labs/_model_bpa_rules.py +859 -0
- sempy_labs/_model_dependencies.py +343 -0
- sempy_labs/_mounted_data_factories.py +123 -0
- sempy_labs/_notebooks.py +441 -0
- sempy_labs/_one_lake_integration.py +151 -0
- sempy_labs/_onelake.py +131 -0
- sempy_labs/_query_scale_out.py +433 -0
- sempy_labs/_refresh_semantic_model.py +435 -0
- sempy_labs/_semantic_models.py +468 -0
- sempy_labs/_spark.py +455 -0
- sempy_labs/_sql.py +241 -0
- sempy_labs/_sql_audit_settings.py +207 -0
- sempy_labs/_sql_endpoints.py +214 -0
- sempy_labs/_tags.py +201 -0
- sempy_labs/_translations.py +43 -0
- sempy_labs/_user_delegation_key.py +44 -0
- sempy_labs/_utils.py +79 -0
- sempy_labs/_vertipaq.py +1021 -0
- sempy_labs/_vpax.py +388 -0
- sempy_labs/_warehouses.py +234 -0
- sempy_labs/_workloads.py +140 -0
- sempy_labs/_workspace_identity.py +72 -0
- sempy_labs/_workspaces.py +595 -0
- sempy_labs/admin/__init__.py +170 -0
- sempy_labs/admin/_activities.py +167 -0
- sempy_labs/admin/_apps.py +145 -0
- sempy_labs/admin/_artifacts.py +65 -0
- sempy_labs/admin/_basic_functions.py +463 -0
- sempy_labs/admin/_capacities.py +508 -0
- sempy_labs/admin/_dataflows.py +45 -0
- sempy_labs/admin/_datasets.py +186 -0
- sempy_labs/admin/_domains.py +522 -0
- sempy_labs/admin/_external_data_share.py +100 -0
- sempy_labs/admin/_git.py +72 -0
- sempy_labs/admin/_items.py +265 -0
- sempy_labs/admin/_labels.py +211 -0
- sempy_labs/admin/_reports.py +241 -0
- sempy_labs/admin/_scanner.py +118 -0
- sempy_labs/admin/_shared.py +82 -0
- sempy_labs/admin/_sharing_links.py +110 -0
- sempy_labs/admin/_tags.py +131 -0
- sempy_labs/admin/_tenant.py +503 -0
- sempy_labs/admin/_tenant_keys.py +89 -0
- sempy_labs/admin/_users.py +140 -0
- sempy_labs/admin/_workspaces.py +236 -0
- sempy_labs/deployment_pipeline/__init__.py +23 -0
- sempy_labs/deployment_pipeline/_items.py +580 -0
- sempy_labs/directlake/__init__.py +57 -0
- sempy_labs/directlake/_autosync.py +58 -0
- sempy_labs/directlake/_directlake_schema_compare.py +120 -0
- sempy_labs/directlake/_directlake_schema_sync.py +161 -0
- sempy_labs/directlake/_dl_helper.py +274 -0
- sempy_labs/directlake/_generate_shared_expression.py +94 -0
- sempy_labs/directlake/_get_directlake_lakehouse.py +62 -0
- sempy_labs/directlake/_get_shared_expression.py +34 -0
- sempy_labs/directlake/_guardrails.py +96 -0
- sempy_labs/directlake/_list_directlake_model_calc_tables.py +70 -0
- sempy_labs/directlake/_show_unsupported_directlake_objects.py +90 -0
- sempy_labs/directlake/_update_directlake_model_lakehouse_connection.py +239 -0
- sempy_labs/directlake/_update_directlake_partition_entity.py +259 -0
- sempy_labs/directlake/_warm_cache.py +236 -0
- sempy_labs/dotnet_lib/dotnet.runtime.config.json +10 -0
- sempy_labs/environment/__init__.py +23 -0
- sempy_labs/environment/_items.py +212 -0
- sempy_labs/environment/_pubstage.py +223 -0
- sempy_labs/eventstream/__init__.py +37 -0
- sempy_labs/eventstream/_items.py +263 -0
- sempy_labs/eventstream/_topology.py +652 -0
- sempy_labs/graph/__init__.py +59 -0
- sempy_labs/graph/_groups.py +651 -0
- sempy_labs/graph/_sensitivity_labels.py +120 -0
- sempy_labs/graph/_teams.py +125 -0
- sempy_labs/graph/_user_licenses.py +96 -0
- sempy_labs/graph/_users.py +516 -0
- sempy_labs/graph_model/__init__.py +15 -0
- sempy_labs/graph_model/_background_jobs.py +63 -0
- sempy_labs/graph_model/_items.py +149 -0
- sempy_labs/lakehouse/__init__.py +67 -0
- sempy_labs/lakehouse/_blobs.py +247 -0
- sempy_labs/lakehouse/_get_lakehouse_columns.py +102 -0
- sempy_labs/lakehouse/_get_lakehouse_tables.py +274 -0
- sempy_labs/lakehouse/_helper.py +250 -0
- sempy_labs/lakehouse/_lakehouse.py +351 -0
- sempy_labs/lakehouse/_livy_sessions.py +143 -0
- sempy_labs/lakehouse/_materialized_lake_views.py +157 -0
- sempy_labs/lakehouse/_partitioning.py +165 -0
- sempy_labs/lakehouse/_schemas.py +217 -0
- sempy_labs/lakehouse/_shortcuts.py +440 -0
- sempy_labs/migration/__init__.py +35 -0
- sempy_labs/migration/_create_pqt_file.py +238 -0
- sempy_labs/migration/_direct_lake_to_import.py +105 -0
- sempy_labs/migration/_migrate_calctables_to_lakehouse.py +398 -0
- sempy_labs/migration/_migrate_calctables_to_semantic_model.py +148 -0
- sempy_labs/migration/_migrate_model_objects_to_semantic_model.py +533 -0
- sempy_labs/migration/_migrate_tables_columns_to_semantic_model.py +172 -0
- sempy_labs/migration/_migration_validation.py +71 -0
- sempy_labs/migration/_refresh_calc_tables.py +131 -0
- sempy_labs/mirrored_azure_databricks_catalog/__init__.py +15 -0
- sempy_labs/mirrored_azure_databricks_catalog/_discover.py +213 -0
- sempy_labs/mirrored_azure_databricks_catalog/_refresh_catalog_metadata.py +45 -0
- sempy_labs/ml_model/__init__.py +23 -0
- sempy_labs/ml_model/_functions.py +427 -0
- sempy_labs/report/_BPAReportTemplate.json +232 -0
- sempy_labs/report/__init__.py +55 -0
- sempy_labs/report/_bpareporttemplate/.pbi/localSettings.json +9 -0
- sempy_labs/report/_bpareporttemplate/.platform +11 -0
- sempy_labs/report/_bpareporttemplate/StaticResources/SharedResources/BaseThemes/CY24SU06.json +710 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/page.json +11 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/visuals/1b08bce3bebabb0a27a8/visual.json +191 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/visuals/2f22ddb70c301693c165/visual.json +438 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/visuals/3b1182230aa6c600b43a/visual.json +127 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/visuals/58577ba6380c69891500/visual.json +576 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/visuals/a2a8fa5028b3b776c96c/visual.json +207 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/visuals/adfd47ef30652707b987/visual.json +506 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/visuals/b6a80ee459e716e170b1/visual.json +127 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/visuals/ce3130a721c020cc3d81/visual.json +513 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/92735ae19b31712208ad/page.json +8 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/92735ae19b31712208ad/visuals/66e60dfb526437cd78d1/visual.json +112 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/page.json +11 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visuals/07deb8bce824e1be37d7/visual.json +513 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visuals/0b1c68838818b32ad03b/visual.json +352 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visuals/0c171de9d2683d10b930/visual.json +37 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visuals/0efa01be0510e40a645e/visual.json +542 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visuals/6bf2f0eb830ab53cc668/visual.json +221 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visuals/88d8141cb8500b60030c/visual.json +127 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visuals/a753273590beed656a03/visual.json +576 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visuals/b8fdc82cddd61ac447bc/visual.json +127 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/d37dce724a0ccc30044b/page.json +9 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/d37dce724a0ccc30044b/visuals/ce8532a7e25020271077/visual.json +38 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/pages.json +10 -0
- sempy_labs/report/_bpareporttemplate/definition/report.json +176 -0
- sempy_labs/report/_bpareporttemplate/definition/version.json +4 -0
- sempy_labs/report/_bpareporttemplate/definition.pbir +14 -0
- sempy_labs/report/_download_report.py +76 -0
- sempy_labs/report/_export_report.py +257 -0
- sempy_labs/report/_generate_report.py +427 -0
- sempy_labs/report/_paginated.py +76 -0
- sempy_labs/report/_report_bpa.py +354 -0
- sempy_labs/report/_report_bpa_rules.py +115 -0
- sempy_labs/report/_report_functions.py +581 -0
- sempy_labs/report/_report_helper.py +227 -0
- sempy_labs/report/_report_list_functions.py +110 -0
- sempy_labs/report/_report_rebind.py +149 -0
- sempy_labs/report/_reportwrapper.py +3100 -0
- sempy_labs/report/_save_report.py +147 -0
- sempy_labs/snowflake_database/__init__.py +10 -0
- sempy_labs/snowflake_database/_items.py +105 -0
- sempy_labs/sql_database/__init__.py +21 -0
- sempy_labs/sql_database/_items.py +201 -0
- sempy_labs/sql_database/_mirroring.py +79 -0
- sempy_labs/theme/__init__.py +12 -0
- sempy_labs/theme/_org_themes.py +129 -0
- sempy_labs/tom/__init__.py +3 -0
- sempy_labs/tom/_model.py +5977 -0
- sempy_labs/variable_library/__init__.py +19 -0
- sempy_labs/variable_library/_functions.py +403 -0
- sempy_labs/warehouse/__init__.py +28 -0
- sempy_labs/warehouse/_items.py +234 -0
- sempy_labs/warehouse/_restore_points.py +309 -0
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
from sempy_labs._helper_functions import (
|
|
2
|
+
_update_dataframe_datatypes,
|
|
3
|
+
_base_api,
|
|
4
|
+
_create_dataframe,
|
|
5
|
+
)
|
|
6
|
+
from sempy._utils._log import log
|
|
7
|
+
import pandas as pd
|
|
8
|
+
from uuid import UUID
|
|
9
|
+
from sempy_labs.admin._capacities import _resolve_capacity_name_and_id
|
|
10
|
+
import sempy_labs._icons as icons
|
|
11
|
+
from typing import Optional, List
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@log
|
|
15
|
+
def list_tenant_settings() -> pd.DataFrame:
|
|
16
|
+
"""
|
|
17
|
+
Lists all tenant settings.
|
|
18
|
+
|
|
19
|
+
This is a wrapper function for the following API: `Tenants - List Tenant Settings <https://learn.microsoft.com/rest/api/fabric/admin/tenants/list-tenant-settings>`_.
|
|
20
|
+
|
|
21
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
22
|
+
|
|
23
|
+
Returns
|
|
24
|
+
-------
|
|
25
|
+
pandas.DataFrame
|
|
26
|
+
A pandas dataframe showing the tenant settings.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
columns = {
|
|
30
|
+
"Setting Name": "string",
|
|
31
|
+
"Title": "string",
|
|
32
|
+
"Enabled": "bool",
|
|
33
|
+
"Can Specify Security Groups": "bool",
|
|
34
|
+
"Tenant Setting Group": "string",
|
|
35
|
+
"Enabled Security Groups": "list",
|
|
36
|
+
}
|
|
37
|
+
df = _create_dataframe(columns=columns)
|
|
38
|
+
|
|
39
|
+
response = _base_api(request="/v1/admin/tenantsettings", client="fabric_sp")
|
|
40
|
+
|
|
41
|
+
rows = []
|
|
42
|
+
for i in response.json().get("value", []):
|
|
43
|
+
rows.append(
|
|
44
|
+
{
|
|
45
|
+
"Setting Name": i.get("settingName"),
|
|
46
|
+
"Title": i.get("title"),
|
|
47
|
+
"Enabled": i.get("enabled"),
|
|
48
|
+
"Can Specify Security Groups": i.get("canSpecifySecurityGroups"),
|
|
49
|
+
"Tenant Setting Group": i.get("tenantSettingGroup"),
|
|
50
|
+
"Enabled Security Groups": [i.get("enabledSecurityGroups", [])],
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
if rows:
|
|
55
|
+
df = pd.DataFrame(rows, columns=list(columns.keys()))
|
|
56
|
+
_update_dataframe_datatypes(dataframe=df, column_map=columns)
|
|
57
|
+
|
|
58
|
+
return df
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@log
|
|
62
|
+
def list_capacity_tenant_settings_overrides(
|
|
63
|
+
capacity: Optional[str | UUID] = None,
|
|
64
|
+
return_dataframe: bool = True,
|
|
65
|
+
) -> pd.DataFrame | dict:
|
|
66
|
+
"""
|
|
67
|
+
Returns list of tenant setting overrides that override at the capacities.
|
|
68
|
+
|
|
69
|
+
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>`_.
|
|
70
|
+
|
|
71
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
72
|
+
|
|
73
|
+
Parameters
|
|
74
|
+
----------
|
|
75
|
+
capacity : str | uuid.UUID, default=None
|
|
76
|
+
The capacity name or ID.
|
|
77
|
+
Defaults to None which resolves to showing all capacities.
|
|
78
|
+
return_dataframe : bool, default=True
|
|
79
|
+
If True, returns a dataframe. If False, returns a dictionary.
|
|
80
|
+
|
|
81
|
+
Returns
|
|
82
|
+
-------
|
|
83
|
+
pandas.DataFrame | dict
|
|
84
|
+
A pandas dataframe showing a list of tenant setting overrides that override at the capacities.
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
columns = {
|
|
88
|
+
"Capacity Id": "string",
|
|
89
|
+
"Setting Name": "string",
|
|
90
|
+
"Setting Title": "string",
|
|
91
|
+
"Setting Enabled": "bool",
|
|
92
|
+
"Can Specify Security Groups": "bool",
|
|
93
|
+
"Enabled Security Groups": "list",
|
|
94
|
+
"Tenant Setting Group": "string",
|
|
95
|
+
"Tenant Setting Properties": "list",
|
|
96
|
+
"Delegate to Workspace": "bool",
|
|
97
|
+
"Delegated From": "string",
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if capacity is None:
|
|
101
|
+
url = "/v1/admin/capacities/delegatedTenantSettingOverrides"
|
|
102
|
+
else:
|
|
103
|
+
(_, capacity_id) = _resolve_capacity_name_and_id(capacity=capacity)
|
|
104
|
+
url = f"/v1/admin/capacities/{capacity_id}/delegatedTenantSettingOverrides"
|
|
105
|
+
responses = _base_api(
|
|
106
|
+
request=url,
|
|
107
|
+
client="fabric_sp",
|
|
108
|
+
uses_pagination=True,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
def create_new_data(setting, capacity_id=None):
|
|
112
|
+
return {
|
|
113
|
+
"Capacity Id": capacity_id or setting.get("id"),
|
|
114
|
+
"Setting Name": setting.get("settingName"),
|
|
115
|
+
"Setting Title": setting.get("title"),
|
|
116
|
+
"Setting Enabled": setting.get("enabled"),
|
|
117
|
+
"Can Specify Security Groups": setting.get("canSpecifySecurityGroups"),
|
|
118
|
+
"Enabled Security Groups": setting.get("enabledSecurityGroups", []),
|
|
119
|
+
"Tenant Setting Group": setting.get("tenantSettingGroup"),
|
|
120
|
+
"Tenant Setting Properties": setting.get("properties", []),
|
|
121
|
+
"Delegate to Workspace": setting.get("delegateToWorkspace"),
|
|
122
|
+
"Delegated From": setting.get("delegatedFrom"),
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
def process_responses(responses, capacity_id=None, return_dataframe=False):
|
|
126
|
+
data = []
|
|
127
|
+
df = _create_dataframe(columns=columns)
|
|
128
|
+
|
|
129
|
+
for r in responses:
|
|
130
|
+
if capacity_id is None:
|
|
131
|
+
# If capacity_id is None, we access 'Overrides' -> 'tenantSettings'
|
|
132
|
+
for override in r.get("overrides", []):
|
|
133
|
+
capacity_id = override.get("id")
|
|
134
|
+
tenant_settings = override.get("tenantSettings", [])
|
|
135
|
+
for setting in tenant_settings:
|
|
136
|
+
data.append(create_new_data(setting, capacity_id))
|
|
137
|
+
else:
|
|
138
|
+
# If capacity_id is provided, we access 'value' directly for tenantSettings
|
|
139
|
+
for setting in r.get("value", []):
|
|
140
|
+
data.append(
|
|
141
|
+
create_new_data(setting, capacity_id)
|
|
142
|
+
) # Use provided capacity_id
|
|
143
|
+
|
|
144
|
+
if return_dataframe:
|
|
145
|
+
if data:
|
|
146
|
+
df = pd.DataFrame(data)
|
|
147
|
+
_update_dataframe_datatypes(dataframe=df, column_map=columns)
|
|
148
|
+
return df
|
|
149
|
+
else:
|
|
150
|
+
key = "overrides" if capacity_id is None else "value"
|
|
151
|
+
continuation_uri = r.get("continuationUri", "")
|
|
152
|
+
continuation_token = r.get("continuationToken", "")
|
|
153
|
+
|
|
154
|
+
return {
|
|
155
|
+
key: data,
|
|
156
|
+
"continuationUri": continuation_uri,
|
|
157
|
+
"continuationToken": continuation_token,
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
# Main logic
|
|
161
|
+
if capacity is None:
|
|
162
|
+
return (
|
|
163
|
+
process_responses(responses, return_dataframe=True)
|
|
164
|
+
if return_dataframe
|
|
165
|
+
else process_responses(responses)
|
|
166
|
+
)
|
|
167
|
+
else:
|
|
168
|
+
return (
|
|
169
|
+
process_responses(responses, capacity_id=capacity_id, return_dataframe=True)
|
|
170
|
+
if return_dataframe
|
|
171
|
+
else process_responses(responses, capacity_id=capacity_id)
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
@log
|
|
176
|
+
def list_capacities_delegated_tenant_settings(
|
|
177
|
+
return_dataframe: bool = True,
|
|
178
|
+
) -> pd.DataFrame | dict:
|
|
179
|
+
"""
|
|
180
|
+
Returns list of tenant setting overrides that override at the capacities.
|
|
181
|
+
|
|
182
|
+
NOTE: This function is to be deprecated. Please use the `list_capacity_tenant_settings_overrides` function instead.
|
|
183
|
+
|
|
184
|
+
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>`_.
|
|
185
|
+
|
|
186
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
187
|
+
|
|
188
|
+
Parameters
|
|
189
|
+
----------
|
|
190
|
+
return_dataframe : bool, default=True
|
|
191
|
+
If True, returns a dataframe. If False, returns a dictionary.
|
|
192
|
+
|
|
193
|
+
Returns
|
|
194
|
+
-------
|
|
195
|
+
pandas.DataFrame | dict
|
|
196
|
+
A pandas dataframe showing a list of tenant setting overrides that override at the capacities.
|
|
197
|
+
"""
|
|
198
|
+
|
|
199
|
+
list_capacity_tenant_settings_overrides(return_dataframe=return_dataframe)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
@log
|
|
203
|
+
def delete_capacity_tenant_setting_override(capacity: str | UUID, tenant_setting: str):
|
|
204
|
+
"""
|
|
205
|
+
Remove given tenant setting override for given capacity Id.
|
|
206
|
+
|
|
207
|
+
This is a wrapper function for the following API: `Tenants - Delete Capacity Tenant Setting Override <https://learn.microsoft.com/rest/api/fabric/admin/tenants/delete-capacity-tenant-setting-override>`_.
|
|
208
|
+
|
|
209
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
210
|
+
|
|
211
|
+
Parameters
|
|
212
|
+
----------
|
|
213
|
+
capacity : str | uuid.UUID
|
|
214
|
+
The capacity name or ID.
|
|
215
|
+
tenant_setting : str
|
|
216
|
+
The tenant setting name. Example: "TenantSettingForCapacityDelegatedSwitch"
|
|
217
|
+
"""
|
|
218
|
+
|
|
219
|
+
(capacity_name, capacity_id) = _resolve_capacity_name_and_id(capacity=capacity)
|
|
220
|
+
|
|
221
|
+
_base_api(
|
|
222
|
+
request=f"/v1/admin/capacities/{capacity_id}/delegatedTenantSettingOverrides/{tenant_setting}",
|
|
223
|
+
client="fabric_sp",
|
|
224
|
+
method="delete",
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
print(
|
|
228
|
+
f"{icons.green_dot} The '{tenant_setting}' tenant setting has been removed from the '{capacity_name}' capacity."
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
@log
|
|
233
|
+
def update_tenant_setting(
|
|
234
|
+
tenant_setting: str,
|
|
235
|
+
enabled: bool,
|
|
236
|
+
delegate_to_capacity: Optional[bool] = None,
|
|
237
|
+
delegate_to_domain: Optional[bool] = None,
|
|
238
|
+
delegate_to_workspace: Optional[bool] = None,
|
|
239
|
+
enabled_security_groups: Optional[List[dict]] = None,
|
|
240
|
+
excluded_security_groups: Optional[List[dict]] = None,
|
|
241
|
+
properties: Optional[List[dict]] = None,
|
|
242
|
+
):
|
|
243
|
+
"""
|
|
244
|
+
Update a given tenant setting.
|
|
245
|
+
|
|
246
|
+
This is a wrapper function for the following API: `Tenants - Update Tenant Setting <https://learn.microsoft.com/rest/api/fabric/admin/tenants/update-tenant-setting>`_.
|
|
247
|
+
|
|
248
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
249
|
+
|
|
250
|
+
Parameters
|
|
251
|
+
----------
|
|
252
|
+
tenant_setting : str
|
|
253
|
+
The tenant setting name. Example: "TenantSettingForCapacityDelegatedSwitch"
|
|
254
|
+
enabled : bool
|
|
255
|
+
The status of the tenant setting. False - Disabled, True - Enabled.
|
|
256
|
+
delegate_to_capacity : bool, default=None
|
|
257
|
+
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.
|
|
258
|
+
delegate_to_domain : bool, default=None
|
|
259
|
+
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.
|
|
260
|
+
delegate_to_workspace : bool, default=None
|
|
261
|
+
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.
|
|
262
|
+
enabled_security_groups : List[dict], default=None
|
|
263
|
+
A list of enabled security groups. Example:
|
|
264
|
+
[
|
|
265
|
+
{
|
|
266
|
+
"graphId": "f51b705f-a409-4d40-9197-c5d5f349e2f0",
|
|
267
|
+
"name": "TestComputeCdsa"
|
|
268
|
+
}
|
|
269
|
+
]
|
|
270
|
+
excluded_security_groups : List[dict], default=None
|
|
271
|
+
A list of excluded security groups. Example:
|
|
272
|
+
[
|
|
273
|
+
{
|
|
274
|
+
"graphId": "f51b705f-a409-4d40-9197-c5d5f349e2f0",
|
|
275
|
+
"name": "TestComputeCdsa"
|
|
276
|
+
}
|
|
277
|
+
]
|
|
278
|
+
properties : List[dict], default=None
|
|
279
|
+
Tenant setting properties. Example:
|
|
280
|
+
[
|
|
281
|
+
{
|
|
282
|
+
"name": "CreateP2w",
|
|
283
|
+
"value": "true",
|
|
284
|
+
"type": "Boolean"
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
"""
|
|
288
|
+
|
|
289
|
+
payload = {"enabled": enabled}
|
|
290
|
+
|
|
291
|
+
if delegate_to_capacity is not None:
|
|
292
|
+
payload["delegateToCapacity"] = delegate_to_capacity
|
|
293
|
+
if delegate_to_domain is not None:
|
|
294
|
+
payload["delegateToDomain"] = delegate_to_domain
|
|
295
|
+
if delegate_to_workspace is not None:
|
|
296
|
+
payload["delegateToWorkspace"] = delegate_to_workspace
|
|
297
|
+
if enabled_security_groups is not None:
|
|
298
|
+
payload["enabledSecurityGroups"] = enabled_security_groups
|
|
299
|
+
if excluded_security_groups is not None:
|
|
300
|
+
payload["excludedSecurityGroups"] = excluded_security_groups
|
|
301
|
+
if properties is not None:
|
|
302
|
+
payload["properties"] = properties
|
|
303
|
+
|
|
304
|
+
_base_api(
|
|
305
|
+
request=f"/v1/admin/tenantsettings/{tenant_setting}/update",
|
|
306
|
+
client="fabric_sp",
|
|
307
|
+
method="post",
|
|
308
|
+
payload=payload,
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
print(f"{icons.green_dot} The '{tenant_setting}' tenant setting has been updated.")
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
@log
|
|
315
|
+
def update_capacity_tenant_setting_override(
|
|
316
|
+
capacity: str | UUID,
|
|
317
|
+
tenant_setting: str,
|
|
318
|
+
enabled: bool,
|
|
319
|
+
delegate_to_workspace: Optional[bool] = None,
|
|
320
|
+
enabled_security_groups: Optional[List[dict]] = None,
|
|
321
|
+
excluded_security_groups: Optional[List[dict]] = None,
|
|
322
|
+
):
|
|
323
|
+
"""
|
|
324
|
+
Update given tenant setting override for given capacity.
|
|
325
|
+
|
|
326
|
+
This is a wrapper function for the following API: `Tenants - Update Capacity Tenant Setting Override <https://learn.microsoft.com/en-us/rest/api/fabric/admin/tenants/update-capacity-tenant-setting-override>`_.
|
|
327
|
+
|
|
328
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
329
|
+
|
|
330
|
+
Parameters
|
|
331
|
+
----------
|
|
332
|
+
capacity : str | uuid.UUID
|
|
333
|
+
The capacity name or ID.
|
|
334
|
+
tenant_setting : str
|
|
335
|
+
The tenant setting name. Example: "TenantSettingForCapacityDelegatedSwitch"
|
|
336
|
+
enabled : bool
|
|
337
|
+
The status of the tenant setting. False - Disabled, True - Enabled.
|
|
338
|
+
delegate_to_workspace : bool, default=None
|
|
339
|
+
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.
|
|
340
|
+
enabled_security_groups : List[dict], default=None
|
|
341
|
+
A list of enabled security groups. Example:
|
|
342
|
+
[
|
|
343
|
+
{
|
|
344
|
+
"graphId": "f51b705f-a409-4d40-9197-c5d5f349e2f0",
|
|
345
|
+
"name": "TestComputeCdsa"
|
|
346
|
+
}
|
|
347
|
+
]
|
|
348
|
+
excluded_security_groups : List[dict], default=None
|
|
349
|
+
A list of excluded security groups. Example:
|
|
350
|
+
[
|
|
351
|
+
{
|
|
352
|
+
"graphId": "f51b705f-a409-4d40-9197-c5d5f349e2f0",
|
|
353
|
+
"name": "TestComputeCdsa"
|
|
354
|
+
}
|
|
355
|
+
]
|
|
356
|
+
"""
|
|
357
|
+
|
|
358
|
+
(capacity_name, capacity_id) = _resolve_capacity_name_and_id(capacity=capacity)
|
|
359
|
+
|
|
360
|
+
payload = {"enabled": enabled}
|
|
361
|
+
|
|
362
|
+
if delegate_to_workspace is not None:
|
|
363
|
+
payload["delegateToWorkspace"] = delegate_to_workspace
|
|
364
|
+
if enabled_security_groups is not None:
|
|
365
|
+
payload["enabledSecurityGroups"] = enabled_security_groups
|
|
366
|
+
if excluded_security_groups is not None:
|
|
367
|
+
payload["excludedSecurityGroups"] = excluded_security_groups
|
|
368
|
+
|
|
369
|
+
_base_api(
|
|
370
|
+
request=f"/v1/admin/capacities/{capacity_id}/delegatedTenantSettingOverrides/{tenant_setting}/update",
|
|
371
|
+
client="fabric_sp",
|
|
372
|
+
method="post",
|
|
373
|
+
payload=payload,
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
print(
|
|
377
|
+
f"{icons.green_dot} The '{tenant_setting}' tenant setting for the '{capacity_name}' capacity has been updated."
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
@log
|
|
382
|
+
def list_workspaces_tenant_settings_overrides() -> pd.DataFrame:
|
|
383
|
+
"""
|
|
384
|
+
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'.
|
|
385
|
+
|
|
386
|
+
This is a wrapper function for the following API: `Tenants - List Workspaces Tenant Settings Overrides <https://learn.microsoft.com/rest/api/fabric/admin/tenants/list-workspaces-tenant-settings-overrides>`_.
|
|
387
|
+
|
|
388
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
389
|
+
|
|
390
|
+
Returns
|
|
391
|
+
-------
|
|
392
|
+
pandas.DataFrame
|
|
393
|
+
A pandas dataframe showing a list of workspace delegation setting overrides.
|
|
394
|
+
"""
|
|
395
|
+
|
|
396
|
+
columns = {
|
|
397
|
+
"Workspace Id": "string",
|
|
398
|
+
"Setting Name": "string",
|
|
399
|
+
"Title": "string",
|
|
400
|
+
"Enabled": "bool",
|
|
401
|
+
"Can Specify Security Groups": "bool",
|
|
402
|
+
"Enabled Security Groups": "list",
|
|
403
|
+
"Tenant Setting Group": "string",
|
|
404
|
+
"Delegated From": "string",
|
|
405
|
+
}
|
|
406
|
+
df = _create_dataframe(columns=columns)
|
|
407
|
+
|
|
408
|
+
responses = _base_api(
|
|
409
|
+
request="/v1/admin/workspaces/delegatedTenantSettingOverrides",
|
|
410
|
+
client="fabric_sp",
|
|
411
|
+
uses_pagination=True,
|
|
412
|
+
)
|
|
413
|
+
|
|
414
|
+
rows = []
|
|
415
|
+
for r in responses:
|
|
416
|
+
for v in r.get("value", []):
|
|
417
|
+
workspace_id = v.get("id")
|
|
418
|
+
for setting in v.get("tenantSettings", []):
|
|
419
|
+
rows.append(
|
|
420
|
+
{
|
|
421
|
+
"Workspace Id": workspace_id,
|
|
422
|
+
"Setting Name": setting.get("settingName"),
|
|
423
|
+
"Title": setting.get("title"),
|
|
424
|
+
"Enabled": setting.get("enabled"),
|
|
425
|
+
"Can Specify Security Groups": setting.get(
|
|
426
|
+
"canSpecifySecurityGroups"
|
|
427
|
+
),
|
|
428
|
+
"Enabled Security Groups": [
|
|
429
|
+
setting.get("enabledSecurityGroups", [])
|
|
430
|
+
],
|
|
431
|
+
"Tenant Setting Group": setting.get("tenantSettingGroup"),
|
|
432
|
+
"Delegated From": setting.get("delegatedFrom"),
|
|
433
|
+
}
|
|
434
|
+
)
|
|
435
|
+
|
|
436
|
+
if rows:
|
|
437
|
+
df = pd.DataFrame(rows, columns=list(columns.keys()))
|
|
438
|
+
_update_dataframe_datatypes(dataframe=df, column_map=columns)
|
|
439
|
+
|
|
440
|
+
return df
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
@log
|
|
444
|
+
def list_domain_tenant_settings_overrides() -> pd.DataFrame:
|
|
445
|
+
"""
|
|
446
|
+
Shows a list of domain delegation setting overrides.
|
|
447
|
+
|
|
448
|
+
This is a wrapper function for the following API: `Tenants - List Domains Tenant Settings Overrides <https://learn.microsoft.com/rest/api/fabric/admin/tenants/list-domains-tenant-settings-overrides>`_.
|
|
449
|
+
|
|
450
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
451
|
+
|
|
452
|
+
Returns
|
|
453
|
+
-------
|
|
454
|
+
pandas.DataFrame
|
|
455
|
+
A pandas dataframe showing a list of domain delegation setting overrides.
|
|
456
|
+
"""
|
|
457
|
+
|
|
458
|
+
columns = {
|
|
459
|
+
"Domain Id": "string",
|
|
460
|
+
"Setting Name": "string",
|
|
461
|
+
"Title": "string",
|
|
462
|
+
"Enabled": "bool",
|
|
463
|
+
"Can Specify Security Groups": "bool",
|
|
464
|
+
"Enabled Security Groups": "list",
|
|
465
|
+
"Tenant Setting Group": "string",
|
|
466
|
+
"Delegated To Workspace": "bool",
|
|
467
|
+
"Delegated From": "string",
|
|
468
|
+
}
|
|
469
|
+
df = _create_dataframe(columns=columns)
|
|
470
|
+
|
|
471
|
+
responses = _base_api(
|
|
472
|
+
request="/v1/admin/domains/delegatedTenantSettingOverrides",
|
|
473
|
+
client="fabric_sp",
|
|
474
|
+
uses_pagination=True,
|
|
475
|
+
)
|
|
476
|
+
|
|
477
|
+
rows = []
|
|
478
|
+
for r in responses:
|
|
479
|
+
for v in r.get("value", []):
|
|
480
|
+
domain_id = v.get("id")
|
|
481
|
+
for setting in v.get("tenantSettings", []):
|
|
482
|
+
rows.append(
|
|
483
|
+
{
|
|
484
|
+
"Domain Id": domain_id,
|
|
485
|
+
"Setting Name": setting.get("settingName"),
|
|
486
|
+
"Title": setting.get("title"),
|
|
487
|
+
"Enabled": setting.get("enabled"),
|
|
488
|
+
"Can Specify Security Groups": setting.get(
|
|
489
|
+
"canSpecifySecurityGroups"
|
|
490
|
+
),
|
|
491
|
+
"Enabled Security Groups": [
|
|
492
|
+
setting.get("enabledSecurityGroups", [])
|
|
493
|
+
],
|
|
494
|
+
"Tenant Setting Group": setting.get("tenantSettingGroup"),
|
|
495
|
+
"Delegated To Workspace": setting.get("delegateToWorkspace"),
|
|
496
|
+
"Delegated From": setting.get("delegatedFrom"),
|
|
497
|
+
}
|
|
498
|
+
)
|
|
499
|
+
if rows:
|
|
500
|
+
df = pd.DataFrame(rows, columns=list(columns.keys()))
|
|
501
|
+
_update_dataframe_datatypes(dataframe=df, column_map=columns)
|
|
502
|
+
|
|
503
|
+
return df
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
from sempy_labs._helper_functions import (
|
|
3
|
+
_create_dataframe,
|
|
4
|
+
_update_dataframe_datatypes,
|
|
5
|
+
_base_api,
|
|
6
|
+
)
|
|
7
|
+
from sempy._utils._log import log
|
|
8
|
+
from uuid import UUID
|
|
9
|
+
import sempy_labs._icons as icons
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@log
|
|
13
|
+
def list_tenant_keys() -> pd.DataFrame:
|
|
14
|
+
"""
|
|
15
|
+
Returns the encryption keys for the tenant.
|
|
16
|
+
|
|
17
|
+
This is a wrapper function for the following API: `Admin - Get Power BI Encryption Keys <https://learn.microsoft.com/rest/api/power-bi/admin/get-power-bi-encryption-keys>`_.
|
|
18
|
+
|
|
19
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
20
|
+
|
|
21
|
+
Returns
|
|
22
|
+
-------
|
|
23
|
+
pandas.DataFrame
|
|
24
|
+
A pandas dataframe showing the encryption keys for the tenant.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
columns = {
|
|
28
|
+
"Tenant Key Id": "str",
|
|
29
|
+
"Tenant Key Name": "str",
|
|
30
|
+
"Key Vault Key Identifier": "str",
|
|
31
|
+
"Is Default": "bool",
|
|
32
|
+
"Created At": "datetime",
|
|
33
|
+
"Updated At": "datetime",
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
df = _create_dataframe(columns=columns)
|
|
37
|
+
|
|
38
|
+
result = _base_api(
|
|
39
|
+
request="/v1.0/myorg/admin/tenantKeys", client="fabric_sp"
|
|
40
|
+
).json()
|
|
41
|
+
|
|
42
|
+
rows = []
|
|
43
|
+
for i in result.get("value", []):
|
|
44
|
+
rows.append(
|
|
45
|
+
{
|
|
46
|
+
"Tenant Key Id": i.get("id"),
|
|
47
|
+
"Tenant Key Name": i.get("name"),
|
|
48
|
+
"Key Vault Key Identifier": i.get("keyVaultKeyIdentifier"),
|
|
49
|
+
"Is Default": i.get("isDefault"),
|
|
50
|
+
"Created At": i.get("createdAt"),
|
|
51
|
+
"Updated At": i.get("updatedAt"),
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
if rows:
|
|
56
|
+
df = pd.DataFrame(rows, columns=list(columns.keys()))
|
|
57
|
+
_update_dataframe_datatypes(dataframe=df, column_map=columns)
|
|
58
|
+
|
|
59
|
+
return df
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@log
|
|
63
|
+
def rotate_tenant_key(tenant_key_id: UUID, key_vault_key_identifier: str):
|
|
64
|
+
"""
|
|
65
|
+
Rotate the encryption key for Power BI workspaces assigned to a capacity.
|
|
66
|
+
|
|
67
|
+
This is a wrapper function for the following API: `Admin - Rotate Power BI Encryption Key <https://learn.microsoft.com/rest/api/power-bi/admin/rotate-power-bi-encryption-key>`_.
|
|
68
|
+
|
|
69
|
+
Parameters
|
|
70
|
+
----------
|
|
71
|
+
tenant_key_id : uuid.UUID
|
|
72
|
+
The tenant key ID
|
|
73
|
+
key_vault_key_identifier : str
|
|
74
|
+
The URI that uniquely specifies the encryption key in Azure Key Vault
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
payload = {
|
|
78
|
+
"keyVaultKeyIdentifier": key_vault_key_identifier,
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
_base_api(
|
|
82
|
+
request=f"/v1.0/myorg/admin/tenantKeys/{tenant_key_id}/Default.Rotate",
|
|
83
|
+
method="post",
|
|
84
|
+
payload=payload,
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
print(
|
|
88
|
+
f"{icons.green_dot} The encryption key for tenant {tenant_key_id} has been rotated successfully using the '{key_vault_key_identifier}' Key Vault key identifier."
|
|
89
|
+
)
|