简体   繁体   English

来自Azure网站的敏感数据

[英]Sensitive Data from Azure Websites

I want to be able to get a connection string and email password safely from my web app on Azure. 我希望能够从Azure上的Web应用程序安全地获取连接字符串和电子邮件密码。 I currently have these values stored in my web.config file but understand this is a bad idea for security especially as I plan to opensource my site which would make this option unfeasible. 我目前将这些值存储在我的web.config文件中,但了解这对安全性不是一个好主意,尤其是当我计划开源我的网站时,这会使该选项不可行。

I am an Azure user and understand that you can access these values from the Azure portal however I am yet to be able to do so as my code fails with this error message: 我是Azure用户,并且了解您可以从Azure门户访问这些值,但是由于我的代码因以下错误消息而失败,因此我尚无法这样做:

The ConnectionString property has not been initialized.

I am using the following code in an attempt to gain access to my password (which is stored in the azure management app settings) and connection string (also available on Azure) 我正在使用以下代码来尝试访问我的密码(存储在azure管理应用程序设置中)和连接字符串(也可在Azure上使用)

private string connectionString = Environment.GetEnvironmentVariable("SQLAZURECONNSTR_bitverifydb");
private string emailPassword = Environment.GetEnvironmentVariable("APPSETTING_Password");

Is something needed in web.config or am I doing something else wrong? 在web.config中是否需要某些东西,或者我在做其他错误吗? How does one access such values from Azure properly? 如何从Azure正确访问此类值?

Thanks for your help! 谢谢你的帮助!

There was a recent new service called Azure Key Vault for this kind of scenario. 针对这种情况,最近有一项名为Azure Key Vault的新服务。

Basically , you create and manage the Keys/Secrets on this service and consume them on your apps as URIs. 基本上 ,您可以在此服务上创建和管理密钥/秘密,并将其作为URI在您的应用程序中使用。

Here is a quick guide to use it on a .Net Web app. 这是在.Net Web应用程序上使用它的快速指南

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM