7

I would like to invoke a REST call from my WebJob, I am wondering if it is possible to programmatically retrieve the Host Url (http://<something>.azurewebsites.net) from inside my WebJob, instead of hard-coding the URL.

Brendan Green
  • 11,676
  • 5
  • 44
  • 76
icube
  • 2,578
  • 1
  • 30
  • 63

2 Answers2

11

Web App hostname can be read from the WEBSITE_HOSTNAME environment variable.

A description of the environment, including environment variables can be found here. Environment variables and their values can be viewed using the Kudu dashboard at https://<web_app>.scm.azurewebsites.net.

MrBink
  • 740
  • 5
  • 17
0

In your queue monitoring method you can pass a reference to CloudStorageAccount and get the queue endpoint, e.g:

    public async Task ProcessQueueMessageAsync([QueueTrigger("queue")] string message, CloudStorageAccount account)
    {
        var endpoint = account.QueueEndpoint;
    }
Teppic
  • 2,506
  • 20
  • 26