From 10cc69854d085d334cc9a33e65ce2d077a61790b Mon Sep 17 00:00:00 2001 From: Alexander Omelchuk Date: Thu, 21 Apr 2022 11:28:53 +0200 Subject: [PATCH] Make CLI update function runtime version to ~4 --- src/aggregator-cli/Instances/AggregatorInstances.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/aggregator-cli/Instances/AggregatorInstances.cs b/src/aggregator-cli/Instances/AggregatorInstances.cs index 74627a6..09708df 100644 --- a/src/aggregator-cli/Instances/AggregatorInstances.cs +++ b/src/aggregator-cli/Instances/AggregatorInstances.cs @@ -5,6 +5,7 @@ using System.Reflection; using System.Threading; using System.Threading.Tasks; +using Microsoft.Azure.Management.AppService.Fluent; using Microsoft.Azure.Management.Fluent; using Microsoft.Azure.Management.ResourceManager.Fluent; using Microsoft.Azure.Management.ResourceManager.Fluent.Models; @@ -371,15 +372,19 @@ private static async Task> UpdateDefaultFilesAsync(Fu private async Task ForceFunctionRuntimeVersionAsync(InstanceName instance, CancellationToken cancellationToken) { - const string TargetVersion = "~3"; - // Change V2 to V3 FUNCTIONS_EXTENSION_VERSION ~3 + const string TargetVersion = "~4"; + const string DotNetVersion = "v6.0"; + // Change V2/V3 to V4 FUNCTIONS_EXTENSION_VERSION ~4 var webFunctionApp = await GetWebApp(instance, cancellationToken); var currentAzureRuntimeVersion = webFunctionApp.GetAppSettings() .GetValueOrDefault("FUNCTIONS_EXTENSION_VERSION"); - if (currentAzureRuntimeVersion?.Value != TargetVersion) + var currentDotNetVersion = webFunctionApp.NetFrameworkVersion; + if (currentAzureRuntimeVersion?.Value != TargetVersion || + currentDotNetVersion?.Value != DotNetVersion) { webFunctionApp.Update() .WithAppSetting("FUNCTIONS_EXTENSION_VERSION", TargetVersion) + .WithNetFrameworkVersion(NetFrameworkVersion.Parse(DotNetVersion)) .Apply(); } }