I have a condition in code where i need to check if current environment is not local.i have used !RoleEnvironment.IsEmulated, now this is not working in Azure
You can use the AZURE_FUNCTIONS_ENVIRONMENT environment variable, which is set automatically in local development:
Environment.GetEnvironmentVariable("AZURE_FUNCTIONS_ENVIRONMENT"); // set to "Development" locally
Note that when deployed/published (i.e. Azure), you'd need to set the environment variable yourself (e.g. function app settings in Azure).