Search code examples
azureazure-web-rolesazure-configurationazure-deployment

Getting the name and location of the deployment the webrole belongs to


I want to be able to get the name (named when the hosted service was created) and the location (North Europe, Asia Anywere, etc) of the deployment from within a running web role. I don't want to rely on a certificate and the subscription ID.

Something like:

// Current role name. Ex: WebRole_IN_0
RoleEnvironment.CurrentRoleInstance.Id

// Deployment id of the role. Ex: 44b522f7e8b94412b046bbab08116d87
RoleEnvironment.DeploymentId 

but just returning the deployment name and deployment location.

Is this possible without going through the REST api using the subscription ID and a certificate file?


Solution

  • No, this can't be done without using the Service Management API. Why not just put it in configuration settings? It can't change after deployment...