如何禁用Azure中的功能

时间:2017-11-02 17:39:54

标签: java azure azure-functions

我正在学习Azure,特别是MS团队最近推出的Java无服务器功能。

我根据他们的文档开发了一个简单的API。它工作正常。但我想禁用它。根据他们的文档,当我更新"禁用"为true,我没有看到API被禁用。我仍然可以调用它。

示例function.json

    {
  "scriptFile" : "..\\myfunction-1.0-SNAPSHOT.jar",
  "entryPoint" : "com.xxx.myfunction.Function.hello",
  "bindings" : [ {
    "type" : "httpTrigger",
    "name" : "req",
    "direction" : "in",
    "authLevel" : "anonymous",
    "methods" : [ "get", "post" ]
  }, {
    "type" : "http",
    "name" : "$return",
    "direction" : "out"
  } ],
  "disabled" : true
}

以下是我禁用我的功能的步骤:

将function.json禁用更改为true。点击"保存"然后单击"运行"。我能够得到200 OK的回复。我错过了什么。

2 个答案:

答案 0 :(得分:0)

单击“功能”,将显示功能列表以及禁用和删除选项。enter image description here

答案 1 :(得分:0)

我尝试通过以下两种方法禁用我的java azure函数:

门户管理:

enter image description here

Function.json设置:

enter image description here

两个测试的结果都可以正常访问,与测试一样。

enter image description here

然后我从这个case中了解到,我们可以在functions array中配置host.json来指定可以执行哪些功能。

我确保host.json为空{}。但是,我的测试结果也是正常访问。

根据我的经验,Java的Azure功能发布时间不长,而且是实验阶段。我想这是一个错误,我建议您提交相关的反馈here

希望它对你有所帮助。