如何编程知道在Azure角色当前区域? [英] How to programatically know the current region in an azure role?
本文介绍了如何编程知道在Azure角色当前区域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要以编程方式找到当前区域(例如美西或东美),在那里我目前的角色正在运行。是否有任何的API来找到这个?
I need to programmatically find the current region (e.g "West US" or "East US") where my current role is running. Is there any API to find this?
推荐答案
考虑使用的获取的服务管理API云服务。当您提供您的角色是一部分的服务,您可以检索类似如下的响应。请注意,我出演的位置字段。
Consider using Get Cloud Service in the service management API. When you supply the service that your roles are a part of, you can retrieve a response similar to the following. Note the location field that I've starred.
<?xml version="1.0" encoding="utf-8"?>
<HostedService xmlns="http://schemas.microsoft.com/windowsazure">
<Url>hosted-service-url</Url>
<ServiceName>hosted-service-name</ServiceName>
<HostedServiceProperties>
<Description>description</Description>
<AffinityGroup>name-of-affinity-group</AffinityGroup>
**<Location>location-of-service</Location >**
<Label>base-64-encoded-name-of-service</Label>
<Status>current-status-of-service</Status>
<DateCreated>creation-date-of-service</DateCreated>
<DateLastModified>last-modification-date-of-service</DateLastModified>
<ExtendedProperties>
<ExtendedProperty>
<Name>name-of-property</Name>
<Value>value-of-property</Value>
</ExtendedProperty>
</ExtendedProperties>
<GuestAgentType>type-of-guest-agent</GuestAgentType>
</HostedServiceProperties>
<DefaultWinRmCertificateThumbprint>thumbprint-of-winrm-certificate</DefaultWinRmCertificateThumbprint>
</HostedService>
这篇关于如何编程知道在Azure角色当前区域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文