in src/tree/SubscriptionTreeItem.ts [69:135]
public async createChildImpl(context: ICreateChildImplContext): Promise<AzExtTreeItem> {
const wizardContext: IWebAppWizardContext = Object.assign(context, this.subscription, {
newSiteKind: AppKind.app,
resourceGroupDeferLocationStep: true
});
await setPrePromptDefaults(wizardContext);
const promptSteps: AzureWizardPromptStep<IWebAppWizardContext>[] = [];
const executeSteps: AzureWizardExecuteStep<IWebAppWizardContext>[] = [];
const siteStep: SiteNameStep = new SiteNameStep();
promptSteps.push(siteStep);
if (context.advancedCreation) {
promptSteps.push(new ResourceGroupListStep());
promptSteps.push(new WebAppStackStep());
CustomLocationListStep.addStep(wizardContext, promptSteps);
promptSteps.push(new AppServicePlanListStep());
promptSteps.push(new AppInsightsListStep());
} else {
promptSteps.push(new WebAppStackStep());
promptSteps.push(new AppServicePlanSkuStep());
LocationListStep.addStep(wizardContext, promptSteps);
executeSteps.push(new ResourceGroupCreateStep());
executeSteps.push(new AppServicePlanCreateStep());
executeSteps.push(new AppInsightsCreateStep());
}
executeSteps.push(new VerifyProvidersStep([webProvider, 'Microsoft.Insights']));
executeSteps.push(new WebAppCreateStep());
if (wizardContext.newSiteOS !== undefined) {
await setLocationsTask(wizardContext);
}
const title: string = localize('createApp', 'Create new web app');
const wizard: AzureWizard<IWebAppWizardContext> = new AzureWizard(wizardContext, { promptSteps, executeSteps, title });
await wizard.prompt();
context.showCreatingTreeItem(nonNullProp(wizardContext, 'newSiteName'));
if (!context.advancedCreation) {
await setPostPromptDefaults(wizardContext, siteStep);
wizardContext.newAppInsightsName = await wizardContext.relatedNameTask;
if (!wizardContext.newAppInsightsName) {
throw new Error(localize('uniqueNameError', 'Failed to generate unique name for resources. Use advanced creation to manually enter resource names.'));
}
}
await wizard.execute();
const rawSite: WebSiteManagementModels.Site = nonNullProp(wizardContext, 'site');
// site is set as a result of SiteCreateStep.execute()
const site = new ParsedSite(rawSite, wizardContext);
ext.outputChannel.appendLog(getCreatedWebAppMessage(site));
const newNode: WebAppTreeItem = new WebAppTreeItem(this, site);
try {
//enable HTTP & Application logs (only for windows) by default
await newNode.enableLogs(context);
} catch (error) {
// optional part of creating web app, so not worth blocking on error
context.telemetry.properties.fileLoggingError = parseError(error).message;
}
return newNode;
}