-
Notifications
You must be signed in to change notification settings - Fork 5
/
Fabtools.psm1
53 lines (42 loc) · 1.76 KB
/
Fabtools.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<#
.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
.\Fabtools.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 Fabtools module.
#>
$script:apiUrl = "https://api.fabric.microsoft.com/v1"
$script:resourceUrl = "https://api.fabric.microsoft.com"
$script:fabricToken = $null
# Get all .ps1 files in the Functions folder
$functions = Get-ChildItem -Path "$PSScriptRoot\Functions" -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
}
# Set aliases for PowerBI functions
Set-Alias -Name Login-Fabric -Value Login-PowerBI
Export-ModuleMember -Alias Login-Fabric
Set-Alias -Name Get-FabWorkspace -Value Get-FabricWorkspace
Export-ModuleMember -Alias Get-FabDataset
Set-Alias -Name Get-FabricDataset -Value Get-PowerBIDataset
Export-ModuleMember -Alias Get-FabricDataset
Set-Alias -Name Get-FabReport -Value Get-PowerBIReport
Export-ModuleMember -Alias Get-FabReport
Set-Alias -Name Get-FabricReport -Value Get-PowerBIReport
Export-ModuleMember -Alias Get-FabricReport
Set-Alias -Name Logout-Fabric -Value Logout-PowerBI
Export-ModuleMember -Alias Logout-Fabric