Skip to content

Instantly share code, notes, and snippets.

@guitarrapc
Created March 27, 2019 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guitarrapc/2c556d64e93c1d08f58242313f8c3563 to your computer and use it in GitHub Desktop.
Save guitarrapc/2c556d64e93c1d08f58242313f8c3563 to your computer and use it in GitHub Desktop.
App on Azure or local check
using Microsoft.Azure.WebJobs;
using System;
namespace MyFunction.Extensions
{
public static class ExecutionContextExtension
{
public static bool IsAzureEnvironment(this ExecutionContext context, string environmentVariable = "WEBSITE_INSTANCE_ID")
{
var isAzureEnvironment = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(environmentVariable, EnvironmentVariableTarget.Process));
return isAzureEnvironment;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment