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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added `Refresh-FabricSQLEndpoint` to refresh SQL analytics endpoint metadata.
- Added `-SQLDatabaseName` (alias `Name`) to `Remove-FabricSQLDatabase`, requiring a unique exact name match within the specified workspace before deletion (#210).
- Added `WorkspaceName` (alias `Name`) to `Remove-FabricWorkspace` to delete a workspace by its exact display name, refusing deletion when no workspace or multiple workspaces match (issue #157).
- Added `Start-FabricNotebook` to run a notebook by ID or unique workspace-scoped name, wait for its job status by default, or return promptly with `-NoWait`. Supports `-WhatIf`, Retry-After polling, and execution failure details (#194).
Expand Down
4 changes: 4 additions & 0 deletions docs/en-US/FabricTools.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ Retrieves Fabric SQL Database details.

Retrieves SQL Endpoints from a specified workspace in Fabric.

### [Refresh-FabricSQLEndpoint](Refresh-FabricSQLEndpoint.md)

Refreshes the metadata of a SQL analytics endpoint.

### [Get-FabricTenantSetting](Get-FabricTenantSetting.md)

Retrieves tenant settings from the Fabric environment.
Expand Down
25 changes: 23 additions & 2 deletions docs/en-US/Get-FabricLongRunningOperation.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Monitors the status of a long-running operation in Microsoft Fabric.

```
Get-FabricLongRunningOperation [[-OperationId] <string>] [[-Location] <string>]
[[-RetryAfter] <int>] [<CommonParameters>]
[[-RetryAfter] <int>] [[-Timeout] <int>] [<CommonParameters>]
```

## ALIASES
Expand Down Expand Up @@ -109,6 +109,28 @@ AcceptedValues: []
HelpMessage: ''
```

### -Timeout

The maximum time, in minutes, to wait for the operation.
A value of 0 waits indefinitely.

```yaml
Type: System.Int32
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 3
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
Expand All @@ -127,4 +149,3 @@ Author: Tiago Balabuch
## RELATED LINKS

{{ Fill in the related links here }}

25 changes: 23 additions & 2 deletions docs/en-US/Invoke-FabricRestMethod.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Sends an HTTP request to a Fabric or Power BI API endpoint and retrieve the resp
Invoke-FabricRestMethod [-Uri] <string> [[-Method] <string>] [[-Body] <Object>]
[[-ExtractValue] <string>] [[-TypeName] <string>] [[-ObjectIdOrName] <string>]
[[-SuccessMessage] <string>] [-TestTokenExpired] [-PowerBIApi] [-NoWait] [-HandleResponse]
[<CommonParameters>]
[-Timeout <int>] [<CommonParameters>]
```

## ALIASES
Expand Down Expand Up @@ -263,6 +263,28 @@ AcceptedValues: []
HelpMessage: ''
```

### -Timeout

The maximum time, in minutes, to wait for a long-running operation.
A value of 0 waits indefinitely.

```yaml
Type: System.Int32
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

### -TypeName

Optional.
Expand Down Expand Up @@ -330,4 +352,3 @@ Author: Kamil Nowinski
## RELATED LINKS

{{ Fill in the related links here }}

132 changes: 132 additions & 0 deletions docs/en-US/Refresh-FabricSQLEndpoint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
---
document type: cmdlet
external help file: FabricTools-Help.xml
HelpUri: ''
Locale: en-US
Module Name: FabricTools
ms.date: 10/28/2026
title: Refresh-FabricSQLEndpoint
---

# Refresh-FabricSQLEndpoint

## SYNOPSIS

Refreshes the metadata of a SQL analytics endpoint.

## SYNTAX

```
Refresh-FabricSQLEndpoint [-WorkspaceId] <guid> [-SQLEndpointId] <guid> [[-Timeout] <int>]
[-NoWait] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION

Starts a refresh of the metadata for a SQL analytics endpoint in a specified workspace.
By default, the function waits for the long-running operation to complete.

## EXAMPLES

### EXAMPLE 1

```powershell
Refresh-FabricSQLEndpoint -WorkspaceId $workspaceId -SQLEndpointId $sqlEndpointId
```

## PARAMETERS

### -WorkspaceId

The ID of the workspace containing the SQL analytics endpoint.

```yaml
Type: System.Guid
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

### -SQLEndpointId

The ID of the SQL analytics endpoint to refresh.

```yaml
Type: System.Guid
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

### -Timeout

The maximum time, in minutes, to wait for the refresh operation. A value of 0 waits indefinitely.

```yaml
Type: System.Int32
DefaultValue: 15
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 2
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

### -NoWait

If specified, returns immediately after the refresh request is accepted.

```yaml
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

## NOTES

Author: Kamil Nowinski
18 changes: 16 additions & 2 deletions src/Private/Test-FabricApiResponse.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ function Test-FabricApiResponse {
.PARAMETER NoWait
If specified, the function will not wait for the operation to complete and will return immediately.

.PARAMETER Timeout
The maximum time, in minutes, to wait for a long-running operation. A value of 0 waits indefinitely.

.EXAMPLE
Test-FabricApiResponse -statusCode 201 -response $response -responseHeader $header -Name "MyResource" -typeName "Fabric Item"

Expand Down Expand Up @@ -78,7 +81,15 @@ function Test-FabricApiResponse {
[string] $SuccessMessage,

[Parameter(Mandatory = $false)]
[switch] $NoWait = $false
[switch] $NoWait = $false,

[Parameter(Mandatory = $false)]
[ValidateRange(0, [int]::MaxValue)]
[int] $Timeout = 0,

[Parameter(DontShow)]
[ValidateRange(0, [int]::MaxValue)]
[int] $TimeoutSeconds = 0
)

Write-Message -Message "::Begin" -Level Debug
Expand Down Expand Up @@ -117,7 +128,7 @@ function Test-FabricApiResponse {
Write-Message -Message "Operation ID: '$operationId'" -Level "Debug"
Write-Message -Message "Getting Long Running Operation status" -Level Debug

$operationStatus = Get-FabricLongRunningOperation -operationId $res.OperationId -location $res.Location -retryAfter $res.RetryAfter
$operationStatus = Get-FabricLongRunningOperation -operationId $operationId -location $res.Location -retryAfter $res.RetryAfter -Timeout $Timeout -TimeoutSeconds $TimeoutSeconds
Write-Message -Message "Long Running Operation status: $operationStatus" -Level Debug
# Handle operation result
if ($operationStatus.status -eq "Succeeded") {
Expand All @@ -140,6 +151,9 @@ function Test-FabricApiResponse {
$retryAfter = $responseHeader['Retry-After']
$retryAfterStr = $retryAfter[0].ToString()
$retryAfterInt = [int]$retryAfterStr
if ($TimeoutSeconds -gt 0) {
$retryAfterInt = [Math]::Min($retryAfterInt, $TimeoutSeconds)
}
Start-Sleep -Seconds $retryAfterInt
return "Command:Repeat"
}
Expand Down
43 changes: 43 additions & 0 deletions src/Public/Invoke-FabricRestMethod.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ Function Invoke-FabricRestMethod {
A switch parameter to indicate that the function should not wait for the response. This is useful for asynchronous operations.
Default is False. If set to True, the function will return immediately without waiting for the operation to complete.

.PARAMETER Timeout
The maximum time, in minutes, to wait for a long-running operation. A value of 0 waits indefinitely.

.PARAMETER RequestTimeoutSeconds
An internal request timeout, in seconds, used to keep long-running operation status requests within the remaining timeout budget.

.PARAMETER HandleResponse
A switch parameter to indicate that the response should be handled after call API. Default is False.
The operation will be processed based on the response status code and supports Throttling (429) and Long-Running Operations.
Expand Down Expand Up @@ -89,6 +95,14 @@ Function Invoke-FabricRestMethod {
[Parameter(Mandatory = $false)]
[switch] $NoWait = $false,

[Parameter(Mandatory = $false)]
[ValidateRange(0, [int]::MaxValue)]
[int] $Timeout = 0,

[Parameter(DontShow)]
[ValidateRange(0, [int]::MaxValue)]
[int] $RequestTimeoutSeconds = 0,

[Parameter(Mandatory = $false)]
[switch] $HandleResponse = $true,

Expand Down Expand Up @@ -165,6 +179,8 @@ Function Invoke-FabricRestMethod {

$continuationToken = $null
$repeat = $false
$timeoutBudgetSeconds = [long]$Timeout * 60
$timeoutStopwatch = if ($Timeout -gt 0) { [System.Diagnostics.Stopwatch]::StartNew() } else { $null }

do {
$apiEndpointUrl = $Uri
Expand All @@ -186,12 +202,33 @@ Function Invoke-FabricRestMethod {
StatusCodeVariable = "statusCode"
}

$requestTimeoutSeconds = $RequestTimeoutSeconds
if ($Timeout -gt 0) {
$remainingTimeoutSeconds = $timeoutBudgetSeconds - $timeoutStopwatch.Elapsed.TotalSeconds
if ($remainingTimeoutSeconds -le 0) {
throw "API request timed out after $Timeout minutes."
}
if ($requestTimeoutSeconds -eq 0 -or $remainingTimeoutSeconds -lt $requestTimeoutSeconds) {
$requestTimeoutSeconds = [Math]::Max(1, [Math]::Floor($remainingTimeoutSeconds))
}
}

if ($RequestTimeoutSeconds -gt 0) {
$request.TimeoutSec = [int][Math]::Min($requestTimeoutSeconds, [int]::MaxValue)
} elseif ($Timeout -gt 0) {
$request.TimeoutSec = [int][Math]::Min($requestTimeoutSeconds, [int]::MaxValue)
}

$response = Invoke-RestMethod @request

if ($null -eq $responseHeader) {
$responseHeader = @{}
}

if ($Timeout -gt 0 -and $timeoutStopwatch.Elapsed.TotalSeconds -ge $timeoutBudgetSeconds) {
throw "API request timed out after $Timeout minutes."
}

# Needed for backward compatibility, example: Get-FabricWorkspace
$script:statusCode = $statusCode
$script:responseHeader = $responseHeader
Expand All @@ -205,6 +242,12 @@ Function Invoke-FabricRestMethod {
ObjectIdOrName = $ObjectIdOrName
TypeName = $TypeName
NoWait = $NoWait
Timeout = $Timeout
TimeoutSeconds = if ($Timeout -gt 0) {
[int][Math]::Min([Math]::Max(1, [Math]::Floor($timeoutBudgetSeconds - $timeoutStopwatch.Elapsed.TotalSeconds)), [int]::MaxValue)
} else {
0
}
SuccessMessage = $SuccessMessage
}
$response = Test-FabricApiResponse @params
Expand Down
Loading
Loading