private async getFunctionappSettingsRbac()

in src/handlers/resourceValidator.ts [137:182]


    private async getFunctionappSettingsRbac(state: StateConstant, appService: AzureAppService): Promise<IAppSettings> {
        let appSettings: any;
        try {
            appSettings = await appService.getApplicationSettings(true);
        } catch (expt) {
            throw new AzureResourceError(
                state, 'Get Function App Settings',
                'Failed to acquire app settings from Azure Resource Manager (RBAC credential).', expt
            );
        }

        if (appSettings === undefined || appSettings.properties === undefined) {
            throw new AzureResourceError(
                state, 'Get Function App Settings',
                'Function app settings should not be empty (fetched from Azure Resource Manager with RBAC credential).'
            );
        }

        if (!appSettings.properties['AzureWebJobsStorage'] && !appSettings.properties['AzureWebJobsStorage__accountName']) {
            Logger.Warn(
                'Neither AzureWebJobsStorage nor AzureWebJobsStorage__accountName exist in app settings (from Azure Resource Manager with RBAC 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.properties['AzureWebJobsStorage']) {
            console.log(`::add-mask::${appSettings.properties['AzureWebJobsStorage']}`);
        }

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

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