title: functions.json graphToken binding ignored by Azure function
body: <p>I have a function in a folder called 'TestMe', like so:</p>
  
  <p><a href="https://i.stack.imgur.com/bDocC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bDocC.png" alt="enter image description here"></a></p>
  
  <p>I can build the project in VSCode and upload it fine however the contents of function.json seems to be ignored.</p>
  
  <p>My function is pretty simple:</p>
  
  <pre><code>    [FunctionName("TestMe")]
      public static IActionResult Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequest req, string graphToken, TraceWriter log)
      {
          log.Info("C# HTTP trigger function processed a request.");
  
          string name = req.Query["name"];
  
          string requestBody = new StreamReader(req.Body).ReadToEnd();
          dynamic data = JsonConvert.DeserializeObject(requestBody);
          name = name ?? data?.name;
  
          return name != null
              ? (ActionResult)new OkObjectResult($"Hello, {name}")
              : new BadRequestObjectResult("Please pass a name on the query string or in the request body");
      }
  </code></pre>
  
  <p>and the function.json:</p>
  
  <pre><code>{
    "bindings": [
      {
        "name": "req",
        "type": "httpTrigger",
        "direction": "in"
      },
      {
        "type": "token",
        "direction": "in",
        "name": "graphToken",
        "resource": "https://graph.microsoft.com",
        "identity": "userFromRequest"
      },
      {
        "name": "$return",
        "type": "http",
        "direction": "out"
      }
    ],
    "disabled": false
  }
  </code></pre>
  
  <p>I was following the guide <a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-microsoft-graph" rel="nofollow noreferrer">here</a> where I thought I could get a graphToken but instead all I got was this error:</p>
  
  <blockquote>
    <p>Microsoft.Azure.WebJobs.JobHost.Validate(IFunctionDefinition function,
    object key) in JobHost.cs
    Microsoft.Azure.WebJobs.JobHost+d__36.MoveNext() in
    JobHost.cs
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task)
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task)
    Microsoft.Azure.WebJobs.Script.ScriptHost+d__86.MoveNext()
    in ScriptHost.cs
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task)
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task)
    Microsoft.Azure.WebJobs.Script.WebHost.Middleware.FunctionInvocationMiddleware+d__4.MoveNext()
    in FunctionInvocationMiddleware.cs
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task)
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task)
    Microsoft.Azure.WebJobs.Script.WebHost.Middleware.FunctionInvocationMiddleware+d__3.MoveNext()
    in FunctionInvocationMiddleware.cs
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task)
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task) System.Runtime.CompilerServices.TaskAwaiter.GetResult()
    Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware+d__7.MoveNext()</p>
  </blockquote>
  
  <p>So I tried disabling the function and building/uploading the azure functions again from VSCode but I could still access the function making me believe the function.json is being ignored.</p>