https://pulumi.com logo
#azure
Title
# azure
f

famous-fall-51654

08/17/2023, 6:34 PM
Hi, I want to create a function app using pulumi+python. Does anyone use azure-native for that? I found web.webApp and web.webappfunction, but I do not know which one to use!. There is also appservice.FunctionApp in azure classic. Any suggestion or example is very welcome. Thanks
l

little-library-54601

08/17/2023, 6:45 PM
In C#, it's Web.WebApp where the "Kind" property is set to "FunctionApp". https://www.pulumi.com/registry/packages/azure-native/api-docs/web/webapp/
m

millions-journalist-34868

08/17/2023, 7:05 PM
I have a sample using azure native in C# here, even if you don't know C# you should be able to guess what you need to do in python.
f

famous-fall-51654

08/17/2023, 7:22 PM
Thank you so much!
Hi, I added a service place with kind="Linux" but the operating system is Windows when deployed, do I miss anything? I also want to add a new function key, where can I find the option? Thanks
m

millions-journalist-34868

08/18/2023, 2:39 PM
It seems weird but that's not something I tried. You could manually create your Linux Azure Function and see what code Pulumi generates when you import this resource in a stack. You could also check how people are doing it in Bicep/ARM, the properties are the same than with Pulumi Azure Native provider.
f

famous-fall-51654

08/18/2023, 5:11 PM
Hi @millions-journalist-34868, thanks a lot for the suggestion! I do not know that it is possible to generate a Pulumi code. I will give it a try :)
c

cuddly-napkin-89521

09/18/2023, 9:23 AM
@famous-fall-51654 if you still need help, please let me know, I created a few weeks ago.
Copy code
const dashboardServiceApp = new web.WebApp("web-dashboard-serviceapp-" + env, {
            name: "web-dashboard-serviceapp-" + env,
            resourceGroupName: resourceGroup.name,
            serverFarmId: dashbordServicePlan.id,
            httpsOnly: true,
            kind: "app,linux",
            tags: {
                env: "webapp-" + env,
                functionname: "web-dashboard-service-" + env,
            },

            siteConfig: {
                appSettings: [
                    { name: "AzureWebJobsStorage", value: dashboardConnString },
                    { name: "FUNCTIONS_WORKER_RUNTIME", value: "python" },
                    { name: "FUNCTIONS_EXTENSION_VERSION", value: "~4" },
                    { name: "XDG_CACHE_HOME", value: "/tmp/.cache" },
                    { name: "SCM_DO_BUILD_DURING_DEPLOYMENT", value: "1" },
                    { name: "WEBSITE_RUN_FROM_PACKAGE", value: "1" },
                    { name: "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING", value: dashboardConnString },
                    { name: "WEBSITE_CONTENTSHARE", value: "dashboard-service-" + env },
                    { name: "WEBSITES_PORT", value: "80" },
                    { name: "APPINSIGHTS_INSTRUMENTATIONKEY", value: appInsights.instrumentationKey },
                    { name: "APPLICATIONINSIGHTS_CONNECTION_STRING", value: appInsights.connectionString },
                ],
                appCommandLine: "python app/app.py",
                http20Enabled: true,
                linuxFxVersion: "PYTHON|3.9",
                ipSecurityRestrictions: [
                {
                    action: "Allow",
                    ipAddress: "some.ip.address/32",
                    name: "test",
                    priority: 320,
                },
                ],
                publicNetworkAccess: "Enabled",
                vnetRouteAllEnabled: true,
            },
        });
2 Views