如何使用 SSIS 脚本任务访问 Azure Key Vault?

发布于 2025-01-17 08:29:48 字数 91 浏览 5 评论 0 原文

需要使用C#中的SSIS脚本任务访问Azure密钥库,以将Azure SQL Connection String分配给SSIS中的Connection Manager。

Need to access Azure Key Vault using SSIS Script Task in C#, to assign the Azure SQL Connection String to Connection Manager in SSIS.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空‖城人不在 2025-01-24 08:29:48

为了达到上述要求,您可以参考以下解决方法。

  • 创建一个应用程序ASP.NET MVC应用程序。

  • 创建 azure keyVault Secret 用于数据库连接字符串。并从键Vault->访问策略

    授予您的应用程序许可

  • 在应用程序级别中,使用连接的服务访问K ey Vault->连接字符串的秘密,在 webconfig 中添加的代码中添加了 nuget packages 然后在您的本地测试,然后部署到Azure。

例如:

web.config

<configSections><section name="configBuilders" 
  type="System.Configuration.ConfigurationBuildersSection, 
  System.Configuration, Version=4.0.0.0, Culture=neutral, 
 PublicKeyToken=b0xxxxxxx3a" 
 restartOnExternalChanges="false" 
 requirePermission="false" />
<builders>
 <add name="AzureKeyVault" vaultName="Prod-ConSt-01"type"  Microsoft 
.Configuration.ConfigurationBuilders.AzureKeyVaultConfigBuilder,
 Microsoft.Configuration.ConfigurationBuilders.Azure, 
Version=2.0.0.0, Culture=neutral,
 PublicKeyToken=xxxxxxxx"
 vaultUri="https://mywebsite-prod-const-01.vault.azure.net/" />< 
/builders>
</configBuilders>

<connectionStrings configBuilders="AzureKeyVault">
 <add name="ProductionConnstr" connectionString="from key vault" 
   providerName="System.Data.SqlClient" />
</connectionStrings>

有关更多信息,请参阅下面的链接: -

To Achieve the above requirements , You may refer the below workaround.

  • Create an application ASP.NET MVC application.

  • Create Azure keyvault secret for the database connection string. And give permission to your app from Key Vault->Access Policy.

  • In application level use the Connected Service to access the Key Vault-> Secret for connection string , Which added in the code in webconfig and added nuget packages then test in your local and then deploy to Azure.

For example:

web.config

<configSections><section name="configBuilders" 
  type="System.Configuration.ConfigurationBuildersSection, 
  System.Configuration, Version=4.0.0.0, Culture=neutral, 
 PublicKeyToken=b0xxxxxxx3a" 
 restartOnExternalChanges="false" 
 requirePermission="false" />
<builders>
 <add name="AzureKeyVault" vaultName="Prod-ConSt-01"type"  Microsoft 
.Configuration.ConfigurationBuilders.AzureKeyVaultConfigBuilder,
 Microsoft.Configuration.ConfigurationBuilders.Azure, 
Version=2.0.0.0, Culture=neutral,
 PublicKeyToken=xxxxxxxx"
 vaultUri="https://mywebsite-prod-const-01.vault.azure.net/" />< 
/builders>
</configBuilders>

<connectionStrings configBuilders="AzureKeyVault">
 <add name="ProductionConnstr" connectionString="from key vault" 
   providerName="System.Data.SqlClient" />
</connectionStrings>

For more information please refer the below links:-

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文