4

Is there an API in azure to find the properties of a role (and an instance role)? I'm looking for the instance size, and it is not available in the Azure Management API.

David Makogon
  • 69,407
  • 21
  • 141
  • 189

2 Answers2

6

VM size isn't exposed in the API, as you've already found out. As suggested by Neil Mackenzie here, you can call Environment.ProcessorCount from your Azure application, which lets you deduce VM size. You could then store this in an Azure table, for example, and query the table.

EDIT: Here's a screen snapshot where I pushed an Extra-Large instance to Windows Azure and called Environment.ProcessorCount:

enter image description here

EDIT June 6, 2011 - The Serivce Management API was just updated, including updates to GetDeployment which returns instance size, SDK version, and more. See blog post here for more details.

David Makogon
  • 69,407
  • 21
  • 141
  • 189
  • In the [Link](http://msdn.microsoft.com/en-us/library/system.environment.processorcount.aspx) which you have provided, the documentation reads as Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported) So, will it work for the Azure Environment...? Have you tried using it – Naveen Vijay May 18 '11 at 09:34
  • @Naveen - yes, I tried using this, within a Windows Azure compute instance, and it worked fine. – David Makogon May 18 '11 at 11:41
  • oh, then how come the documentation specified (Server Core Role not supported). I believe, that all Azure OS are Windows Server 2008 R2...? Are you double sure...? Coz I tried myself and it didn't work out. Anyway lemme check again... – Naveen Vijay May 18 '11 at 12:12
  • 1
    @Naveen - see edited answer with screen snapshot that I just took a few minutes ago, running an Extra Large instance. I simply called Environment.ProcessorCount.ToString() and assigned that to a textbox. – David Makogon May 18 '11 at 13:00
2

Now you can get the instance size programmatically using the Service Management API under operations on Hosted Services Get Deployment. See this LINK for info.

Naveen Vijay
  • 15,928
  • 7
  • 71
  • 92