How to programatically know the current region in an azure role?

后端 未结 3 1032
挽巷
挽巷 2021-01-12 20:09

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?

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-12 20:56

    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.

    
    
      hosted-service-url
      hosted-service-name
      
        description
        name-of-affinity-group 
        **location-of-service**
        
        current-status-of-service
        creation-date-of-service
        last-modification-date-of-service
        
          
            name-of-property
            value-of-property
          
        
        type-of-guest-agent
      
      thumbprint-of-winrm-certificate
    
    

提交回复
热议问题