Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Azure Websites - Get Instance Identifier

What's a possible way to determine on an Azure website with multiple instances what instance is responding (some ID or other piece of unique info)?

like image 643
Sean Feldman Avatar asked Aug 07 '13 03:08

Sean Feldman


2 Answers

The following environment setting will have the instance id the current request is running on: WEBSITE_INSTANCE_ID.

You'll also receive this id as a cookie in the response named: ARRAffinity.

You can also use this information to get back to that specific instance, see: http://blog.amitapple.com/post/2014/03/access-specific-instance/ for more information about it.

like image 168
Amit Apple Avatar answered Oct 26 '22 23:10

Amit Apple


Microsoft Azure provides many environment variables for Azure Web Apps (formerly known as Website), including the following:

  • WEBSITE_SITE_NAME - the name of the site.

  • WEBSITE_INSTANCE_ID- the id representing the VM that the site is running on.

  • etc

    See Azure Runtime Environment by David Ebbo for more details.

like image 43
Oleg Burov Avatar answered Oct 26 '22 21:10

Oleg Burov