Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/Private/Confirm-TokenState.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function Confirm-TokenState {
param ()

# Refresh the global FabricConfig variable to be backwards compatible
$script:FabricConfig = Get-PSFConfigValue 'FabricTools.FabricApi.BaseApiUrl'
$script:FabricConfig.BaseUrl = Get-PSFConfigValue 'FabricTools.FabricApi.BaseUrl'

Write-Message -Message "Validating token..." -Level Verbose

Expand Down
4 changes: 3 additions & 1 deletion source/Private/Set-FabConfig.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Set-PSFConfig -Name 'FabricTools.FabricApi.BaseApiUrl' -Value 'https://api.fabric.microsoft.com/v1'
Write-Verbose "Setting FabricTools configuration defaults..."

Set-PSFConfig -Name 'FabricTools.FabricApi.BaseUrl' -Value 'https://api.fabric.microsoft.com/v1'
Set-PSFConfig -Name 'FabricTools.FabricApi.ResourceUrl' -Value 'https://api.fabric.microsoft.com'
Set-PSFConfig -Name 'FabricTools.FabricApi.TenantId'
Set-PSFConfig -Name 'FabricTools.FabricApi.ContentType' -Value 'application/json; charset=utf-8'
Expand Down
17 changes: 9 additions & 8 deletions source/Public/Capacity/Get-FabricCapacityState.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ Retrieves the state of a specific capacity.
.DESCRIPTION
The Get-FabricCapacityState function retrieves the state of a specific capacity. It supports multiple aliases for flexibility.

.PARAMETER subscriptionID
.PARAMETER SubscriptionID
The ID of the subscription. This is a mandatory parameter. This is a parameter found in Azure, not Fabric.

.PARAMETER resourcegroup
.PARAMETER ResourceGroup
The resource group. This is a mandatory parameter. This is a parameter found in Azure, not Fabric.

.PARAMETER capacity
.PARAMETER Capacity
The capacity. This is a mandatory parameter. This is a parameter found in Azure, not Fabric.

.EXAMPLE
This example retrieves the state of a specific capacity given the subscription ID, resource group, and capacity.

```powershell
Get-FabricCapacityState -subscriptionID "your-subscription-id" -resourcegroupID "your-resource-group" -capacityID "your-capacity"
Get-FabricCapacityState -SubscriptionID "your-subscription-id" -ResourceGroup "your-resource-group" -Capacity "your-capacity"
```

.NOTES
Expand All @@ -36,20 +36,21 @@ Author: Ioana Bouariu
# Define mandatory parameters for the subscription ID, resource group, and capacity.
Param (
[Parameter(Mandatory = $true)]
[guid]$subscriptionID,
[guid]$SubscriptionID,
[Parameter(Mandatory = $true)]
[string]$resourcegroup,
[string]$ResourceGroup,
[Parameter(Mandatory = $true)]
[string]$capacity
)

Confirm-TokenState

$AzureBaseApiUrl = Get-PSFConfigValue 'FabricTools.AzureApi.BaseUrl'
$headers = Get-PSFConfigValue 'FabricTools.AzureSession.Headers'

# Define the URL for the GET request.
$getCapacityState = "$AzureBaseApiUrl/subscriptions/$subscriptionID/resourceGroups/$resourcegroup/providers/Microsoft.Fabric/capacities/$capacity/?api-version=2022-07-01-preview"
$getCapacityState = "$AzureBaseApiUrl/subscriptions/$SubscriptionID/resourceGroups/$ResourceGroup/providers/Microsoft.Fabric/capacities/$Capacity/?api-version=2022-07-01-preview"

# Make the GET request and return the response.
return Invoke-RestMethod -Method GET -Uri $getCapacityState -Headers $script:AzureSession.HeaderParams -ErrorAction Stop
return Invoke-RestMethod -Method GET -Uri $getCapacityState -Headers $headers -ErrorAction Stop
}
7 changes: 4 additions & 3 deletions source/Public/Capacity/Resume-FabricCapacity.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ function Resume-FabricCapacity {
.PARAMETER ResourceGroup
The resource group. This is a mandatory parameter. This is a parameter found in Azure, not Fabric.

.PARAMETER capacity
.PARAMETER Capacity
The capacity. This is a mandatory parameter. This is a parameter found in Azure, not Fabric.

.EXAMPLE
This example resumes a capacity given the subscription ID, resource group, and capacity.

```powershell
Resume-FabricCapacity -subscriptionID "your-subscription-id" -ResourceGroup "your-resource-group" -capacityID "your-capacity"
Resume-FabricCapacity -SubscriptionID "your-subscription-id" -ResourceGroup "your-resource-group" -Capacity "your-capacity"
```

.NOTES
Expand All @@ -44,12 +44,13 @@ function Resume-FabricCapacity {
Confirm-TokenState

$AzureBaseApiUrl = Get-PSFConfigValue 'FabricTools.AzureApi.BaseUrl'
$headers = Get-PSFConfigValue 'FabricTools.AzureSession.Headers'

# Define the URI for the request.
$resumeCapacity = "$AzureBaseApiUrl/subscriptions/$SubscriptionID/resourceGroups/$ResourceGroup/providers/Microsoft.Fabric/capacities/$Capacity/resume?api-version=2022-07-01-preview"

# Make a GET request to the URI and return the response.
if ($PSCmdlet.ShouldProcess("Resume capacity $Capacity")) {
return Invoke-RestMethod -Method POST -Uri $resumeCapacity -Headers $script:AzureSession.HeaderParams -ErrorAction Stop
return Invoke-RestMethod -Method POST -Uri $resumeCapacity -Headers $headers -ErrorAction Stop
}
}
3 changes: 2 additions & 1 deletion source/Public/Capacity/Suspend-FabricCapacity.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ Author: Ioana Bouariu
Confirm-TokenState

$AzureBaseApiUrl = Get-PSFConfigValue 'FabricTools.AzureApi.BaseUrl'
$headers = Get-PSFConfigValue 'FabricTools.AzureSession.Headers'

# Define the URI for the request.
$suspendCapacity = "$AzureBaseApiUrl/subscriptions/$SubscriptionID/resourceGroups/$ResourceGroup/providers/Microsoft.Fabric/capacities/$Capacity/suspend?api-version=2023-11-01"

# Make a GET request to the URI and return the response.
if ($PSCmdlet.ShouldProcess("Suspend capacity $capacity")) {
return Invoke-RestMethod -Method POST -Uri $suspendCapacity -Headers $script:AzureSession.HeaderParams -ErrorAction Stop
return Invoke-RestMethod -Method POST -Uri $suspendCapacity -Headers $headers -ErrorAction Stop
}

}
2 changes: 1 addition & 1 deletion source/Public/Connect-FabricAccount.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function Connect-FabricAccount {
$azContext = Get-AzContext
}

Write-Message "Connected: $($azContext.Account)" -Level Verbose
Write-Message "Connected: $($azContext.Account)" -Level Info

if ($PSCmdlet.ShouldProcess("Setting Fabric authentication token and headers for $($azContext.Account)")) {
$ResourceUrl = Get-PSFConfigValue -FullName 'FabricTools.FabricApi.ResourceUrl'
Expand Down
Loading