9

In Azure Portal, you can get function URL directly from portal. there is also another way here that you can get Azure Function URL using Azure ARM API. But I want to know, Is there any way to get "Function URL" by code (Node.js, Python, ...) in Azure Function Apps directly?

enter image description here

1 Answer 1

13

For Node.js azure function, you can just use this line of code: req.originalUrl.

Detailed steps as below:

1.In Azure portal, create a Http Trigger function, select JavaScript as it's Programming Language.

2.In the index.js file, add this line of code: context.log(req.originalUrl);

3.Sample code like below:

  module.exports = function (context, req) {

       context.log(req.originalUrl);
       //write you other logic below
  };

Please refer to the screenshot below for test result: enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you so much, it's working :). if there is any reference, I will be so much happier to know where it is.
@RezaAmya, you can refer to this nodejs tutorial
What if it's timer-triggered function?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.