0

I am learning Azure and specificially the Java serverless functions that has been recently introduced by the MS team.

I have developed a simple API as per their documentation. It works fine. But I want to disable it. As per their documentation, when i update the "disabled" to true, I am not seeing the API being disabled. I am still able to invoke it.

The sample 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
}

Here is the steps that i followed to disable my function:

changed the function.json disabled to true. Click "Save" and then click "Run". I was able to get the response as 200 OK. What am i missing.

Tom Sun - MSFT
  • 24,161
  • 3
  • 30
  • 47
mack
  • 345
  • 5
  • 18

2 Answers2

0

Clicking on the Functions , you will be displayed with list of functions and option to disable and delete.enter image description here

Baskar Rao
  • 470
  • 4
  • 11
  • I am able to see that the function is disabled even in my case. But When I am invoking the API, I am still able to get the response. So I am not sure what it means by "disabled" – mack Nov 02 '17 at 18:36
  • We would be able to invoke but we get a http response with status 404. I tried with a C# based Http Function and when invoked after disabling we get 404 status. – Baskar Rao Nov 02 '17 at 18:59
  • Not for my case when I did with Java.. I am not sure where and what is missed – mack Nov 02 '17 at 22:54
0

I tried to disable my java azure function via two methods below:

Portal manage :

enter image description here

Function.json setting :

enter image description here

The results of both tests are all can be accessed normally as same as your test .

enter image description here

Then I learned from this case that we can configure functions array in the host.json to specify which functions can be executed.

I ensure my host.json is an empty {}. However , the result of my test is also normal access.

Per my experience, Azure function for Java was released not long and it is experimental phase. I guess this is a bug and I suggest you submit a related feedback here.

Hope it helps you.

Jay Gong
  • 23,163
  • 2
  • 27
  • 32