【问题标题】:How to use Azure key vault for storing connection string of SQL Server as secret in Azure Data Factory如何使用 Azure 密钥保管库将 SQL Server 的连接字符串存储为 Azure 数据工厂中的机密
【发布时间】:2021-09-10 08:07:07
【问题描述】:

我正在尝试将 SQL Server 的连接字符串存储在 Azure keyvault 中,并在 azure datafactory 的链接服务中使用相同的机密。

我正在尝试指定存储目标 Azure SQL 数据库链接服务的连接字符串的 Azure Key Vault 机密的名称

Server=tcp:<servername>.database.windows.net,3342;Database=<databasename>;User ID=<username>@<servername>;Password=<password>;Trusted_Connection=False;Encrypt=True;Connection Timeout=30

但面临以下错误:

无法连接到 SQL 数据库:'tcp:xxxx.database.windows.net,3342',数据库:'databasename',用户:'username@servername'。检查链接服务配置是否正确,并确保 SQL 数据库防火墙允许集成运行时访问。用户 'username@servername' 登录失败。SqlErrorNumber=18456,Class=14,State=1, Activity ID: 20aa7503-3b71-4539-a658-a2b5be87278f。

谁能帮我在使用 AKV 的 ADF 链接服务中创建和使用连接字符串。

【问题讨论】:

  • 因此,您是否为您的连接设置了防火墙策略? make sure the SQL Database firewall allows the integration runtime to access
  • 为什么你的端口是3342? Azure SQL 数据库端口号为 1433。

标签: sql-server azure azure-data-factory azure-keyvault


【解决方案1】:

这似乎是 SQL 服务器防火墙阻止 Azure 集成运行时 IP 地址的问题。请在安全下的Portal -> Firewalls and virtual networks选项中进入SQL server,并启用Allow Azure Services and resources to access this server

要知道需要在防火墙规则中添加的 IP 地址,只需在数据库中运行任何 SQL 查询,就会出现要求将 IP 列入白名单的错误消息。单击该错误消息或在防火墙下的规则名称中手动添加 IP。

除此之外,您需要在 Key Vault Secret Value 中添加数据库连接字符串,然后在 ADF SQL 数据库链接服务中添加密码名称并检查连接(在粘贴到 Secret 的值之前的连接字符串)。在访问策略中授予对密钥的读取权限(GET 和 List)。

为您之前创建的 Key Vault 创建 ADF 链接服务并检查连接。

使用该 Key Vault 链接服务,创建 SQL 数据库链接服务并检查连接。

有关使用 Azure Key Vault 连接 ADF 中的 SQL 数据库的分步实施,请参阅 link

【讨论】:

    猜你喜欢
    • 2018-06-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-18
    • 2021-09-12
    • 2020-08-25
    • 2020-02-18
    相关资源
    最近更新 更多