Reputation: 707
I have an Azure web app that uses a startup task batch file (addtask.cmd) to install a small heartbeat utility into the scheduler.
If I'm testing locally or in the Azure staging environment, I dont want to install the heartbeat utility.
How can I prevent the startup task, or the batch file, from running in those environments?
I can probably detect local environment by checking for my machine name, but how would you detect running in the staging environment?
Upvotes: 2
Views: 639
Reputation: 2155
I don't have an answer for the staging vs. production slots in the cloud, but if you want to avoid executing Startup Tasks when in a development environment, there is a very simple technique I have been using for a while - and use constantly.
The trick: set an environment variable on your dev machine and using basic DOS batch file (or PowerShell) techniques, jump over the stuff you don't want if that variable is present. It will not be present in the cloud.
I blogged about it here: Azure FAQ: Can I create a Startup Task that executes only when really in the Cloud?
Upvotes: 1