diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 4fc34d6a5..a50c39076 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -9,6 +9,7 @@ Release Notes * Event Grid: Add ServiceBus Queue and Topic as supported destinations * Functions: Support for 64 bits. * Functions: Add option to use managed Key Vault +* Functions: Add support for dotnet-isolated runtime (NET5) * KeyVault: Fix an issue with adding tags on main KeyVault builder. * ServiceBus: update namespace validation rules to follow [Microsoft documentation](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules#microsoftservicebus) * Storage: Add support for tables diff --git a/src/Farmer/Builders/Builders.Functions.fs b/src/Farmer/Builders/Builders.Functions.fs index bdb12aa5f..e07b7f6b4 100644 --- a/src/Farmer/Builders/Builders.Functions.fs +++ b/src/Farmer/Builders/Builders.Functions.fs @@ -12,7 +12,7 @@ open Farmer.Arm.KeyVault open Farmer.Arm.KeyVault.Vaults open System -type FunctionsRuntime = DotNet | Node | Java | Python +type FunctionsRuntime = DotNet | DotNetIsolated | Node | Java | Python type FunctionsExtensionVersion = V1 | V2 | V3 module private FunctionsConfig = @@ -142,6 +142,11 @@ type FunctionsConfig = | None -> () + let functionsRuntime = + match this.Runtime with + | DotNetIsolated -> "dotnet-isolated" + | DotNet -> "dotnet" + | other -> (string other).ToLower() { Name = this.Name ServicePlan = this.ServicePlanId Location = location @@ -149,7 +154,7 @@ type FunctionsConfig = Tags = this.Tags ConnectionStrings = Map.empty AppSettings = [ - "FUNCTIONS_WORKER_RUNTIME", (string this.Runtime).ToLower() + "FUNCTIONS_WORKER_RUNTIME", functionsRuntime "WEBSITE_NODE_DEFAULT_VERSION", "10.14.1" "FUNCTIONS_EXTENSION_VERSION", match this.ExtensionVersion with V1 -> "~1" | V2 -> "~2" | V3 -> "~3" "AzureWebJobsStorage", StorageAccount.getConnectionString this.StorageAccountName |> ArmExpression.Eval diff --git a/src/Tests/Functions.fs b/src/Tests/Functions.fs index 73d92f97c..9df21fdfd 100644 --- a/src/Tests/Functions.fs +++ b/src/Tests/Functions.fs @@ -106,4 +106,11 @@ let tests = testList "Functions tests" [ Expect.equal secrets.[1].Value (ExpressionSecret sa.Key) "Incorrect secret value" Expect.sequenceEqual secrets.[1].Dependencies [ vaults.resourceId "testfuncvault"; storageAccounts.resourceId "teststorage" ] "Incorrect secret dependencies" } + + test "Supports dotnet-isolated runtime" { + let f = functions { use_runtime (FunctionsRuntime.DotNetIsolated) } + let resources = (f :> IBuilder).BuildResources Location.WestEurope + let site = resources.[0] :?> Web.Site + Expect.equal site.AppSettings.["FUNCTIONS_WORKER_RUNTIME"] (LiteralSetting "dotnet-isolated") "Should use dotnet-isolated functions runtime" + } ] \ No newline at end of file