Reputation: 2539
We have a requirement of logging Cloud Service Name where Web Role is deployed.
We are getting Role Name & Role Instance Id from RoleEnvironment class in Azure ServiceRuntime library.
But not finding Cloud Service Name.
Upvotes: 4
Views: 2333
Reputation: 136176
You can't find this information via RoleEnvironment
class. You would need to use Service Management API
for that purpose. Basically the trick is to get the deployment id from RoleEnvironment
class and then invoke Service Management API operations to
That would give you the information you need.
To invoke Service Management API operations, you could use Azure Management Library
or write your own REST wrapper. I did a blog post long ago where I did similar thing using REST API: http://gauravmantri.com/2012/03/16/programmatically-finding-deployment-slot-from-code-running-in-windows-azure/.
Upvotes: 6