private async getFunctionappSettingsScm()

in src/handlers/resourceValidator.ts [184:229]


    private async getFunctionappSettingsScm(state: StateConstant, kuduService: Kudu): Promise<IAppSettings> {
        let appSettings: any;
        try {
            appSettings = await kuduService.getAppSettings();
        } catch (expt) {
            throw new AzureResourceError(
                state, 'Get Function App Settings',
                'Failed to acquire app settings from https://<scmsite>/api/settings with publish-profile', expt
            );
        }

        if (appSettings === undefined) {
            throw new AzureResourceError(
                state, 'Get Function App Settings',
                'Function app settings should not be empty (fetched from Kudu SCM site with publish-profile credential).'
            );
        }

        if (!appSettings['AzureWebJobsStorage'] && !appSettings['AzureWebJobsStorage__accountName']) {
            Logger.Warn(
                'Neither AzureWebJobsStorage nor AzureWebJobsStorage__accountName exist in app settings (from Kudu SCM site with publish-profile credential). ' +
                'Please ensure one of them is configured as it is critical for function runtime. ' +
                'For more information, please visit the function app settings reference page: ' +
                'https://docs.microsoft.com/en-us/azure/azure-functions/functions-app-settings#azurewebjobsstorage'
            );
        } else if (appSettings['AzureWebJobsStorage']) {
            console.log(`::add-mask::${appSettings['AzureWebJobsStorage']}`);
        }

        Logger.Info('Successfully acquired app settings from function app (with SCM credential)!');
        for (const key in appSettings) {
            Logger.Debug(`- ${key} = ${appSettings[key]}`);
        }

        const result: IAppSettings = {
            AzureWebJobsStorage: appSettings['AzureWebJobsStorage'],
            AzureWebJobsStorage__accountName: appSettings['AzureWebJobsStorage__accountName'],
            FUNCTIONS_WORKER_RUNTIME: appSettings['FUNCTIONS_WORKER_RUNTIME'],
            ENABLE_ORYX_BUILD: appSettings['ENABLE_ORYX_BUILD'],
            SCM_DO_BUILD_DURING_DEPLOYMENT: appSettings['SCM_DO_BUILD_DURING_DEPLOYMENT'],
            WEBSITE_RUN_FROM_PACKAGE: appSettings['WEBSITE_RUN_FROM_PACKAGE'],
            WEBSITE_RUN_FROM_PACKAGE_BLOB_MI_RESOURCE_ID: appSettings['WEBSITE_RUN_FROM_PACKAGE_BLOB_MI_RESOURCE_ID'],
            SCM_RUN_FROM_PACKAGE: appSettings['SCM_RUN_FROM_PACKAGE']
        };
        return result
    }