从visual studio部署功能应用程序后,在azure门户中获取环境变量 [英] Get environment variable in azure portal after deploying function app from visual studio

查看:78
本文介绍了从visual studio部署功能应用程序后,在azure门户中获取环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地获取自定义值并通过   System.Environment.GetEnvironmentVariable(name,EnvironmentVariableTarget.Process);接着是以下链接

in local.setting.json i wriiten custom values in locally am getting through  System.Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.Process); followed by below link

https://docs.microsoft.com/en-us/azure/azure-functions/functions-dotnet-class-library#environment-variables

- 我从.git中删除了local.setting.json然后也没有得到

- i removed local.setting.json from .git ignore then also not getting

- 在azure中获取环境变量是否有任何解决方案请建议我 

-unable to get environment variable in azure is there any solution please suggest me 

告诉你

推荐答案

您需要添加Azure的应用程序设置功能。

You need to add in the Application settings of Azure function.

进入Azure门户 - >功能应用 - >选择您的函数
à
应用程序设置

Go into the Azure Portal -> Function Apps -> Select your Function àApplication settings

using System;
public static void Run(TimerInfo myTimer, ILogger log)
{
    log.LogInformation(


" C#Timer触发函数执行于:{DateTime.Now}");

    log.LogInformation(GetEnvironmentVariable(的" YourAppSettingName" ));

}
 
public static string GetEnvironmentVariable(string name)

{
   返回姓名+":" +  System.Environment.GetEnvironmentVariable(name,EnvironmentVariableTarget.Process);
}
"C# Timer trigger function executed at: {DateTime.Now}");     log.LogInformation(GetEnvironmentVariable("YourAppSettingName")); }   public static string GetEnvironmentVariable(string name) {     return name + ": " + System.Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.Process); }


这篇关于从visual studio部署功能应用程序后,在azure门户中获取环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆