Skip to content

Commit

Permalink
bug fix on function app, elastic premium plan need WEBSITE_* settings (
Browse files Browse the repository at this point in the history
  • Loading branch information
weidongxu-microsoft authored Mar 4, 2021
1 parent c66a608 commit 0dfd2bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @ChenTanyi @weidongxu-microsoft @yungezz @xccc-msft
* @ChenTanyi @weidongxu-microsoft @yungezz
9 changes: 6 additions & 3 deletions src/ResourceManagement/AppService/FunctionAppImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace Microsoft.Azure.Management.AppService.Fluent
using System.IO;
using Microsoft.Azure.Management.Graph.RBAC.Fluent;
using System.Collections;
using System.Text.RegularExpressions;

/// <summary>
/// The implementation for FunctionApp.
Expand Down Expand Up @@ -138,10 +139,12 @@ public FunctionAppImpl WithNewConsumptionPlan()
}
else
{
AzureEnvironment environment = ResourceUtils.ExtractAzureEnvironment(Manager.RestClient) ?? AzureEnvironment.AzureGlobalCloud;
string endpointSuffix = Regex.Replace(environment.StorageEndpointSuffix ?? AzureEnvironment.AzureGlobalCloud.StorageEndpointSuffix, "^\\.*", "");
var servicePlanTask = Manager.AppServicePlans.GetByIdAsync(this.AppServicePlanId());
var keys = await storageAccountToSet.GetKeysAsync(cancellationToken);
var connectionString = string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}",
storageAccountToSet.Name, keys[0].Value);
var connectionString = string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1};EndpointSuffix={2}",
storageAccountToSet.Name, keys[0].Value, endpointSuffix);
AddAppSettingIfNotModified("AzureWebJobsStorage", connectionString);
AddAppSettingIfNotModified("AzureWebJobsDashboard", connectionString);
if (IsConsumptionAppServicePlan((await servicePlanTask)?.#Tier))
Expand Down Expand Up @@ -181,7 +184,7 @@ private bool IsConsumptionAppServicePlan(#Tier #Tier)
}

SkuDescription description = #Tier.SkuDescription;
return description.Tier.Equals("Dynamic", StringComparison.OrdinalIgnoreCase);
return description.Tier.Equals(SkuName.Dynamic.Value, StringComparison.OrdinalIgnoreCase) || description.Tier.Equals(SkuName.ElasticPremium.Value, StringComparison.OrdinalIgnoreCase);
}

public override async Task<IFunctionApp> CreateAsync(CancellationToken cancellationToken = default(CancellationToken), bool multiThreaded = true)
Expand Down

0 comments on commit 0dfd2bd

Please # to comment.