How to find an Azure instance role size programmatically?

风格不统一 提交于 2020-01-12 08:38:42

问题


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.


回答1:


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:

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.




回答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.



来源:https://stackoverflow.com/questions/4984119/how-to-find-an-azure-instance-role-size-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!