如何在Azure Function应用中禁用只读模式? [英] How to disable Read Only mode in Azure Function App?

查看:174
本文介绍了如何在Azure Function应用中禁用只读模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从Azure门户创建一个新的Function App(v2).然后,借助Azure Functions核心工具v2.3在本地计算机上启动一个新应用,并将其发布到门户上的新应用中:

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

这会将我的应用设置为只读模式.但是我需要能够从门户更改应用程序,因为我需要创建代理(Core Tools无法创建代理,如果我错了,请更正我).如何禁用只读模式?

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?

以下是我的local.settings.json的内容:

Following is content of my local.settings.json:

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

仅供参考,我正在macOS High Sierra上进行开发.

FYI, I'm developing on macOS High Sierra.

推荐答案

第1部分-禁用只读模式

您可能会发现您是否正在使用功能应用程序处于从包运行"模式的最新工具,这意味着它正在直接从上传的ZIP中读取文件,因此无法对其进行编辑.您可以通过删除门户中的WEBSITE_RUN_FROM_ZIPWEBSITE_RUN_FROM_PACKAGE应用程序设置将其关闭.请注意,这将清除您的功能应用程序,直到您下次发布为止.

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.

如果您的工具有些陈旧,或者如果您使用最新的工具但使用func azure functionapp publish my-app-name --nozip进行了部署,则可以使用门户网站平台功能中的App Service编辑器来编辑function.json文件并删除"generatedBy"设置,将阻止它们变为只读状态.

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.

第2部分-创建代理

您可以通过在应用程序根目录(以及host.json)中填充一个proxies.json文件,将代理添加到本地项目中.有关更多信息,请访问 https://docs.microsoft.com/en -us/azure/azure-functions/functions-proxies ,其中一些示例位于 https://docs.microsoft.com/zh-cn/sandbox/functions-recipes/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.

这篇关于如何在Azure Function应用中禁用只读模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆