9

I have several Azure Functions Apps (c#, javascript and python) and after some time they were all randomly set to Read Only mode. The strange thing is that only one of these 3 function apps were updated before this happened. I know that this is not necessarily a problem, but I want to be able to make edits from the portal.

I can't open App Service Editor
App Service Editor can't be pressed
I can't set the app to Read/Write from Function App Settings -> Function app edit mode enter image description here I also tried using "func azure functionapp publish myAzFuncAppName --nozip", but with the same result

johnykes
  • 1,663
  • 2
  • 9
  • 25

4 Answers4

7

Of course. Please notice that if the function is 'deployed' to Azure, what will be deployed is the compiled file.

For example, if you deploy C# function app, what will be deployed is the dll file. So this is why it is readonly.

Changes to the code should be done before compiling them into corresponding 'cannot be edited' files, which requires special attention.

But for the modification of the declarative part and the configuration part of the function, this is possible, the specific steps are as follows:

Declarative part:

enter image description here

Then click Debug Console > cmd:

enter image description here

Go to site\wwwroot[yourfunctionname], and there will be a function.json.

enter image description here

Click the 'pen' to edit and don't forget to save.

Configuration part:

enter image description here

Cindy Pau
  • 13,085
  • 1
  • 15
  • 27
  • So there's now way of deploying to Azure Function Apps without disabling this "privilege" (of editing functions on the platform)? – johnykes Jan 20 '20 at 09:01
  • @johnykes Hi, johnykes. It is no matter about the privilege or disable. For example, if you create a function by vs 2019 and publish to Azure. Its steps are to compile and generate the relevant files first. These files are then packaged into a zip and deployed to Azure. Therefore, the specific code of the function obtained by this method cannot be edited. In other words, as long as your locally compiled code is deployed to Azure, its code portion cannot be edited. Only the declaration section (funtion.json) and configuration section (local.settings.json, Application Settings) can be edited. – Cindy Pau Jan 20 '20 at 09:35
  • @johnykes In summary, the function code obtained by your method cannot be edited by itself, and there is no way to set editing privileges. If you know Java, you can understand that the original .java file is compiled into a .class file. Or for a C ++ console program, it is an .exe file. Of course, you cannot edit these compiled files. For the program I deployed here, it is a dll file, not a .cs file. Usually you can edit the .crx script file on Azure. Let me know if you have more doubts. – Cindy Pau Jan 20 '20 at 09:39
  • Okay, thank you for clarification! Still sad because of not being able to make edits directly from portal after deploying, but hopefully Azure will change that in future :) – johnykes Jan 20 '20 at 12:51
  • yeah same. I did not find a way to update the requirement file of my python azure functions. It is said read only. – OrganicMustard Aug 17 '20 at 20:08
  • How can anyone expect to effectively work with azure functions with this restriction? Do I have to create a new function for every edit? – garthoid Jan 18 '21 at 16:23
1

You can change the settings from Azure Portal or by editing the application settings. FUNCTION_APP_EDIT_MODE allows values readwrite and readonly, a

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396
  • Check my second screenshot under "I can't set the app to Read/Write in Function App Settings". I can't change this setting – johnykes Jan 19 '20 at 19:11
  • You can turn that off by deleting the WEBSITE_RUN_FROM_PACKAGE application setting in the portal. – Sajeetharan Jan 19 '20 at 19:12
  • I tried now, but after redeploying my app, the setting is repopulated with a link to the zip package – johnykes Jan 19 '20 at 19:32
0

When the application runs from package, the files are loaded from that package. Hence those files are not editable.

You need to set WEBSITE_RUN_FROM_PACKAGE : 0 in app settings and redeploy the application again to make the function app editable.

refer https://social.msdn.microsoft.com/Forums/en-US/972d843c-8bdc-4cfc-9c6d-263df196d37c/azure-function-app-readonly-mode?forum=AzureFunctions

UPDATED:

You can deploy functionapp through command line from visual studio code. Try below command.

func azure functionapp publish --nozip

The nozip flag would set Run-From-Package mode off .

you can access other information regarding that command with func azure functionapp publish --help

Venkata Dorisala
  • 4,783
  • 7
  • 49
  • 90
0

Just deleted the Azure Function App, created a new one, transferred the code in the new one and deployed -> still read only, but now I was able to open "App Service Editor" and remove "generated by..." from function.json and then set "Read/Write" from Function App Settings -> Function app edit mode.

Still... I can't see/edit the code of the function, only of function.json and if I redeploy using Azure extensions of Visual Code or powershell with --nozip attribute, the "generated bla bla" appears again :(

johnykes
  • 1,663
  • 2
  • 9
  • 25
  • Of Course you can nor see/edit the code of the function. That is because they were compiled to different files which can not be edited. If you want to see the code of your function, you need to create function on portal directly. – Cindy Pau Jan 20 '20 at 03:11
  • Please notice that you can only modify the function's declarative and configuration part after deploy to Azure. For the code itself, that cannot be modified. Have a look of my answer, I have gaven detailed introduce about it. – Cindy Pau Jan 20 '20 at 05:51