diff --git a/extensions/azurePublish/src/node/azureResourceManager/azureResourceManager.ts b/extensions/azurePublish/src/node/azureResourceManager/azureResourceManager.ts index c4aaab0530..1982be277f 100644 --- a/extensions/azurePublish/src/node/azureResourceManager/azureResourceManager.ts +++ b/extensions/azurePublish/src/node/azureResourceManager/azureResourceManager.ts @@ -883,7 +883,7 @@ export class AzureResourceMananger { }, { name: 'FUNCTIONS_WORKER_RUNTIME', - value: 'dotnet', + value: config.workerRuntime || 'dotnet', }, { name: 'APPINSIGHTS_INSTRUMENTATIONKEY', diff --git a/extensions/azurePublish/src/node/azureResourceManager/azureResourceManagerConfig.ts b/extensions/azurePublish/src/node/azureResourceManager/azureResourceManagerConfig.ts index 5c84fc1325..628d8f6b9d 100644 --- a/extensions/azurePublish/src/node/azureResourceManager/azureResourceManagerConfig.ts +++ b/extensions/azurePublish/src/node/azureResourceManager/azureResourceManagerConfig.ts @@ -114,6 +114,11 @@ export interface AzureFunctionsConfig { appId?: string; appPwd?: string; instrumentationKey?: string; + /** + * The worker runtime language. + * Currently documented values: dotnet, node, java, python, or powershell + */ + workerRuntime?: string; } export interface DeploymentsConfig { diff --git a/extensions/azurePublish/src/node/index.ts b/extensions/azurePublish/src/node/index.ts index a3b87b9ecf..d2375931ae 100644 --- a/extensions/azurePublish/src/node/index.ts +++ b/extensions/azurePublish/src/node/index.ts @@ -274,10 +274,14 @@ export default async (composer: IExtensionRegistration): Promise => { /* These methods provision resources to azure async */ /*******************************************************************************************************************************/ asyncProvision = async (jobId: string, config: ProvisionConfig, project: IBotProject, user): Promise => { - const { subscription, name } = config; + const { runtimeLanguage } = parseRuntimeKey(project.settings?.runtime?.key); + const provisionConfig: ProvisionConfig = { ...config, workerRuntime: runtimeLanguage }; + + const { name } = provisionConfig; + // Create the object responsible for actually taking the provision actions. const azureProvisioner = new BotProjectProvision({ - ...config, + ...provisionConfig, logger: (msg: any) => { this.logger(msg); BackgroundProcessManager.updateProcess(jobId, 202, msg.message); @@ -287,26 +291,28 @@ export default async (composer: IExtensionRegistration): Promise => { // perform the provision using azureProvisioner.create. // this will start the process, then return. // However, the process will continue in the background - const provisionResults = await azureProvisioner.create(config); + const provisionResults = await azureProvisioner.create(provisionConfig); // cast this into the right form for a publish profile let currentProfile = null; - if (config.currentProfile) { - currentProfile = JSON.parse(config.currentProfile.configuration); + if (provisionConfig.currentProfile) { + currentProfile = JSON.parse(provisionConfig.currentProfile.configuration); } const currentSettings = currentProfile?.settings; const publishProfile = { - name: currentProfile?.name ?? config.hostname, + name: currentProfile?.name ?? provisionConfig.hostname, environment: currentProfile?.environment ?? 'composer', tenantId: provisionResults?.tenantId ?? currentProfile?.tenantId, subscriptionId: provisionResults.subscriptionId ?? currentProfile?.subscriptionId, resourceGroup: currentProfile?.resourceGroup ?? provisionResults.resourceGroup?.name, botName: currentProfile?.botName ?? provisionResults.botName, - hostname: config.hostname ?? currentProfile?.hostname, - luisResource: provisionResults.luisPrediction ? `${config.hostname}-luis` : currentProfile?.luisResource, + hostname: provisionConfig.hostname ?? currentProfile?.hostname, + luisResource: provisionResults.luisPrediction + ? `${provisionConfig.hostname}-luis` + : currentProfile?.luisResource, runtimeIdentifier: currentProfile?.runtimeIdentifier ?? 'win-x64', - region: config.location, + region: provisionConfig.location, settings: { applicationInsights: { InstrumentationKey: @@ -355,7 +361,7 @@ export default async (composer: IExtensionRegistration): Promise => { await this.persistProvisionHistory(jobId, name, provisionHistoryPath); // add in history - this.addProvisionHistory(project.id, config.name, BackgroundProcessManager.getStatus(jobId)); + this.addProvisionHistory(project.id, provisionConfig.name, BackgroundProcessManager.getStatus(jobId)); BackgroundProcessManager.removeProcess(jobId); }; diff --git a/extensions/azurePublish/src/node/provision.ts b/extensions/azurePublish/src/node/provision.ts index fb46fddfb8..93d405d797 100644 --- a/extensions/azurePublish/src/node/provision.ts +++ b/extensions/azurePublish/src/node/provision.ts @@ -23,6 +23,11 @@ export interface ProvisionConfig { logger?: (string) => any; name: string; // profile name type: string; // webapp or function + /** + * The worker runtime language for Azure functions. + * Currently documented values: dotnet, node, java, python, or powershell + */ + workerRuntime?: string; choice?: string; [key: string]: any; } @@ -326,6 +331,7 @@ export class BotProjectProvision { resourceGroupName: resourceGroupName, location: config.location ?? provisionResults.resourceGroup.location, name: config.hostname, + workerRuntime: config.workerRuntime, }); provisionResults.webApp = { hostname: functionsHostName,