Home > database >  Lookup Azure application name from within a running function app
Lookup Azure application name from within a running function app

Time:02-05

Is it possible to lookup the application name for an Azure app as it runs, i.e., get the information about that is displayed in the Azure portal? In the example below, I'd want something to tell me from within the application that I am running sitemap-prod-eastus.

I've been looking at the enter image description here

CodePudding user response:

I've not seen anything that would expose this to a function app. That said, there is one sort of workaround that you could do which would work - go to the Configuration blade for the function app, Application settings tab, and add a configuration key like function_name and set its value to the name of your app. Your app could then just read it out of configuration.

It's an extra step, but if you're doing it with something like ARM or Terraform, it's just another configuration entry with a variable you already declared to set up the app in the first place.

CodePudding user response:

Answering my own question: Azure provides WEBSITE_SITE_NAME in the runtime environment that matches the name of the function app.

  •  Tags:  
  • Related