Functions/Get-FabricTenantSettings.ps1

<#
.SYNOPSIS
Retrieves the tenant settings.
 
.DESCRIPTION
The Get-FabricTenantSettings function retrieves the tenant settings. It supports multiple aliases for flexibility.
 
.EXAMPLE
Get-FabricTenantSettings
 
This example retrieves the tenant settings.
 
.NOTES
The function retrieves the PowerBI access token and makes a GET request to the Fabric API to retrieve the tenant settings. It then returns the 'tenantSettings' property of the first item in the response.
#>


# This function retrieves the tenant settings.
function Get-FabricTenantSettings  {
    # Define aliases for the function for flexibility.
    [Alias("Get-PowerBITenantSettings","Get-FabTenantSettings")]

    # Retrieve the PowerBI access token.
    $token = (Get-PowerBIAccessToken)["Authorization"]

    # Make a GET request to the Fabric API to retrieve the tenant settings.
    $reply = Invoke-RestMethod -uri "https://api.fabric.microsoft.com/v1/admin/tenantsettings" -Headers @{ "Authorization" = $token } -Method GET

    # Return the 'tenantSettings' property of the first item in the response.
    return $reply[0].tenantSettings
}