0

Working on an ASP.Net Core MVC app and wondering what the best way is to dynamically determine at run time if my code is running on Azure or not?

Thanks

Donal

Donal McWeeney
  • 241
  • 2
  • 14
  • Possible duplicate of [How to check if code is running on Azure Websites](http://stackoverflow.com/questions/25678419/how-to-check-if-code-is-running-on-azure-websites) – Kiran Jul 29 '16 at 12:25
  • 1
    Hi Kiran. Had found above link but it was 2 years old and alot has changed in Azure and ASP.Net since! Wondering was there a more streamlined solution built into the tools since. Thanks... – Donal McWeeney Aug 02 '16 at 12:07

1 Answers1

3

See Kudu's Environment page:
https://sitename.scm.azurewebsites.net/Env.cshtml

Check for the existence of App Service specific environment variables:

WEBSITE_SKU
WEBSITE_SCM_SEPARATE_STATUS
WEBSITE_HOSTNAME = __sitename__.azurewebsites.net
evilSnobu
  • 24,582
  • 8
  • 41
  • 71