0

Is it possible to get azure function URL (at runtime) for Http triggered function app developed in C#.I have implemented a health check for function app.I need to call function URL to check whether the function is healthy or not . I know azure provide services to check FA health but I need to implement as per organization standards. So, Basically it will be a endpoint /healthCheck to get health report.

5
  • 1
    What are you trying to do here? some code you have so far could be helpful to understand the question. Commented Feb 25, 2021 at 10:04
  • Would you kindly share you code so that we could better visualize your issue. Commented Feb 25, 2021 at 10:22
  • I have implemented a health check for function app.I need to call function URL to check whether the function is healthy or not . I know azure provide services to check FA health but I need to implement as per organization standards. So, Basically it will be a endpoint /healthCheck to get health report. Commented Feb 25, 2021 at 10:29
  • so basically your Function will call itself to do a health check on itself?! Commented Feb 25, 2021 at 13:06
  • Does the below answer helps your query? Commented Mar 1, 2021 at 8:24

2 Answers 2

1

While I don't understand yet what you are trying to do (and if that is a good idea..) you can infer your function URL through the pre-set env var WEBSITE_HOSTNAME (assuming you are not using a custom domain):

var url = $"https://{Environment.GetEnvironmentVariable("WEBSITE_HOSTNAME")}/api/YOURFUNCTIONNAME";

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

Comments

0

I do not see a need of getting runtime Azure function app URLs as they remain the same always after creation. On the same lines, you can automate your Function Apps using ARM templates.

And, use the created URLs defined in your endpoint's configuration and use them in your code from the configuration. For example, if you are using App Service, you can save those values in App Settings and read them like below:

var value = Environment.GetEnvironmentVariable("your_key_here");

1 Comment

Yes , I can set function URL in app settings of function app using ARM template . But, for first time when the FA is provisioned , there wont be any function deployed in FA. As per my understanding, I need an separate task (post function deployment) in devops pipeline to set function URL in FA settings.

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.