在经典ASP中连接到Azure数据库的最佳方法 [英] The Best Way to Connect to Azure Database in Classic ASP

查看:88
本文介绍了在经典ASP中连接到Azure数据库的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们希望连接到托管在Azure上的数据库,而无需在VBScript的源文件中对纯文本凭据进行硬编码(并通过数据库连接运行查询).以下是我们如何连接数据库 现在:

We are wanting to make connection to our database that is hosted on Azure without having plain text credentials hard-coded in the source files in VBScript (and run queries through the DB connection). The following is how we are making connection to the database right now:

昏昏欲睡的Conn
设置Conn = Server.CreateObject("ADODB.Connection")
theConn.Open" Provider = sqloledb;数据源= DBName.windows.net;网络库= DBMSSOCN;初始目录=目录;",用户名",密码"

Dim theConn
Set theConn = Server.CreateObject("ADODB.Connection")
theConn.Open "Provider=sqloledb; Data Source=DBName.windows.net; Network Library=DBMSSOCN; Initial Catalog=catalog;", "username", "password"

但是我们不想对源文件中的凭据进行硬编码,并希望使用Azure Key Vault解决此问题.

But we do not want to hard code the credentials in the source file and are hoping to use Azure Key Vault to resolve this problem.

因此,我们将数据库的连接字符串作为密码放入Azure Key Vault,并尝试访问该密码以建立与数据库的连接.但这似乎并不十分有效.

So we put the connection string of the database into Azure Key Vault as a secret, and trying to access the secret to make a connection to the database. But it doesn't seem to be working really well.

在以下情况下,我们访问Azure数据库的最佳方法是什么:

What is the best way for us to access an Azure Database based on the following situations:

1.该网络应用程序是用经典ASP(vbscript)编写的,我们不想不想花太多时间将其迁移到较新的框架或语言上

1. The web apps are written in Classic ASP (vbscript) and we do not want to spend too much time migrating it to a newer framework or language

2.该Web应用程序托管在Azure App Services中

2. The web app is hosted in Azure App Services

3.我尝试将连接字符串放在应用程序服务"下的应用程序设置"中,并在Web应用程序的VBScript中将其作为环境变量进行访问,但是它不起作用

3. I tried putting the connection string in the Application Settings under App Services, and accessing it as an environment variable in VBScript in the web app, but it did not work

4.所有页面都位于.asp而不是.aspx

4. All the pages are in .asp instead of .aspx


如果有更好的方法可以做到这一点,请告诉我!

If there is a better way to do this, please let me know!

谢谢!


推荐答案

我对经典ASP不太熟悉,但是您在门户中添加的连接字符串或应用程序设置已注入到该过程中作为运行时的环境变量,只要您可以在经典ASP中调用环境变量就可以.

I'm not very familiar with classic ASP but the connection string or app settings you add in the portal are injected into the process as environment variables at runtime so as long as you can call environment variables in classic ASP this would work.

https://docs.microsoft.com/zh-CN -us/azure/app-service/web-sites-configure#app-settings


这篇关于在经典ASP中连接到Azure数据库的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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