I'm having some trouble with a Function App I'm tr...
# azure
s
I'm having some trouble with a Function App I'm trying to create. The Function App is created, but AlwaysOn is not enabled on it. This is the code I use to create the Function App:
Copy code
const defaultfunctionAppArgs = {
            name: name,
            resourceGroupName: args.resourcegroupname,
            serverFarmId: args.WebAppPlanID,
            kind: "functionapp,linux",
            isDisabled: false,
            linuxFxVersion: 'Python|3.9',
            alwaysOn: true,
            use32BitWorkerProcess: false,
            siteConfig: {
                appSettings: [
                    {
                        name: 'FUNCTIONS_WORKER_RUNTIME',
                        value: 'python'
                    },
                    {
                        name: 'FUNCTIONS_EXTENSION_VERSION',
                        value: '~4'
                    },
                    {
                        name: 'APPINSIGHTS_INSTRUMENTATIONKEY',
                        value: appinsightscomponent.instrumentationKey
                    },
                    {
                        name: 'AzureWebJobsStorage',
                        value: storageConnectionString
                    },
                    {
                        name: "WEBSITE_RUN_FROM_PACKAGE",
                        value: codeBlobUrl
                    },
                    {
                        name: 'WORKSPACE_ID',
                        value: args.wrkspaceid
                    },
                ]
            },
        };
        const functionAppArgs = FunctionAppModifier ? FunctionAppModifier(defaultfunctionAppArgs) : defaultfunctionAppArgs;
        const functionapp = new web.WebApp("Policycompliance-webapp", functionAppArgs, { deleteBeforeReplace: true });
This is a screenshot of the General Settings of the Function App after it is created:
This might be related to the python version not being set as it should?
Found the problem. The siteConfig was misplaced The code should be like this:
Copy code
const defaultfunctionAppArgs = {
            name: name,
            resourceGroupName: args.resourcegroupname,
            serverFarmId: args.WebAppPlanID,
            kind: "functionapp,linux",
            siteConfig: {
                linuxFxVersion: 'PYTHON|3.9',
                alwaysOn: true,
                use32BitWorkerProcess: false,
                isDisabled: false,
                appSettings: [
                    {
                        name: 'FUNCTIONS_WORKER_RUNTIME',
                        value: 'python'
                    },
                    {
                        name: 'FUNCTIONS_EXTENSION_VERSION',
                        value: '~4'
                    },
                    {
                        name: 'APPINSIGHTS_INSTRUMENTATIONKEY',
                        value: appinsightscomponent.instrumentationKey
                    },
                    {
                        name: 'AzureWebJobsStorage',
                        value: storageConnectionString
                    },
                    {
                        name: "WEBSITE_RUN_FROM_PACKAGE",
                        value: codeBlobUrl
                    },
                    {
                        name: 'WORKSPACE_ID',
                        value: args.wrkspaceid
                    },
                ]
            },
        };
        const functionAppArgs = FunctionAppModifier ? FunctionAppModifier(defaultfunctionAppArgs) : defaultfunctionAppArgs;
        const functionapp = new web.WebApp("Policycompliance-webapp", functionAppArgs, { deleteBeforeReplace: true });
👍 1