【问题标题】:"Bad Request" when creating an SQLServerLinkedService创建 SQLServerLinkedService 时出现“错误请求”
【发布时间】:2021-05-02 23:55:33
【问题描述】:

我正在尝试从 Python 中为 Azure 数据工厂创建 SQL Server 链接服务。导入所有依赖项并成功创建数据工厂。创建链接服务失败。

这是我从 Python 运行的伪代码:

  ls_name = 'Blah'
    
  properties = SqlServerLinkedService(
        connection_string="blahblah.database.windows.net",
        connect_via={"referenceName": "AutoResolveIntegrationRuntime", "type": "IntegrationRuntimeReference"},
        user_name="my-user-name",
        password=SecureString("my-plaintext-password")
    )


    ls = adf_client.linked_services.create_or_update( resource_group_name=rg_name, factory_name=df_name, linked_service_name=ls_name, linked_service=properties)

首先,如果我保持 SecureString 的格式与上面一样,我会收到关于 2 个位置参数的错误,其中只需要 1 个,如果我完全取出密码行,我会在 create_or_update 时收到“错误请求”函数在底部运行。他们非常缺乏 Microsoft Python SDK 文档。有人可以帮我弄清楚如何正确编码吗?

文件“/usr/local/lib/python3.8/dist-packages/azure/mgmt/datafactory/operations/_linked_services_operations.py”,第 190 行,在 create_or_update 引发 HttpResponseError(response=response, error_format=ARMErrorFormat) azure.core.exceptions.HttpResponseError:操作返回无效状态“错误请求”

【问题讨论】:

    标签: python azure-data-factory azure-data-factory-2


    【解决方案1】:

    我们在创建 Azure 数据工厂链接服务时遇到了同样的问题;创建链接服务时,您需要创建 LinkedServiceResource:

    ls_name = 'Blah'
        
    properties = LinkedServiceResource(properties=SqlServerLinkedService(
        connection_string="blahblah.database.windows.net",
        connect_via={"referenceName": "AutoResolveIntegrationRuntime", "type": "IntegrationRuntimeReference"},
        user_name="my-user-name",
        password=SecureString("my-plaintext-password")
        ))
    
    
    ls = adf_client.linked_services.create_or_update( resource_group_name=rg_name, factory_name=df_name, linked_service_name=ls_name, linked_service=properties)
    

    【讨论】:

      猜你喜欢
      • 2020-11-30
      • 1970-01-01
      • 2019-09-28
      • 1970-01-01
      • 2014-12-29
      • 2020-08-27
      • 2019-03-23
      • 2016-12-08
      • 2015-11-28
      相关资源
      最近更新 更多