Azure Function 2.x - Get Current User's Claims Azure Function 2.x - Get Current User's Claims azure azure

Azure Function 2.x - Get Current User's Claims


This feature is now supported in C# in Azure Functions 2.0. You can now add ClaimsPrincipal as a parameter to your HttpTrigger function's signature, or you can access it on the HttpRequest object via req.HttpContext.User.

Support should be coming soon to JavaScript, and eventually all languages should support this feature.


Let me just post a code example here, see where ClaimsPrincipal parameter is:

[FunctionName("MyFunctionName")]public static HttpResponseMessage Run(            [HttpTrigger(                AuthorizationLevel.Anonymous,                "get", "post",                Route = "MyFunctionName")]HttpRequestMessage req,             ILogger log,             ClaimsPrincipal claimsPrincipal){    // My function code here...}