in src/tree/SubscriptionTreeItem.ts [79:161]
public async createChildImpl(context: ICreateFunctionAppContext): Promise<AzExtTreeItem> {
const version: FuncVersion = await getDefaultFuncVersion(context);
context.telemetry.properties.projectRuntime = version;
const language: string | undefined = context.workspaceFolder ? getWorkspaceSetting(projectLanguageSetting, context.workspaceFolder) : getWorkspaceSettingFromAnyFolder(projectLanguageSetting);
context.telemetry.properties.projectLanguage = language;
const wizardContext: IFunctionAppWizardContext = Object.assign(context, this.subscription, {
newSiteKind: AppKind.functionapp,
resourceGroupDeferLocationStep: true,
version,
language
});
const promptSteps: AzureWizardPromptStep<IAppServiceWizardContext>[] = [];
const executeSteps: AzureWizardExecuteStep<IAppServiceWizardContext>[] = [];
promptSteps.push(new SiteNameStep());
promptSteps.push(new FunctionAppStackStep());
const storageAccountCreateOptions: INewStorageAccountDefaults = {
kind: StorageAccountKind.Storage,
performance: StorageAccountPerformance.Standard,
replication: StorageAccountReplication.LRS
};
if (version === FuncVersion.v1) { // v1 doesn't support linux
wizardContext.newSiteOS = WebsiteOS.windows;
}
if (!context.advancedCreation) {
LocationListStep.addStep(wizardContext, promptSteps);
wizardContext.useConsumptionPlan = true;
wizardContext.stackFilter = getRootFunctionsWorkerRuntime(language);
executeSteps.push(new ResourceGroupCreateStep());
executeSteps.push(new AppServicePlanCreateStep());
executeSteps.push(new StorageAccountCreateStep(storageAccountCreateOptions));
executeSteps.push(new AppInsightsCreateStep());
} else {
promptSteps.push(new ResourceGroupListStep());
CustomLocationListStep.addStep(wizardContext, promptSteps);
promptSteps.push(new FunctionAppHostingPlanStep());
promptSteps.push(new StorageAccountListStep(
storageAccountCreateOptions,
{
kind: [
StorageAccountKind.BlobStorage
],
performance: [
StorageAccountPerformance.Premium
],
replication: [
StorageAccountReplication.ZRS
],
learnMoreLink: 'https://aka.ms/Cfqnrc'
}
));
promptSteps.push(new AppInsightsListStep());
}
const storageProvider = 'Microsoft.Storage';
LocationListStep.addProviderForFiltering(wizardContext, storageProvider, 'storageAccounts');
executeSteps.push(new VerifyProvidersStep([webProvider, storageProvider, 'Microsoft.Insights']));
executeSteps.push(new FunctionAppCreateStep());
const title: string = localize('functionAppCreatingTitle', 'Create new Function App in Azure');
const wizard: AzureWizard<IAppServiceWizardContext> = new AzureWizard(wizardContext, { promptSteps, executeSteps, title });
await wizard.prompt();
context.showCreatingTreeItem(nonNullProp(wizardContext, 'newSiteName'));
if (!context.advancedCreation) {
const newName: string | undefined = await wizardContext.relatedNameTask;
if (!newName) {
throw new Error(localize('noUniqueName', 'Failed to generate unique name for resources. Use advanced creation to manually enter resource names.'));
}
wizardContext.newResourceGroupName = context.newResourceGroupName || newName;
setConsumptionPlanProperties(wizardContext);
wizardContext.newStorageAccountName = newName;
wizardContext.newAppInsightsName = newName;
}
await wizard.execute();
return new ProductionSlotTreeItem(this, new ParsedSite(nonNullProp(wizardContext, 'site'), this.subscription));
}