message: Fix AuthorizationFailed Error with App Service - Basic Create
diff: *--------------------------------------------------------------------------------------------*/
  import { WebSiteManagementClient, WebSiteManagementMappers, WebSiteManagementModels } from '@azure/arm-appservice';
  -import { Progress } from 'vscode';
  -import { AzExtLocation, AzureWizardExecuteStep, LocationListStep } from 'vscode-azureextensionui';
  +import { MessageItem, Progress } from 'vscode';
  +import { AzExtLocation, AzureWizardExecuteStep, LocationListStep, parseError } from 'vscode-azureextensionui';
  +import { AppServicePlanListStep } from './AppServicePlanListStep';
  import { webProvider } from '../constants';
  import { ext } from '../extensionVariables';
  import { localize } from '../localize';
  @@ -28,6 +29,7 @@ export class AppServicePlanCreateStep extends AzureWizardExecuteStep<IAppService
  const createdAppServicePlan: string = localize('CreatedAppServicePlan', 'Successfully created App Service plan "{0}".', newPlanName);
  ext.outputChannel.appendLog(findingAppServicePlan);
  + try {
  const client: WebSiteManagementClient = await createWebSiteClient(wizardContext);
  const existingPlan: WebSiteManagementModels.AppServicePlan | undefined = await tryGetAppServicePlan(client, rgName, newPlanName);
  @@ -52,6 +54,27 @@ export class AppServicePlanCreateStep extends AzureWizardExecuteStep<IAppService
  });
  ext.outputChannel.appendLog(createdAppServicePlan);
  }
  + } catch (e) {
  + if (parseError(e).errorType === 'AuthorizationFailed') {
  + await this.selectExistingPrompt(wizardContext);
  + } else {
  + throw e;
  + }
  + }
  +
  +
  + }
  +
  + public async selectExistingPrompt(wizardContext: IAppServiceWizardContext): Promise<void> {
  + const message: string = localize('planForbidden', 'You do not have permission to create an app service plan in subscription "{0}".', wizardContext.subscriptionDisplayName);
  + const selectExisting: MessageItem = { title: localize('selectExisting', 'Select Existing') };
  + wizardContext.telemetry.properties.cancelStep = 'AspNoPermissions';
  + await wizardContext.ui.showWarningMessage(message, { modal: true }, selectExisting);
  +
  + wizardContext.telemetry.properties.cancelStep = undefined;
  + wizardContext.telemetry.properties.forbiddenResponse = 'SelectExistingAsp';
  + const step: AppServicePlanListStep = new AppServicePlanListStep(true /* suppressCreate */);
  + await step.prompt(wizardContext);
  }
  public shouldExecute(wizardContext: IAppServiceWizardContext): boolean {
  