且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

SSIS:动态连接字符串集成安全模式的配置

更新时间:2023-02-03 08:33:54

当在一个环境中必须使用 SQL 身份验证,而在另一个环境中 - AD 身份验证时,您需要处理这种情况.
这可以在 SSIS 目录环境 变量.创建项目文件时,Visual Studio 会自动为每个 OLEDB 连接管理器创建以下所谓的项目连接参数:

You need to handle situation when in one environment you have to use SQL Authentication, and on the other - AD Authentication.
This can be done with help of SSIS Catalog Environment variables. When you create a Project file, Visual Studio automatically creates the following so called project connection parameters for each OLEDB connection manager :

  • CM..ConnectionString
  • CM..InitialCatalog
  • CM..Password 创建为敏感参数
  • CM..ServerName
  • CM..UserName

OLEDB 就是一个例子,SSIS 为其他连接管理器类型创建了类似的参数.重要事实,您不必创建额外的项目参数.提到的参数是在正在构建的项目中创建的,并且存在于所有项目中.

OLEDB is an example, SSIS creates similar parameters for other connection manager types. Important fact, you do not have to create additional project parameters. The parameters mentioned are created on project being built and are present on all projects.

我们创建环境变量,指定连接字符串、数据库名称(初始目录)、服务器名称等.好东西 - 首先应用连接字符串变量,然后用其他变量修改.
有关这些参数的更多详细信息,请参见 MS 文档.

We create environment variables which specify connection string, DB name (initial catalog), Server Name etc. Good thing - Connection string variable is applied first, and then amended with the other variables.
More details on these parameters is in MS Docs.

如果与您的情况类似,在开发环境中 - 使用 SQL Auth 为 SQL Auth 定义 Conn 字符串并在相应的变量中指定用户名和密码.在使用 SSPI 的 QA 环境中 - 为 SSPI 重新设计了连接字符串,用户名和密码环境变量为空.

In case similar to yours, in Dev environment - using SQL Auth define Conn string for SQL Auth and specify username and password in corresponding variables. In QA env where SSPI is used - the Connection string is reworked for SSPI, UserName and Password environment variables are empty.