diff --git a/source/Private/Confirm-TokenState.ps1 b/source/Private/Confirm-TokenState.ps1 index e89fdb5..d08fc07 100644 --- a/source/Private/Confirm-TokenState.ps1 +++ b/source/Private/Confirm-TokenState.ps1 @@ -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 diff --git a/source/Private/Set-FabConfig.ps1 b/source/Private/Set-FabConfig.ps1 index 8cc16b7..341cfe4 100644 --- a/source/Private/Set-FabConfig.ps1 +++ b/source/Private/Set-FabConfig.ps1 @@ -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' diff --git a/source/Public/Capacity/Get-FabricCapacityState.ps1 b/source/Public/Capacity/Get-FabricCapacityState.ps1 index 182ad89..8b805bd 100644 --- a/source/Public/Capacity/Get-FabricCapacityState.ps1 +++ b/source/Public/Capacity/Get-FabricCapacityState.ps1 @@ -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 @@ -36,9 +36,9 @@ 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 ) @@ -46,10 +46,11 @@ Author: Ioana Bouariu 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 } diff --git a/source/Public/Capacity/Resume-FabricCapacity.ps1 b/source/Public/Capacity/Resume-FabricCapacity.ps1 index 6d58141..6ec812a 100644 --- a/source/Public/Capacity/Resume-FabricCapacity.ps1 +++ b/source/Public/Capacity/Resume-FabricCapacity.ps1 @@ -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 @@ -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 } } diff --git a/source/Public/Capacity/Suspend-FabricCapacity.ps1 b/source/Public/Capacity/Suspend-FabricCapacity.ps1 index efa0991..af5a0bf 100644 --- a/source/Public/Capacity/Suspend-FabricCapacity.ps1 +++ b/source/Public/Capacity/Suspend-FabricCapacity.ps1 @@ -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 } } diff --git a/source/Public/Connect-FabricAccount.ps1 b/source/Public/Connect-FabricAccount.ps1 index c68c785..9c776f0 100644 --- a/source/Public/Connect-FabricAccount.ps1 +++ b/source/Public/Connect-FabricAccount.ps1 @@ -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'