Skip to content

Commit 7a89e75

Browse files
committed
Update module versions and refactor configuration references in scripts #85
1 parent 2788abb commit 7a89e75

16 files changed

Lines changed: 77 additions & 75 deletions

RequiredModules.psd1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
#}
1414
Assert = "0.9.6"
1515
InvokeBuild = 'latest'
16-
PSScriptAnalyzer = '1.19.1'
16+
PSScriptAnalyzer = '1.24.0'
1717
Pester = 'latest'
1818
ModuleBuilder = 'latest'
1919
ChangelogManagement = 'latest'
2020
Sampler = 'latest'
2121
'Sampler.GitHubTasks' = 'latest'
2222
MarkdownLinkCheck = 'latest'
23-
PSFramework = 'latest'
24-
'Az.Accounts' = '5.0.0'
25-
'Az.Resources' = '6.15.1'
23+
'PSFramework' = 'latest'
24+
'Az.Accounts' = '5.3.0'
25+
'Az.Resources' = '8.1.1'
2626
'MicrosoftPowerBIMgmt' = '1.2.1111'
2727
'Microsoft.PowerShell.PlatyPS' = 'latest'
2828
}

docs/en-US/FabricTools.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Retrieves the workloads for a specific capacity.
112112

113113
### [Get-FabricConfig](Get-FabricConfig.md)
114114

115-
Gets the configuration for use with all functions in the PSFabricTools module.
115+
Gets the configuration for use with all functions in the FabricTools module.
116116

117117
### [Get-FabricConnection](Get-FabricConnection.md)
118118

@@ -686,7 +686,7 @@ Retrieves External Data Shares details from a specified Microsoft Fabric.
686686

687687
### [Set-FabricConfig](Set-FabricConfig.md)
688688

689-
Register the configuration for use with all functions in the PSFabricTools module.
689+
Register the configuration for use with all functions in the FabricTools module.
690690

691691
### [Start-FabricDeploymentPipelineStage](Start-FabricDeploymentPipelineStage.md)
692692

@@ -875,4 +875,3 @@ Updates the role assignment for a specific principal in a Fabric workspace.
875875
### [Write-FabricLakehouseTableData](Write-FabricLakehouseTableData.md)
876876

877877
Loads data into a specified table in a Lakehouse within a Fabric workspace.
878-

docs/en-US/Get-FabricConfig.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ title: Get-FabricConfig
1313

1414
## SYNOPSIS
1515

16-
Gets the configuration for use with all functions in the PSFabricTools module.
16+
Gets the configuration for use with all functions in the FabricTools module.
1717

1818
## SYNTAX
1919

@@ -27,21 +27,21 @@ Get-FabricConfig [[-ConfigName] <string>]
2727

2828
## DESCRIPTION
2929

30-
Gets the configuration for use with all functions in the PSFabricTools module.
30+
Gets the configuration for use with all functions in the FabricTools module.
3131

3232
## EXAMPLES
3333

3434
### EXAMPLE 1
3535

36-
Gets all configuration values for the PSFabricTools module and outputs them.
36+
Gets all configuration values for the FabricTools module and outputs them.
3737

3838
```powershell
3939
Get-FabricConfig
4040
```
4141

4242
### EXAMPLE 2
4343

44-
Gets the BaseUrl configuration value for the PSFabricTools module.
44+
Gets the BaseUrl configuration value for the FabricTools module.
4545

4646
```powershell
4747
Get-FabricConfig -ConfigName BaseUrl
@@ -81,4 +81,3 @@ Author: Jess Pomfret
8181
## RELATED LINKS
8282
8383
{{ Fill in the related links here }}
84-

docs/en-US/Set-FabricConfig.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ title: Set-FabricConfig
1313

1414
## SYNOPSIS
1515

16-
Register the configuration for use with all functions in the PSFabricTools module.
16+
Register the configuration for use with all functions in the FabricTools module.
1717

1818
## SYNTAX
1919

@@ -28,21 +28,21 @@ Set-FabricConfig [[-WorkspaceGUID] <guid>] [[-DataWarehouseGUID] <guid>] [[-Base
2828

2929
## DESCRIPTION
3030

31-
Register the configuration for use with all functions in the PSFabricTools module.
31+
Register the configuration for use with all functions in the FabricTools module.
3232

3333
## EXAMPLES
3434

3535
### EXAMPLE 1
3636

37-
Registers the specified Fabric Data Warehouse configuration for use with all functions in the PSFabricTools module.
37+
Registers the specified Fabric Data Warehouse configuration for use with all functions in the FabricTools module.
3838

3939
```powershell
4040
Set-FabricConfig -WorkspaceGUID 'GUID-GUID-GUID-GUID' -DataWarehouseGUID 'GUID-GUID-GUID-GUID'
4141
```
4242

4343
### EXAMPLE 2
4444

45-
Registers the specified Fabric Data Warehouse configuration for use with all functions in the PSFabricTools module, but does not persist the values.
45+
Registers the specified Fabric Data Warehouse configuration for use with all functions in the FabricTools module, but does not persist the values.
4646

4747
```powershell
4848
Set-FabricConfig -WorkspaceGUID 'GUID-GUID-GUID-GUID' -DataWarehouseGUID 'GUID-GUID-GUID-GUID' -SkipPersist
@@ -196,4 +196,3 @@ Author: Jess Pomfret
196196
## RELATED LINKS
197197
198198
{{ Fill in the related links here }}
199-

source/Private/Confirm-TokenState.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ function Confirm-TokenState {
2424
[CmdletBinding()]
2525
param ()
2626

27+
# Refresh the global FabricConfig variable to be backwards compatible
28+
$script:FabricConfig = Get-PSFConfigValue 'FabricTools.FabricApi.BaseApiUrl'
29+
2730
Write-Message -Message "Validating token..." -Level Verbose
2831

2932
try {

source/Private/Set-FabConfig.ps1

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
# this is a workaround to get the variables set for now
2-
# TODO: change to use PSFConfig?
3-
41
Set-PSFConfig -Name 'FabricTools.FabricApi.BaseApiUrl' -Value 'https://api.fabric.microsoft.com/v1'
52
Set-PSFConfig -Name 'FabricTools.FabricApi.ResourceUrl' -Value 'https://api.fabric.microsoft.com'
63
Set-PSFConfig -Name 'FabricTools.FabricApi.TenantId'
74
Set-PSFConfig -Name 'FabricTools.FabricApi.ContentType' -Value 'application/json; charset=utf-8'
85

96
Set-PSFConfig -Name 'FabricTools.FabricSession.Headers' -Value @{}
10-
Set-PSFConfig -Name 'FabricTools.FabricSession.TokenExpiresOn' -Value $null -Validation DateTimeOffset
7+
Set-PSFConfig -Name 'FabricTools.FabricSession.TokenExpiresOn' -Value $null
118
Set-PSFConfig -Name 'FabricTools.FabricSession.AccessToken' -Value $null
129

1310
Set-PSFConfig -Name 'FabricTools.KustoApi.BaseUrl' -Value 'https://api.kusto.windows.net'
@@ -16,16 +13,12 @@ Set-PSFConfig -Name 'FabricTools.AzureApi.BaseUrl' -Value "https://m
1613
Set-PSFConfig -Name 'FabricTools.AzureSession.AccessToken' -Value $null
1714
Set-PSFConfig -Name 'FabricTools.AzureSession.Headers' -Value @{}
1815

19-
$script:AzureSession = [ordered]@{
20-
BaseApiUrl = "https://management.azure.com"
21-
AccessToken = $null
22-
HeaderParams = $null
23-
}
24-
25-
Set-PSFConfig -Name 'FabricTools.PowerBiApi.BaseUrl' -Value "https://api.powerbi.com/v1.0/myorg"
16+
Set-PSFConfig -Name 'FabricTools.PowerBiApi.BaseUrl' -Value "https://api.powerbi.com/v1.0/myorg"
2617

27-
$FabricConfig = @{
18+
# Remain backwards compatible with scripts relying on $FabricConfig variable
19+
$script:FabricConfig = @{
2820
BaseUrl = "https://api.fabric.microsoft.com/v1"
2921
}
3022

23+
# Feature Flags
3124
Set-PSFConfig -Name 'FabricTools.FeatureFlags.EnableTokenRefresh' -Value $true -Validation bool

source/Public/Capacity/Get-FabricCapacitySkus.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ Author: Kamil Nowinski
3939

4040
Confirm-TokenState
4141

42+
$AzureBaseApiUrl = Get-PSFConfigValue 'FabricTools.AzureApi.BaseUrl'
43+
$AzureSessionHeaderParams = Get-PSFConfigValue 'FabricTools.AzureSession.Headers'
44+
4245
#GET https://management.azure.com/subscriptions/548B7FB7-3B2A-4F46-BB02-66473F1FC22C/resourceGroups/TestRG/providers/Microsoft.Fabric/capacities/azsdktest/skus?api-version=2023-11-01
43-
$uri = "$($AzureSession.BaseApiUrl)/subscriptions/$subscriptionID/resourceGroups/$ResourceGroupName/providers/Microsoft.Fabric/capacities/$capacity/skus?api-version=2023-11-01"
44-
$result = Invoke-RestMethod -Headers $AzureSession.HeaderParams -Uri $uri -Method GET
46+
$uri = "$AzureBaseApiUrl/subscriptions/$subscriptionID/resourceGroups/$ResourceGroupName/providers/Microsoft.Fabric/capacities/$capacity/skus?api-version=2023-11-01"
47+
$result = Invoke-RestMethod -Headers $AzureSessionHeaderParams -Uri $uri -Method GET
4548

4649
return $result.value
4750

source/Public/Capacity/Get-FabricCapacityState.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ Author: Ioana Bouariu
4545

4646
Confirm-TokenState
4747

48+
$AzureBaseApiUrl = Get-PSFConfigValue 'FabricTools.AzureApi.BaseUrl'
49+
4850
# Define the URL for the GET request.
49-
$getCapacityState = "$($AzureSession.BaseApiUrl)/subscriptions/$subscriptionID/resourceGroups/$resourcegroup/providers/Microsoft.Fabric/capacities/$capacity/?api-version=2022-07-01-preview"
51+
$getCapacityState = "$AzureBaseApiUrl/subscriptions/$subscriptionID/resourceGroups/$resourcegroup/providers/Microsoft.Fabric/capacities/$capacity/?api-version=2022-07-01-preview"
5052

5153
# Make the GET request and return the response.
5254
return Invoke-RestMethod -Method GET -Uri $getCapacityState -Headers $script:AzureSession.HeaderParams -ErrorAction Stop

source/Public/Capacity/Resume-FabricCapacity.ps1

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ function Resume-FabricCapacity {
66
.DESCRIPTION
77
The Resume-FabricCapacity function resumes a capacity. It supports multiple aliases for flexibility.
88
9-
.PARAMETER subscriptionID
9+
.PARAMETER SubscriptionID
1010
The the ID of the subscription. This is a mandatory parameter. This is a parameter found in Azure, not Fabric.
1111
12-
.PARAMETER resourcegroup
12+
.PARAMETER ResourceGroup
1313
The resource group. This is a mandatory parameter. This is a parameter found in Azure, not Fabric.
1414
1515
.PARAMETER capacity
@@ -19,7 +19,7 @@ function Resume-FabricCapacity {
1919
This example resumes a capacity given the subscription ID, resource group, and capacity.
2020
2121
```powershell
22-
Resume-FabricCapacity -subscriptionID "your-subscription-id" -resourcegroupID "your-resource-group" -capacityID "your-capacity"
22+
Resume-FabricCapacity -subscriptionID "your-subscription-id" -ResourceGroup "your-resource-group" -capacityID "your-capacity"
2323
```
2424
2525
.NOTES
@@ -34,20 +34,22 @@ function Resume-FabricCapacity {
3434
# Define parameters for the subscription ID, resource group, and capacity.
3535
Param (
3636
[Parameter(Mandatory = $true)]
37-
[guid]$subscriptionID,
37+
[guid]$SubscriptionID,
3838
[Parameter(Mandatory = $true)]
39-
[string]$resourcegroup,
39+
[string]$ResourceGroup,
4040
[Parameter(Mandatory = $true)]
41-
[string]$capacity
41+
[string]$Capacity
4242
)
4343

4444
Confirm-TokenState
4545

46+
$AzureBaseApiUrl = Get-PSFConfigValue 'FabricTools.AzureApi.BaseUrl'
47+
4648
# Define the URI for the request.
47-
$resumeCapacity = "$($AzureSession.BaseApiUrl)/subscriptions/$subscriptionID/resourceGroups/$resourcegroup/providers/Microsoft.Fabric/capacities/$capacity/resume?api-version=2022-07-01-preview"
49+
$resumeCapacity = "$AzureBaseApiUrl/subscriptions/$SubscriptionID/resourceGroups/$ResourceGroup/providers/Microsoft.Fabric/capacities/$Capacity/resume?api-version=2022-07-01-preview"
4850

4951
# Make a GET request to the URI and return the response.
50-
if ($PSCmdlet.ShouldProcess("Resume capacity $capacity")) {
52+
if ($PSCmdlet.ShouldProcess("Resume capacity $Capacity")) {
5153
return Invoke-RestMethod -Method POST -Uri $resumeCapacity -Headers $script:AzureSession.HeaderParams -ErrorAction Stop
5254
}
5355
}

source/Public/Capacity/Suspend-FabricCapacity.ps1

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ Suspends a capacity.
66
.DESCRIPTION
77
The Suspend-FabricCapacity function suspends a capacity. It supports multiple aliases for flexibility.
88
9-
.PARAMETER subscriptionID
9+
.PARAMETER SubscriptionID
1010
The ID of the subscription. This is a mandatory parameter. This is a parameter found in Azure, not Fabric.
1111
12-
.PARAMETER resourcegroup
12+
.PARAMETER ResourceGroup
1313
The resource group. This is a mandatory parameter. This is a parameter found in Azure, not Fabric.
1414
15-
.PARAMETER capacity
15+
.PARAMETER Capacity
1616
The the capacity. This is a mandatory parameter. This is a parameter found in Azure, not Fabric.
1717
1818
.EXAMPLE
1919
This example suspends a capacity given the subscription ID, resource group, and capacity.
2020
2121
```powershell
22-
Suspend-FabricCapacity -subscriptionID "your-subscription-id" -resourcegroupID "your-resource-group" -capacityID "your-capacity"
22+
Suspend-FabricCapacity -SubscriptionID "your-subscription-id" -ResourceGroup "your-resource-group" -Capacity "your-capacity"
2323
```
2424
2525
.NOTES
@@ -35,17 +35,19 @@ Author: Ioana Bouariu
3535
# Define parameters for the subscription ID, resource group, and capacity.
3636
Param (
3737
[Parameter(Mandatory = $true)]
38-
[guid]$subscriptionID,
38+
[guid]$SubscriptionID,
3939
[Parameter(Mandatory = $true)]
40-
[string]$resourcegroup,
40+
[string]$ResourceGroup,
4141
[Parameter(Mandatory = $true)]
42-
[string]$capacity
42+
[string]$Capacity
4343
)
4444

4545
Confirm-TokenState
4646

47+
$AzureBaseApiUrl = Get-PSFConfigValue 'FabricTools.AzureApi.BaseUrl'
48+
4749
# Define the URI for the request.
48-
$suspendCapacity = "$($AzureSession.BaseApiUrl)/subscriptions/$subscriptionID/resourceGroups/$resourcegroup/providers/Microsoft.Fabric/capacities/$capacity/suspend?api-version=2023-11-01"
50+
$suspendCapacity = "$AzureBaseApiUrl/subscriptions/$SubscriptionID/resourceGroups/$ResourceGroup/providers/Microsoft.Fabric/capacities/$Capacity/suspend?api-version=2023-11-01"
4951

5052
# Make a GET request to the URI and return the response.
5153
if ($PSCmdlet.ShouldProcess("Suspend capacity $capacity")) {

0 commit comments

Comments
 (0)