How do I get my subscription ID programmatically in an Azure role?
I have this worker role that uses the REST management API (via https://github.com/Azure/azure-sdk-for-net ) whose basic premise is Subscription ID.
Is there a way to get the subscription ID from the current (worker) role? For example. say via RoleEnvironment?
source to share
Sorry Gatis, there is no way to get this using any method provided by Azure *. You will need to pass this information to your role using something like CSCFG config settings.
For a little more context, the subscription identifier is only known at the RDFE level. When you are in the Fabric layer (i.e. your worker role) then there is no concept of a subscription id. You can see http://blogs.msdn.com/b/kwill/archive/2011/05/05/windows-azure-role-architecture.aspx process A and steps 1 and 2 for more information.
* If you are using AAD authentication for service control API calls, you can get a list of all signatures for that AAD user using List Subscriptions - http://msdn.microsoft.com/en-us/library/azure/ dn775050.aspx . With these subscribers, you can list all cloud services and map the deployment ID to the deployment ID for your worker role.
Edit: Typo in the first paragraph. Changed "something like a subscription ID" to "something like CSCFG config settings".
source to share