问题
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