https://pulumi.com logo
Title
l

little-library-54601

04/11/2023, 3:26 PM
Questions about Azure Functions. I've looked at this example: https://github.com/pulumi/examples/tree/master/azure-cs-functions. And I've read the API docs corresponding to the example's "WebApp" type at: https://www.pulumi.com/registry/packages/azure-native/api-docs/web/webapp/. I've also tried to find some more detailed examples, but the few things I can find seem to be relying on an older version of Pulumi's support for Azure Functions ("FunctionApp" ??). 1. Is "Azure Native" the correct, current provider that I should be using? Note that I've used a lot of Azure Native types for other Azure resources, so I'm fine with Azure Native. I just want to make sure I'm starting in the right place for Azure Functions. 2. Is "WebApp" the correct type from Azure Native for creating an Azure Function. The example seems clear, but I see a "WebAppFunction" in the API docs. Its documentation is pretty bare, so it's not clear what its purpose is. 3. Assuming "WebApp" is the correct type, are there more exhaustive docs or examples on using it specifically for Azure Functions. It looks like I have to set the "Kind" property, but I don't see a list of valid values for "Kind". Same with values for the "FUNCTIONS_WORKER_RUNTIME" app setting. Related to #3, this is an example of the biggest challenge I find in using Pulumi: simplistic examples coupled with incomplete documentation (at least in my view). My approach to overcoming those challenges typically involves manually creating the kind of resource I want within the Azure portal and then looking at the ARM template that the portal will generate or using "pulumi import" into a temporary stack to try to deduce valid values for properties I know about or figuring out properties that I need to be sure to set though they aren't used in the examples. Obviously, that's a very tedious way to have to go about writing the Pulumi program. If I'm missing anything that's out there that I can refer to, I'd appreciate pointers. Thank you.
b

bored-activity-40468

04/11/2023, 3:59 PM
1. yes, 2. yes, this is C# but you get the idea. I find github works great for finding examples. I'll search github for
Pulumi WebApp FunctionApp
for example.
LinuxFxVersion = "DOTNET-ISOLATED|7.0"
is required for .NET7 / Linux
m

millions-journalist-34868

04/12/2023, 1:47 PM
In case you are interested I did a example a while ago with C# and Azure Native : https://github.com/TechWatching/AzureFunctionSQLBindings/blob/main/eng/infra/Components/Function.cs
l

little-library-54601

04/12/2023, 1:55 PM
Thanks @millions-journalist-34868. That's helpful. And thanks @bored-activity-40468 for your replies, too.
Best I can tell, neither respondent is affiliated with Pulumi (forgive me if I've got that wrong). I'm wondering if someone with Pulumi might be willing to reply, in particular to my final comments that begin with "Related to #3..." Thanks again.
@bored-activity-40468 @millions-journalist-34868 or anyone else that might weigh in... These aren't strictly Pulumi questions, but in trying to map Pulumi examples to Azure capabilities and options for functions... • Under what circumstances is WEBSITE_RUN_FROM_PACKAGE required? Always for linux? I've seen Windows functions (more precisely: Windows app service plans for the function) without that app setting. But I don't think I've seen any linux functions without it. • Does the existence/nonexistence of that setting affect actual deployment of function code (C#/dotnet for us)? It will be from github actions. Does the appropriate action just do the right thing based on whether or not that setting is set? Thanks.
m

millions-journalist-34868

04/18/2023, 6:59 PM
I don't think it's required at all. It only is if you want your function app to run from a package which is the recommended way. When you do that you have to use zip deploy method to deploy your function code. You can read this page if you want more details: https://learn.microsoft.com/en-us/azure/azure-functions/run-functions-from-deployment-package
I have not used the GitHub action for azure function myself but the documentation mentions "Kudu zip deploy method is used by the action for deployment of Functions." so it should be good with the website_run_from_package setting.