How to deploy C# Azure minimal Function App using bicep sourcecontrol?

Siegfried Heintze 1,861 Reputation points
2024-05-12T22:38:43.5133333+00:00

I have used Visual Studio 2022 Preview to create the "Hello World" version of an isolated ".net 6" azure function (see https://github.com/siegfried01/HelloFunctionAppSourceControl/blob/master/HelloFunctionAppSourceControl.cs#L22) and publish this to a resource group which I then exported to JSON ARM and then I decompiled it with bicep.

See https://github.com/siegfried01/HelloFunctionAppSourceControl/blob/master/deploy-helloFuncAppSrcCtrl.bicep#L122.

Unfortunately, this bicep does not deploy the function. Since I get this error: "The value for one of the HTTP headers is not in the correct format." I tried deploying my function again but without application insights and still I get this same error (after exporting the JSON ARM again and decompiling in the bicep again). So I looked the bicep code and since the function app made no reference to the storage account (I think this is an error in the ARM template generation?), I deleted the storage account code from the bicep source code file and tried again.

I believe the storage account is optional? Is this true?

I think the storage account is for logging. Is this true?

I would like to have the logging feature. Can I see the logs using "az webapp log tail" without a storage account?

Actually, I would like to have the application insights feature too but that should be the subject of a different post.

Well now I am not getting any errors when I deploy using my bicep code (without the storage account that caused the above error) but when I go to the portal.azure.com overview (of my function app) to see my function I don't see my function.

In September 2023 I was able to make this sourcecontrol feature work with an azure in-process function. This example is no longer working and now I am interested in isolated .net6 or .net 8.

However, this webapp still works to display a minimal Blazor Svr app (but it is a web app not a function app): https://github.com/siegfried01/azure-event-grid-viewer/blob/main/deploy-azure-event-grid-viewer.bicep#L122 which is forked from Azure-Samples/azure-event-grid-viewer.

Please help me modify my bicep file to deploy a very minimal and simple azure C# http triggered function.

Thanks

Siegfried

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,387 questions
{count} votes