FabricTools.psm1

<#
.SYNOPSIS
   This script loads necessary modules, sources functions from .ps1 files, and sets aliases for PowerBI functions.

.DESCRIPTION
   The script first tries to load the Az.Accounts and Az.Resources modules. If these modules are not available, it installs and imports them.
   It then gets all .ps1 files in the Functions folder, sources each function, and exports it as a module member.
   Finally, it sets an alias for the PowerBI login function.

.EXAMPLE
   .\FabricTools.psm1

   This command runs the script.

.INPUTS
   None. You cannot pipe inputs to this script.

.OUTPUTS
   None. This script does not return any output.

.NOTES
   This script is part of the FabricTools module.
#>


$FabricSession = [ordered]@{
   BaseFabricUrl       = 'https://api.fabric.microsoft.com'
   FabricToken         = $null
   HeaderParams        = $null
   ContentType         = @{'Content-Type' = "application/json"}
   KustoURL            = "https://api.kusto.windows.net"
}

$script:apiUrl = "https://api.fabric.microsoft.com/v1"
$script:resourceUrl = "https://api.fabric.microsoft.com"
$script:fabricToken = $null
# Get all .ps1 files in the (public) Functions folder
$functions = Get-ChildItem -Path "$PSScriptRoot\public" -Filter *.ps1

# Loop over each function file
foreach ($function in $functions) {
    # Dot-source the function
    . $function.fullname
    # Export the function as a module member
    Export-ModuleMember -Function $function.basename
}


$moduleName = 'FabricTools'
Write-Host "Module $moduleName imported."