How to disable Read Only mode in Azure Function App?

北慕城南 提交于 2019-12-10 13:28:05

问题


I create a new Function App (v2) from Azure portal. Then I initiate a new app on my local computer with help of Azure Functions Core Tools v2.3, and publish it to my new app on portal:

func init
func new
func azure functionapp publish my-app-name

This puts my app in Read Only mode. But I need to be able to change the app from portal, because I need to create proxies (Core Tools isn't able to create proxies, please correct me if I'm wrong). How can I disable the Read only mode?

Following is content of my local.settings.json:

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "node",
    "AzureWebJobsStorage": "{AzureWebJobsStorage}"
  }
}

FYI, I'm developing on macOS High Sierra.


回答1:


Part 1 - Disabling read-only mode

You'll likely find if you're using the latest tools that your function app is in run-from-package mode, which means it's reading the files directly from the uploaded ZIP and so there's no way to edit it. You can turn that off by deleting the WEBSITE_RUN_FROM_ZIP or WEBSITE_RUN_FROM_PACKAGE application setting in the portal. Note this will clear your function app until the next time you publish.

If your tools are a little older, or if you've deployed using the latest tools but with func azure functionapp publish my-app-name --nozip then you can use the App Service Editor in Platform Features in the portal to edit the function.json files and remove the "generatedBy" setting, which will stop them being read-only.

Part 2 - Creating proxies

You can add proxies to your local project by populating a proxies.json file in the app root (alongside host.json). More information is at https://docs.microsoft.com/en-us/azure/azure-functions/functions-proxies, and a few examples are at https://docs.microsoft.com/en-us/sandbox/functions-recipes/proxies. You can also create proxies in the portal (when not read-only!) and then use the advanced editor to get the source to add to your project.




回答2:


It appears that this setting can now be changed from the portal or by editing the application settings. FUNCTION_APP_EDIT_MODE allows values readwrite and readonly, according to the manual

Some discussion of this in the following issue as well. It appears that the recommendation is generally not to do this because changes should be made through the publishing pipeline, but it is now possible.



来源:https://stackoverflow.com/questions/53630773/how-to-disable-read-only-mode-in-azure-function-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!