in src/commands/createFunctionApp/FunctionAppCreateStep.ts [115:181]
private async getNewSiteConfig(context: IFunctionAppWizardContext, stack: FullFunctionAppStack): Promise<SiteModels.SiteConfig> {
const stackSettings: FunctionAppRuntimeSettings = nonNullProp(stack.minorVersion.stackSettings, context.newSiteOS === WebsiteOS.linux ? 'linuxRuntimeSettings' : 'windowsRuntimeSettings');
// https://github.com/microsoft/vscode-azurefunctions/issues/2990
if (context.newSiteOS === 'windows' && context.version === FuncVersion.v4) {
stackSettings.siteConfigPropertiesDictionary.netFrameworkVersion = 'v6.0'
}
const newSiteConfig: SiteModels.SiteConfig = stackSettings.siteConfigPropertiesDictionary;
const storageConnectionString: string = (await getStorageConnectionString(context)).connectionString;
const appSettings: SiteModels.NameValuePair[] = [
{
name: azureWebJobsStorageKey,
value: storageConnectionString
},
{
name: extensionVersionKey,
value: '~' + getMajorVersion(context.version)
},
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
...Object.entries(stackSettings.appSettingsDictionary).map(([name, value]) => { return { name, value }; })
];
// This setting only applies for v1 https://github.com/Microsoft/vscode-azurefunctions/issues/640
if (context.version === FuncVersion.v1) {
appSettings.push({
name: 'AzureWebJobsDashboard',
value: storageConnectionString
});
}
const isElasticPremium: boolean = context.plan?.sku?.family?.toLowerCase() === 'ep';
const isConsumption: boolean = context.plan?.sku?.family?.toLowerCase() === 'y';
if (isConsumption || isElasticPremium) {
// WEBSITE_CONTENT* settings are added for consumption/premium plans, but not dedicated
// https://github.com/microsoft/vscode-azurefunctions/issues/1702
appSettings.push({
name: contentConnectionStringKey,
value: storageConnectionString
});
appSettings.push({
name: contentShareKey,
value: getNewFileShareName(nonNullProp(context, 'newSiteName'))
});
}
// This setting is not required, but we will set it since it has many benefits https://docs.microsoft.com/en-us/azure/azure-functions/run-functions-from-deployment-package
// That being said, it doesn't work on v1 C# Script https://github.com/Microsoft/vscode-azurefunctions/issues/684
// It also doesn't apply for Linux
if (context.newSiteOS === WebsiteOS.windows && !(context.language === ProjectLanguage.CSharpScript && context.version === FuncVersion.v1)) {
appSettings.push({
name: runFromPackageKey,
value: '1'
});
}
if (context.appInsightsComponent) {
appSettings.push({
name: 'APPINSIGHTS_INSTRUMENTATIONKEY',
value: context.appInsightsComponent.instrumentationKey
});
}
newSiteConfig.appSettings = appSettings;
return newSiteConfig;
}