question

mariapraded-0469 avatar image
0 Votes"
mariapraded-0469 asked MayankBargali-MSFT commented

Creating a Azure C# function dynamically using Azure Rest API

Hi all,

I'm trying to create a new azure c# function, using templates from this (creating-a-azure-python-or-c-function-dynamically.html ) discussion, and I see the following error: 124879-image.png . The body of the request is exactly the same as the template, the url is correct as I tested it with GET request and it worked well.
Can you provide me some advice: what could I check or pay attention to?

Thanks in advance

azure-functions
image.png (29.9 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@mariapraded-0469 As per the error message the request was not correctly formed. Can you confirm in which language you are creating the function app, function app plan along with the request body as I have the tested the same request body shared in my previous post on the webapp plan for C# and python but couldn't observe any issue.

0 Votes 0 ·

Yes, here it is:
1. Consumption function app plan 125589-image.png,
2. Language - c# (.net) 125672-image.png,
3. Request body - 125616-image.png

So, as I understand, the problem is in the function app plan

0 Votes 0 ·
image.png (1.6 KiB)
image.png (3.2 KiB)
image.png (68.4 KiB)

I cannot post the copied request body, idk why, Submit button is just does nothing after press (the 1600 symbols limit is not reached)

0 Votes 0 ·

1 Answer

MayankBargali-MSFT avatar image
0 Votes"
MayankBargali-MSFT answered MayankBargali-MSFT commented

@mariapraded-0469 You can create the text file and save the body and attach the file in your comment so I can review. In case if you are working with consumption plan then the below applies as mentioned in my answer here if in case if the WEBSITE_CONTENTAZUREFILECONNECTIONSTRING and WEBSITE_CONTENTSHARE is not define in your function app application setting.

In consumption sku there is no persistent storage by default. So contents will be lost when the workers recycle. If you need to create a function for the consumption plan then you need to define (WEBSITE_CONTENTAZUREFILECONNECTIONSTRING, WEBSITE_CONTENTSHARE app settings). I have tested creating a python function once I have defined these two settings in my application settings of the function app.

I have created a new function app in consumption SKU and used the same request body as I have mentioned in my previous post and the function gets sucessfully created.

126121-image.png

Looks like the runtime environment might have the issue which might be causing this behaviour where you might have deleted some of the configuration. I will suggest you to create a new consumption plan function app and test it to confirm if you observe the same behaviour.


image.png (79.8 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

As I can see in the page functions-infrastructure-as-code, these app settings are not applicable in the Linux function app, as mine. In this case, will it work, if I define these app settings?
The message body is attached126285-body.txt
And I tried to create new function apps with App Service plan and Premium plan and my requests with attached body worked correctly and created functions for both of new function apps.


0 Votes 0 ·
body.txt (1.4 KiB)

@mariapraded-0469 Yes these are avaiable for windows as mentioned in this document.

0 Votes 0 ·