Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect that azure application is running in development fabric?

How can I reliability detect whether my Azure application is running in development fabric and not in 'the cloud' ?

RoleEnvironment.IsAvailable is true for both. I want something that is true in only one case.

I'm asking this because I want users of my library to be able to use my library for free in dev fabric. Hence manually putting separate identifier or flag in config file and keeping two configs for dev and deploy is not feasible.

like image 284
Muhammad Hasan Khan Avatar asked May 26 '10 17:05

Muhammad Hasan Khan


People also ask

Does Azure run on service fabric?

Service Fabric is an open source project and it powers core Azure infrastructure as well as other Microsoft services such as Skype for Business, Intune, Azure Event Hubs, Azure Data Factory, Azure Cosmos DB, Azure SQL Database, Dynamics 365, and Cortana.

How does Azure service fabric work?

Azure Service Fabric is a distributed systems platform that makes it easy to package, deploy, and manage scalable and reliable microservices and containers. Service Fabric also addresses the significant challenges in developing and managing cloud native applications.


2 Answers

One option is to take a look at RoleEnvironment.DeploymentId - if you're running in the dev fabric, it should have a name like 'deployment(n)' where n is some sequential number. If you're running in production, the deployment id should resemble a Guid.

Another thing you can do is look at an role's instance name. In production, it should end in _0 (representing instance 0). In the dev fabric, it will end in .0

EDIT 1/8/2013 - realized this answer I gave over 2 years ago is quite outdated! Now there's also RoleEnvironment.IsEmulated - check out the details here.

like image 109
David Makogon Avatar answered Sep 20 '22 02:09

David Makogon


The Windows Azure 1.5 SDK introduced the RoleEnvironment.IsEmulated static bool property to determine from code whether the role instance is running in the Windows Azure compute emulator. This information can be passed to startup tasks too. There is a great article from Steve Marx here about that.

like image 40
Marton Rusko Avatar answered Sep 20 '22 02:09

Marton Rusko