Ócáid
Mar 17, 9 PM - Mar 21, 10 AM
Bí ar an tsraith meetup chun réitigh AI inscálaithe a thógáil bunaithe ar chásanna úsáide fíor-dhomhanda le forbróirí agus saineolaithe eile.
Cláraigh anoisNí thacaítear leis an mbrabhsálaí seo a thuilleadh.
Uasghrádú go Microsoft Edge chun leas a bhaint as na gnéithe is déanaí, nuashonruithe slándála, agus tacaíocht theicniúil.
The Durable Functions (DF) PowerShell SDK is now available, in preview, as a standalone package in the PowerShell Gallery: AzureFunctions.PowerShell.Durable.SDK
.
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.
Nóta
This package is currently in preview.
The previous DF SDK was built into the PowerShell language worker. This approach came with the benefit that Durable Functions apps could be authored out of the box for Azure Functions PowerShell users. However, it also came with various shortcomings:
By creating a standalone DF PowerShell SDK package, we're able to overcome these shortcomings. These are the benefits of utilizing this new standalone SDK package:
The built-in DF SDK in the PowerShell worker will remain available for PowerShell 7.4, 7.2, and prior releases.
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.
See this section to learn how to install and enable new standalone SDK in your existing app.
The standalone PowerShell SDK requires the following minimum versions:
The following application setting is required to run the standalone PowerShell SDK:
ExternalDurablePowerShellSDK
"true"
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.
If you're running locally using Azure Functions Core Tools, 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:
Replace <FUNCTION_APP_NAME>
and <RESOURCE_GROUP_NAME>
with the name of your function app and resource group, respectively.
az functionapp config appsettings set --name <FUNCTION_APP_NAME> --resource-group <RESOURCE_GROUP_NAME> --settings ExternalDurablePowerShellSDK="true"
You have two options for installing the SDK package: it can be installed using Managed Dependencies, or bundled with your app content. In this section, we describe both options, but only one of them is needed.
To install the SDK as a managed dependency, you'll need to follow the managed dependencies guidance. Please review the guidance for details.
In summary, you first need to ensure your host.json
contains a managedDependency
section with an enabled
property set to true
. Below is an example host.json
that satisfies this requirement:
{
"version": "2.0",
"managedDependency": {
"enabled": true
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.*, 4.0.0)"
},
}
Then you simply need to specify an entry for the DF SDK in your requirements.psd1
file, as in the example below:
# This file enables modules to be automatically managed by the Functions service.
# See https://aka.ms/functionsmanageddependency for additional information.
#
@{
# For latest supported version, go to 'https://www.powershellgallery.com/packages/AzureFunctions.PowerShell.Durable.SDK/'.
'AzureFunctions.PowerShell.Durable.SDK' = '1.*'
}
To install the standalone DF SDK as a custom module, you need to follow the guidance regarding including modules in app content. Make sure to review the aforementioned docs for details.
In summary, you'll need to place the SDK package inside a ".\Modules"
directory located at the root of your app.
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:
Save-Module -Name AzureFunctions.PowerShell.Durable.SDK -AllowPrerelease -Path ".\Modules"
The final step is importing the SDK into your code's session. To do this, import the PowerShell SDK via Import-Module AzureFunctions.PowerShell.Durable.SDK -ErrorAction Stop
in your profile.ps1
file.
For example, if your app was scaffolded through templates, your profile.ps1
file may end up looking as such:
# Azure Functions profile.ps1
#
# This profile.ps1 will get executed every "cold start" of your Function App.
# "cold start" occurs when:
#
# * A Function App starts up for the very first time
# * A Function App starts up after being de-allocated due to inactivity
#
# You can define helper functions, run commands, or specify environment variables
# NOTE: any variables defined that are not environment variables will get reset after the first execution
# Authenticate with Azure PowerShell using MSI.
# Remove this if you are not planning on using MSI or Azure PowerShell.
if ($env:MSI_SECRET) {
Disable-AzContextAutosave -Scope Process | Out-Null
Connect-AzAccount -Identity
}
# Uncomment the next line to enable legacy AzureRm alias in Azure PowerShell.
# Enable-AzureRmAlias
# You can also define functions or aliases that can be referenced in any of your PowerShell functions.
# Import standalone PowerShell SDK
Import-Module AzureFunctions.PowerShell.Durable.SDK -ErrorAction Stop
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.
In this section, we describe the interface and behavioral changes you can expect when utilizing the new SDK.
Invoke-DurableSubOrchestrator -FunctionName <Name> -Input <Input>
is a new CmdLet that allows users to utilize suborchestrators in their workflows.Get-DurableTaskResult -Task <task>
now only accepts a single Task as it's argument, instead of accepting a list of Tasks.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.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.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.
Ócáid
Mar 17, 9 PM - Mar 21, 10 AM
Bí ar an tsraith meetup chun réitigh AI inscálaithe a thógáil bunaithe ar chásanna úsáide fíor-dhomhanda le forbróirí agus saineolaithe eile.
Cláraigh anoisOiliúint
Modúl
Create a long-running serverless workflow with Durable Functions - Training
Learn how to orchestrate a long-running workflow as a set of activities using scalable and cost-effective Durable Functions.
Deimhniú
Microsoft Certified: Power Platform Developer Associate - Certifications
Demonstrate how to simplify, automate, and transform business tasks and processes using Microsoft Power Platform Developer.