Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

All Function Apps turn to Read only mode after publishing Azure function project via Visual Studio 2017

I have a Function Apps created via Portal, another one created by visual studio. The latter one cause both apps to become read only, with message below:

Your app is currently in read-only mode because you have published a generated function.json. Changes made to function.json will not be honored by the Functions runtime

Is this feature correct?

VS: 15.8.5

like image 209
Pingpong Avatar asked Sep 21 '18 00:09

Pingpong


People also ask

How do I turn off read only mode in Azure app?

In the Azure portal, refresh your function application and run it now from the code+Test menu. Step 2: Go to Azure Portal > Your Function App > Configuration (in the left index pane) > in the Application Setting, change the value of WEBSITE RUN FROM PACKAGE to 0 and click Ok and Save.

How do I publish my Azure function from VS?

Use the following steps to publish your project to a function app in Azure. In Solution Explorer, right-click the project and select Publish. In Target, select Azure then Next. Select Azure Function App (Windows) for the Specific target, which creates a function app that runs on Windows, and then select Next.

How do I change the Azure function in Visual Studio?

In the Azure portal, browse to your function app. Under Settings, choose Configuration. In the Function runtime settings tab, locate the Runtime version. Note the specific runtime version.


1 Answers

Yes, this is by design. Function Apps you mentioned should be called functions in one same Function app.

You create a Function app and a function on portal, then in VS you actually also create a Function app instead of a separate function. After you publish this pre-compiled Function app to the one with some existing functions, Azure thinks you want to use the new published one, so it sets the app to be read-only as we can't modify pre-compiled assets on portal unless we republish our code.

This action is by design because one Function app(with functions inside) is handled as a complete unit. So apparently it's not recommended to mix online development with pre-complied one.

Two choices for you to refer.

  1. Remove existing functions in the app. Check Remove additional files at destination when publishing from VS.

    enter image description here

  2. Create another Function app.

There are risks that mixing online and pre-compiled code from VS, for example

  1. Name restriction. Functions created online will be overwritten if we publish functions with same names.

  2. We can't check Remove additional files at destination even though some pre-complied dlls published before have been useless.

If it's only for test or there's no worry about potential risks, just change Function app edit mode to readwrite in Function app settings or add FUNCTION_APP_EDIT_MODE readwrite in Application settings.

like image 199
Jerry Liu Avatar answered Sep 24 '22 14:09

Jerry Liu