Skip to content

Commit 3601207

Browse files
Merge pull request #301888 from AnatoliB/anatolib/standalone-durable-powershell-sdk-ga
Document standalone Durable PowerShell SDK as GA
2 parents ad35600 + c79cbfb commit 3601207

5 files changed

+115
-29
lines changed

articles/azure-functions/durable/durable-functions-instance-management.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ Resume-DurableOrchestration -InstanceId $InstanceId -Reason $ResumeReason
776776
```
777777

778778
> [!NOTE]
779-
> This change applies only to the standalone [Durable Functions PowerShell SDK](https://www.powershellgallery.com/packages/AzureFunctions.PowerShell.Durable.SDK), which is currently [in preview](durable-functions-powershell-v2-sdk-migration-guide.md).
779+
> This feature is available in the standalone [Durable Functions PowerShell SDK](https://www.powershellgallery.com/packages/AzureFunctions.PowerShell.Durable.SDK) only. See the difference between the standalone SDK and the legacy built-in SDK along with [migration guide](durable-functions-powershell-v2-sdk-migration-guide.md).
780780
781781
# [Java](#tab/java)
782782

articles/azure-functions/durable/durable-functions-packages.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ms.reviewer: azfuncdf
2020

2121
**Storage providers packages**:
2222

23-
By default, Durable Functions uses Azure Storage as it's backing store. However, alternative [storage providers](./durable-functions-storage-providers.md) are available as well. To use them, you need to reference their packages _in addition to_ the WebJobs extension in your `.csproj`. Those packages are:
23+
By default, Durable Functions uses Azure Storage as its backing store. However, alternative [storage providers](./durable-functions-storage-providers.md) are available as well. To use them, you need to reference their packages _in addition to_ the WebJobs extension in your `.csproj`. Those packages are:
2424

2525
* The Netherite storage provider: [Microsoft.Azure.DurableTask.Netherite.AzureFunctions](https://www.nuget.org/packages/Microsoft.Azure.DurableTask.Netherite.AzureFunctions).
2626
* The MSSQL storage provider: [Microsoft.DurableTask.SqlServer.AzureFunctions](https://www.nuget.org/packages/Microsoft.DurableTask.SqlServer.AzureFunctions)
@@ -52,10 +52,10 @@ Users of [Extension Bundles](../extension-bundles.md) (the recommended Azure Fun
5252
* Node (JavaScript / TypeScript): The [durable-functions](https://www.npmjs.com/package/durable-functions) npm package.
5353
* Python: The [azure-functions-durable](https://pypi.org/project/azure-functions-durable/) PyPI package.
5454
* Java: The [durabletask-azure-functions](https://mvnrepository.com/artifact/com.microsoft/durabletask-azure-functions) Maven package.
55-
* PowerShell: The current GA SDK is built in to Azure Functions PowerShell language worker, so no installation is needed. See the following _note_ for details.
55+
* PowerShell: The [AzureFunctions.PowerShell.Durable.SDK](https://www.powershellgallery.com/packages/AzureFunctions.PowerShell.Durable.SDK) module.
5656

5757
> [!NOTE]
58-
> For PowerShell users: we have a [_preview_ SDK standalone package](./durable-functions-powershell-v2-sdk-migration-guide.md) under [AzureFunctions.PowerShell.Durable.SDK](https://www.powershellgallery.com/packages/AzureFunctions.PowerShell.Durable.SDK) in the PowerShell gallery. The latter will be preferred in the future.
58+
> For PowerShell users: the standalone [AzureFunctions.PowerShell.Durable.SDK](https://www.powershellgallery.com/packages/AzureFunctions.PowerShell.Durable.SDK) module is now generally available (GA) and is recommended over the legacy SDK that is built into the Azure Functions PowerShell language worker. Going forward, the legacy SDK may not receive new features or bug fixes, and may eventually be removed from the worker. See [migration guide](./durable-functions-powershell-v2-sdk-migration-guide.md) for details on migrating to the standalone SDK.
5959
6060
## GitHub repositories
6161

articles/azure-functions/durable/durable-functions-powershell-v2-sdk-migration-guide.md

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ ms.reviewer: azfuncdf
99

1010
# Guide to the standalone Durable Functions PowerShell SDK
1111

12-
The Durable Functions (DF) PowerShell SDK is now available, _in preview_, as a standalone package in the PowerShell Gallery: [`AzureFunctions.PowerShell.Durable.SDK`](https://www.powershellgallery.com/packages/AzureFunctions.PowerShell.Durable.SDK).
13-
Once this SDK package is GA, it will be the recommended means of authoring Durable Functions apps with PowerShell. In this article, we explain the benefits of this change, and what changes you can expect when adopting this new package.
14-
15-
> [!NOTE]
16-
> This package is currently in **preview.**
12+
The Durable Functions (DF) PowerShell SDK is now available as a standalone module in the PowerShell Gallery: [`AzureFunctions.PowerShell.Durable.SDK`](https://www.powershellgallery.com/packages/AzureFunctions.PowerShell.Durable.SDK).
13+
This SDK is now **generally available (GA)** and is the recommended approach for authoring Durable Functions apps with PowerShell. In this article, we explain the benefits of this change, and what changes you can expect when adopting this new package.
1714

1815
## Motivation behind the standalone SDK
1916

@@ -30,7 +27,7 @@ By creating a standalone DF PowerShell SDK package, we're able to overcome these
3027

3128
## Deprecation plan for the built-in DF PowerShell SDK
3229

33-
The built-in DF SDK in the PowerShell worker will remain available for PowerShell 7.4, 7.2, and prior releases.
30+
The built-in DF SDK in the PowerShell worker will remain available for PowerShell 7.4 and prior releases.
3431

3532
We plan to eventually release a new **major** version of the PowerShell worker without the built-in SDK. At that point, users would need to install the SDK separately using this standalone package; the installation steps are described below.
3633

@@ -44,7 +41,7 @@ The standalone PowerShell SDK requires the following minimum versions:
4441

4542
- [Azure Functions Runtime](../functions-versions.md) v4.16+
4643
- [Azure Functions Core Tools](../functions-run-local.md) v4.0.5095+ (if running locally)
47-
- Azure Functions PowerShell app for PowerShell 7.2 or greater
44+
- Azure Functions PowerShell app for PowerShell 7.4 or greater
4845

4946

5047
### Opt in to the standalone DF SDK
@@ -53,7 +50,7 @@ The following application setting is required to run the standalone PowerShell S
5350
- Name: `ExternalDurablePowerShellSDK`
5451
- Value: `"true"`
5552

56-
This application setting will disable the built-in Durable SDK for PowerShell versions 7.2 and above, forcing the worker to use the external SDK.
53+
This application setting will disable the built-in Durable SDK for PowerShell versions 7.4 and above, forcing the worker to use the external SDK.
5754

5855
If you're running locally using [Azure Functions Core Tools](../functions-run-local.md), you should add this setting to your `local.settings.json` file. If you're running in Azure, follow these steps with the tool of your choice:
5956

@@ -113,13 +110,13 @@ Then you simply need to specify an entry for the DF SDK in your `requirements.ps
113110
#
114111
@{
115112
# For latest supported version, go to 'https://www.powershellgallery.com/packages/AzureFunctions.PowerShell.Durable.SDK/'.
116-
'AzureFunctions.PowerShell.Durable.SDK' = '1.*'
113+
'AzureFunctions.PowerShell.Durable.SDK' = '2.*'
117114
}
118115
```
119116

120-
#### Installation option 2: Use custom modules
117+
#### Installation option 2: Include the SDK module in your app content
121118

122-
To install the standalone DF SDK as a custom module, you need to follow the [guidance regarding including modules in app content](./../functions-reference-powershell.md#including-modules-in-app-content). Make sure to review the aforementioned docs for details.
119+
To include the standalone DF SDK in your app content, you need to follow the [guidance regarding including modules in app content](./../functions-reference-powershell.md#including-modules-in-app-content). Make sure to review the aforementioned docs for details.
123120
In summary, you'll need to place the SDK package inside a `".\Modules"` directory located at the root of your app.
124121

125122
For example, from within your application's root, and after creating a `".\Modules"` directory, you may download the standalone SDK into the modules directory as such:
@@ -163,23 +160,41 @@ Import-Module AzureFunctions.PowerShell.Durable.SDK -ErrorAction Stop
163160

164161
These are all the steps needed to utilize the next PowerShell SDK. Run your app as normal, via `func host start` in your terminal to start using the SDK.
165162

163+
### SDK reference
164+
165+
See [AzureFunctions.PowerShell.Durable.SDK Module](https://github.com/Azure/azure-functions-durable-powershell/blob/main/src/Help/AzureFunctions.PowerShell.Durable.SDK.md) for the complete reference of the SDK cmdlets and their parameters.
166+
167+
You can also use the `Get-Help` cmdlet to get detailed descriptions of the SDK cmdlets. In order to do this, you need to import the module first, as shown in the previous section. After that, you can run the following command to get the entire list of cmdlets:
168+
169+
```powershell
170+
Get-Help *-Durable*
171+
```
172+
173+
In order to get detailed help on a specific cmdlet, including usage examples, run:
174+
175+
```powershell
176+
Get-Help Invoke-DurableOrchestration -Full
177+
```
178+
166179
### Migration guide
167180

168181
In this section, we describe the interface and behavioral changes you can expect when utilizing the new SDK.
169182

170-
#### New CmdLets
183+
#### New cmdlets
171184

172-
* `Invoke-DurableSubOrchestrator -FunctionName <Name> -Input <Input>` is a new CmdLet that allows users to utilize suborchestrators in their workflows.
185+
* `Invoke-DurableSubOrchestrator` is a new cmdlet that allows users to utilize suborchestrators in their workflows.
186+
* `Suspend-DurableOrchestration` and `Resume-DurableOrchestration` are new cmdlets that allow users to suspend and resume orchestrations, respectively.
173187

174-
#### Modified CmdLets
188+
#### Modified cmdlets
175189

176-
* The CmdLet `Get-DurableTaskResult -Task <task>` now only accepts a single Task as it's argument, instead of accepting a list of Tasks.
190+
* The `Get-DurableTaskResult` cmdlet now only accepts a single Task as it's argument, instead of accepting a list of Tasks.
191+
* The `New-DurableRetryOptions` cmdlet is renamed to `New-DurableRetryPolicy` (an alias for the old name is provided for backward compatibility).
177192

178193
#### Behavioral changes
179194

180-
* Exceptions thrown by activities scheduled with `Wait-DurableTask` (as in the Fan-Out/Fan-In pattern) are no longer silently ignored. Instead, on an exception, the CmdLet propagates that exception to the orchestrator so that it may be handled by user-code.
195+
* Exceptions thrown by activities scheduled with `Wait-DurableTask` (as in the Fan-Out/Fan-In pattern) are no longer silently ignored. Instead, on an exception, the cmdlet propagates that exception to the orchestrator so that it may be handled by user-code.
181196
* Null values are no longer dropped from the result list of a `Wait-DurableTask` (i.e., WhenAll) invocation. This means that a successful invocation of `Wait-DurableTask` without the `-Any` flag should return an array of the same size as the number of tasks it scheduled.
182197

183-
#### Where to get support, provide feedback, and suggest changes
198+
### Get support and provide feedbsck
184199

185-
During the preview phase of this release, the standalone SDK may introduce a few more changes. These changes can be influenced by the community so report any feedback and suggestions to the SDK's [_new GitHub repo_](https://github.com/Azure/azure-functions-durable-powershell).
200+
Please report any feedback and suggestions to the SDK's [_GitHub repo_](https://github.com/Azure/azure-functions-durable-powershell).

articles/azure-functions/durable/durable-functions-sub-orchestrations.md

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ An orchestrator function can call another orchestrator function using the *"call
1616
Sub-orchestrator functions behave just like activity functions from the caller's perspective. They can return a value and throw an exception as the parent orchestrator function anticipates them.
1717

1818
> [!NOTE]
19-
> Sub-orchestrations aren't yet supported in PowerShell.
20-
19+
> In PowerShell, sub-orchestrations are supported in the standalone SDK only: [`AzureFunctions.PowerShell.Durable.SDK`](https://www.powershellgallery.com/packages/AzureFunctions.PowerShell.Durable.SDK). See the difference between the standalone SDK and the legacy built-in SDK along with [migration guide](durable-functions-powershell-v2-sdk-migration-guide.md).
20+
2121
[!INCLUDE [functions-nodejs-durable-model-description](../../../includes/functions-nodejs-durable-model-description.md)]
2222

2323
## Example
@@ -147,6 +147,29 @@ public void deviceProvisioningOrchestration(
147147
}
148148
```
149149

150+
# [PowerShell](#tab/powershell)
151+
152+
```powershell
153+
param($Context)
154+
155+
$deviceId = $Context.Input
156+
157+
# Step 1: Create an installation package in blob storage and return a SAS URL.
158+
$sasUrl = Invoke-DurableActivity -FunctionName "CreateInstallationPackage" -Input $deviceId
159+
160+
# Step 2: Notify the device that the installation package is ready.
161+
$deviceInfo = @{
162+
id = $deviceId
163+
url = $sasUrl
164+
}
165+
Invoke-DurableActivity -FunctionName "SendPackageUrlToDevice" -Input $deviceInfo
166+
167+
# Step 3: Wait for the device to acknowledge that it has downloaded the new package.
168+
Start-DurableExternalEventListener -EventName "DownloadCompletedAck"
169+
170+
# Step 4: ...
171+
```
172+
150173
---
151174

152175
This orchestrator function can be used as-is for one-off device provisioning or it can be part of a larger orchestration. In the latter case, the parent orchestrator function can schedule instances of `DeviceProvisioningOrchestration` using the *"call-sub-orchestrator"* API.
@@ -296,6 +319,31 @@ public void provisionNewDevices(
296319
}
297320
```
298321

322+
# [PowerShell](#tab/powershell)
323+
324+
```powershell
325+
param($Context)
326+
327+
$deviceIds = Invoke-DurableActivity -FunctionName "GetNewDeviceIds"
328+
329+
# Run multiple device provisioning flows in parallel
330+
$provisioningTasks = @()
331+
for ($i = 0; $i -lt $deviceIds.Count; $i++) {
332+
$deviceId = $deviceIds[$i]
333+
$childId = "$($Context.InstanceId):$i"
334+
$provisionTask = Invoke-DurableSubOrchestrator `
335+
-FunctionName "DeviceProvisioningOrchestration" `
336+
-Input $deviceId `
337+
-InstanceId $childId `
338+
-NoWait
339+
$provisioningTasks += $provisionTask
340+
}
341+
342+
Wait-DurableTask -Task $provisioningTasks
343+
344+
# ...
345+
```
346+
299347
---
300348

301349
> [!NOTE]

articles/azure-functions/durable/quickstart-powershell-vscode.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,42 @@ Visual Studio Code installs Azure Functions Core Tools if it's required to creat
5656

5757
A *package.json* file is also created in the root folder.
5858

59-
### Configure the function app to use PowerShell 7
59+
### Configure the function app to use PowerShell 7.4 and the standalone Durable Functions SDK
6060

61-
Open the *local.settings.json* file and confirm that a setting named `FUNCTIONS_WORKER_RUNTIME_VERSION` is set to `~7`. If it's missing or if it's set to another value, update the contents of the file.
61+
Open the *local.settings.json* file and confirm that a setting named `FUNCTIONS_WORKER_RUNTIME_VERSION` is set to `7.4` and a setting named `ExternalDurablePowerShellSDK` is set to `true`. If they are missing or if they are set to other values, update the contents of the file.
6262

6363
```json
6464
{
6565
"IsEncrypted": false,
6666
"Values": {
6767
"AzureWebJobsStorage": "",
6868
"FUNCTIONS_WORKER_RUNTIME": "powershell",
69-
"FUNCTIONS_WORKER_RUNTIME_VERSION" : "~7"
69+
"FUNCTIONS_WORKER_RUNTIME_VERSION" : "7.4",
70+
"ExternalDurablePowerShellSDK": "true"
7071
}
7172
}
7273
```
7374

75+
Next, specify an entry for the DF SDK in your `requirements.psd1` file, as in the example below:
76+
77+
```PowerShell
78+
# This file enables modules to be automatically managed by the Functions service.
79+
# See https://aka.ms/functionsmanageddependency for additional information.
80+
#
81+
@{
82+
# For latest supported version, go to 'https://www.powershellgallery.com/packages/AzureFunctions.PowerShell.Durable.SDK/'.
83+
'AzureFunctions.PowerShell.Durable.SDK' = '2.*'
84+
}
85+
```
86+
87+
Make sure you use the latest version of the [AzureFunctions.PowerShell.Durable.SDK](https://www.powershellgallery.com/packages/AzureFunctions.PowerShell.Durable.SDK) module. The `2.*` version specifier ensures you get the latest stable 2.x version.
88+
89+
Add the following line to your `profile.ps1` file (typically, at the end of the file):
90+
91+
```PowerShell
92+
Import-Module AzureFunctions.PowerShell.Durable.SDK -ErrorAction Stop
93+
```
94+
7495
## Create your functions
7596

7697
The most basic Durable Functions app has three functions:
@@ -127,8 +148,8 @@ You added an HTTP-triggered function that starts an orchestration. Open *HttpSta
127148

128149
You now have a Durable Functions app that you can run locally and deploy to Azure.
129150

130-
> [!NOTE]
131-
> The next version of the Durable Functions PowerShell application is now in preview. You can download it from the PowerShell Gallery. Learn more about it and learn how to try it out in the [guide to the standalone PowerShell SDK](./durable-functions-powershell-v2-sdk-migration-guide.md). You can follow the guide's [installation section](./durable-functions-powershell-v2-sdk-migration-guide.md#install-and-enable-the-sdk) for instructions that are compatible with this quickstart to enable it.
151+
> [!TIP]
152+
> This quickstart uses the standalone Durable Functions PowerShell SDK, which is now generally available and provides the best performance and latest features. For more information about the SDK and migration from the legacy built-in version, see the [standalone PowerShell SDK guide](./durable-functions-powershell-v2-sdk-migration-guide.md).
132153
133154
## Test the function locally
134155

@@ -194,6 +215,8 @@ After you verify that the function runs correctly on your local computer, it's t
194215

195216
## Test your function in Azure
196217

218+
1. Make sure the app setting named `ExternalDurablePowerShellSDK` is set to `true`.
219+
197220
1. Copy the URL of the HTTP trigger from the output panel. The URL that calls your HTTP-triggered function should be in this format:
198221

199222
`https://<functionappname>.azurewebsites.net/api/orchestrators/HelloOrchestrator`

0 commit comments

Comments
 (0)