26

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.

Mahdi
  • 1,089
  • 1
  • 14
  • 27
  • 1
    I would advise against mixing things up... Either you rely on the portal or in a local development tool. @MarkXa answer regarding proxies is correct. If you do prefer setting things up on the portal the best is to delete the function and recreate it. – Carlos Alves Jorge Dec 05 '18 at 12:51

3 Answers3

26

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://learn.microsoft.com/en-us/azure/azure-functions/functions-proxies, and a few examples are at https://learn.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.

MarkXA
  • 4,294
  • 20
  • 22
  • Thank you. I'm going to mark this as answer however I have question: I'm using the latest tool for mac (v2.3.148). By default (even without using --nozip option) it deploys the app and turn it into read-only mode. Yes, removing those settings disable read only mode (+ erasing the app). Is there any way to change default behaviour from the beginning? – Mahdi Dec 07 '18 at 16:34
  • Also, according to following announcement, Core Tools shows be able to create proxies without need to add manually proxies.json, but I don't see such option on my version. Can you create proxies with Core Tools? If so, which version and OS are you using and how? here is the announcement [https://blogs.msdn.microsoft.com/appserviceteam/2017/11/15/azure-functions-proxies-is-now-generally-available/] – Mahdi Dec 07 '18 at 16:45
  • I'm not aware of a way to prevent a publish from being read-only - that's the way it's designed. Re the "func proxy" commands, at the time of writing they aren't available in v2 Core Tools, only v1, though I believe it's on the roadmap. – MarkXA Dec 07 '18 at 22:22
  • thank you. I would like to know your opinion about something: As you said, Core Tools by default deploys as Run For package and it can't be changed. Then what's the point of having --nozip option as it does same thing? Having --nozip ,to me, implies that there is other way to deploy than Run For Package. But there isn't any other way. I find this confusing. What's your opinion? – Mahdi Dec 09 '18 at 21:01
  • Yes, --nozip isn't ideally named :) It actually means "don't run from package". If supplied, it'll still upload a ZIP file but it'll extract it to the filesystem which means the files are editable in the portal. Otherwise the function app runs directly from the ZIP, so the files you see in the portal are actually links to files in the ZIP and you can't edit them. – MarkXA Dec 10 '18 at 11:50
  • thanks but when I published with --nozip. still I wasn't able to edit my functions from portal console! – Mahdi Dec 11 '18 at 09:12
  • Slight difference between "editable" and "read-only". You should find that you can edit the files in the App Service Editor as mentioned in the answer. It'll only stop showing as read-only in the Azure Functions interface once you've taken out "generatedBy" though (works in my portal ...). – MarkXA Dec 11 '18 at 13:50
  • I'm deploying from VS 2017. Your answer implies is if you deploy from Visual Studio, you always have to go into your application and remove generatedBy every time you deploy? – Dinsdale Jan 10 '19 at 17:24
10

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.

JJJ
  • 1,009
  • 6
  • 19
  • 31
Dillon Brown
  • 305
  • 3
  • 9
5

Change deployment settings from Auto-detect to Zip Deploy in azure release.

Screenshot of Deployment Method dropdown within Additional Deployment Options section. Dropdown is set to Zip Deploy.

Tim
  • 5,435
  • 7
  • 42
  • 62
Ruby Vijay
  • 59
  • 1
  • 2