在 Azure 上定义环境变量的方式和位置 [英] How and where to define an environment variable on Azure

查看:12
本文介绍了在 Azure 上定义环境变量的方式和位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个部署到 Azure 的 ASP.NET MVC Web 应用程序.我正在使用 GetEnvironmentVariable(...) 方法读取我的设置.

I have an ASP.NET MVC web application deployed to Azure. I'm reading my setting using the GetEnvironmentVariable(...) method.

问题是我找不到在 Azure 门户中定义此环境变量的方法.我在哪里可以这样做?

The problem is that I can't find a way to define this environment variable in Azure Portal. Where can I do that?

我不想把这些东西放在一个文件里.将存在的数据是凭据.

I don't want to have this stuff in a file. Data that will be there are credentials.

推荐答案

我假设您使用的是 Azure 应用服务(以前称为 Azure 网站).

I assume you are using Azure App Service (formerly known as Azure Websites).

要定义您自己的环境变量,请单击您的站点 → 所有设置应用程序设置:

To define your own environment variable, click to your site → All SettingsApplication settings:

在应用设置"部分添加应用设置:

Add an app setting in the "App settings" section:

您可以从调试控制台验证该值.

You can verify the value from the debug console.

转到 https://{您的站点名称}.scm.azurewebsites.net/DebugConsole:

Going to https://{your site name}.scm.azurewebsites.net/DebugConsole:

这篇关于在 Azure 上定义环境变量的方式和位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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