2

Azure Function HttpTrigger default use code parameter with token code, e.g: https://xxx.azurewebsites.net/api/xxxHttpTriggerCSharp?code=)#&)@^$^@#)

How can I replace code name by token like:
https://xxx.azurewebsites.net/api/xxxHttpTriggerCSharp?token=)#&)@^$^@#)

The situation I met:
A service also uses the code parameter, which leads to conflicts in authentication.

Cindy Pau
  • 13,085
  • 1
  • 15
  • 27
Wei Lin
  • 3,591
  • 2
  • 20
  • 52
  • I think it is no possible. If you have an authentication type like 'function', then you need to give the function key. 'code=' is by design, I think your requirement is impossible. – Cindy Pau Dec 24 '20 at 08:00
  • What about creating a Proxy in azure functions and setup the actual Http Endpoint; the proxy change the token query parameter to code as needed by azure functions (or can be done by Http Request header too). Read [here](https://learn.microsoft.com/en-us/azure/azure-functions/functions-proxies) – user1672994 Dec 26 '20 at 18:03

2 Answers2

3

You could send the code value as a header instead: x-functions-key

https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=python-v2%2Cin-process%2Cfunctionsv2&pivots=programming-language-csharp#api-key-authorization

This would free up the code parameter for use.

Chris
  • 3,113
  • 5
  • 24
  • 46
1

I think it is no possible. If you have an authentication type like 'function', then you need to give the function key. 'code=' is by design, I think your requirement is impossible.

If you don't want to use the authentication type, you can set the authentication type to anonymous(If you use script language, you can set it in the functin.json. If you use language that needs to be compiled, you can set it in the declaration part).

Cindy Pau
  • 13,085
  • 1
  • 15
  • 27
  • Making the function anonymous means giving up security. I don't see this as good advice. The other answer should be the correct one. – Greg Holst Apr 13 '22 at 12:22