Skip to main content

Function To Get All The Fabric Tenant Settings With Descriptions

Simple Method to Get Fabric Tenant Settings and Descriptions

Updated Markdown

Sharing a function I have been using to get all the Fabric tenant settings and the description of each setting.

๐Ÿ’ก
You need to be a Fabric tenant admin to use this function. Run the following function in a Fabric notebook.
import sempy.fabric as fabric
from sempy.fabric.exceptions import FabricHTTPException
import pandas as pd
import json
from datetime import datetime

pd.set_option('display.max_columns', None)

def get_tenant_settings():
    """
    Author : Sandeep Pawar  |  Fabric.guru  |  May 19, 2024

    Function to get a list of all the tenant settings and the description of each setting.
    You need to be a Fabric tenant admin to get the settings.
    """

    client = fabric.PowerBIRestClient()
    try:
        response = client.get("v1/admin/tenantsettings")

        if response.status_code != 200:
            raise FabricHTTPException(response)

        data = json.loads(response.text)

        current_tenant_settings = pd.json_normalize(data['tenantSettings'])

        tenant_setting_desc = pd.concat(pd.read_html("https://learn.microsoft.com/en-us/fabric/admin/tenant-settings-index")).reset_index(drop=True)

        final_settings_df = (current_tenant_settings
                                .set_index("title")
                                .join(tenant_setting_desc.set_index("Setting name"))
                                .reset_index()
                                )[['tenantSettingGroup','title','settingName','Description','enabled','canSpecifySecurityGroups','enabledSecurityGroups']]

        final_settings_df['Settings As Of'] = datetime.now().strftime("%d/%m/%Y %H:%M")

        return final_settings_df

    except FabricHTTPException as e:
        print("Only tenant admins can use this function\n")
        return str(e)


df = get_tenant_settings()
df

About the author

  • Principal Program Manager, Microsoft Fabric CAT helping users and organizations build scalable, insightful, secure solutions. Blogs, opinions are my own and do not represent my employer.

Sandeep Pawar Thanks for sharing this function. I've just tested it and it will help me to automate how we keep track with tenant setting changes. One question if I may.. the details for Security groups in this function are returned as [{'graphId': '14xxx420-2xxb-4xxx0-a7xx5-6xxx8ad4...

Is it possible to amend the function to show the actual AAD Group Names from Entra Id?