Azure数据工厂管道:使用Python:Authentication创建管道(通过az cli)
我正在尝试通过python创建azure数据工厂管道,使用Microsoft提供的示例: Microsofts身份验证文档建议我可以使用以前建立的会话进行身份验证,如下所示:Azure数据工厂管道:使用Python:Authentication创建管道(通过az cli),python,azure,azure-data-factory-2,Python,Azure,Azure Data Factory 2,我正在尝试通过python创建azure数据工厂管道,使用Microsoft提供的示例: Microsofts身份验证文档建议我可以使用以前建立的会话进行身份验证,如下所示: from azure.common.client_factory import get_client_from_cli_profile from azure.mgmt.compute import ComputeManagementClient client = get_client_from_cli_profile(
from azure.common.client_factory import get_client_from_cli_profile
from azure.mgmt.compute import ComputeManagementClient
client = get_client_from_cli_profile(ComputeManagementClient)
(参考号:)
这是可行的,但是azure data factory对象实例化失败,原因是:
Traceback (most recent call last):
File "post-scripts/check-data-factory.py", line 72, in <module>
main()
File "post-scripts/check-data-factory.py", line 65, in main
df = adf_client.factories.create_or_update(rg_name, data_factory_name, df_resource)
AttributeError: 'ComputeManagementClient' object has no attribute 'factories'
回溯(最近一次呼叫最后一次):
文件“post scripts/check data factory.py”,第72行,在
main()
文件“post scripts/check data factory.py”,第65行,主目录
df=adf\u client.factories.create\u或更新(rg\u名称、数据\u工厂名称、df\u资源)
AttributeError:“ComputeManagementClient”对象没有属性“Factorys”
所以在这和获取df对象之间可能需要一些额外的步骤
任何线索,谢谢 只需将类替换为正确的类型:
from azure.common.client_factory import get_client_from_cli_profile
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.datafactory import DataFactoryManagementClient
resource_client = get_client_from_cli_profile(ResourceManagementClient)
adf_client = get_client_from_cli_profile(DataFactoryManagementClient)
出现的错误是因为您创建了一个计算客户端(用于处理VM),而不是ADF客户端。但是是的,你找到了适合你需要的医生:)
(披露:我在微软的Python SDK团队工作)FYI,我在那个代码示例中遇到了这个错误:…我对这个问题发表了评论,要求解决或修复。你知道我如何在过渡期间解决这个问题吗?谢谢你的链接我不知道,我做了一个公关来解决它
Traceback (most recent call last):
File "post-scripts/check-data-factory.py", line 72, in <module>
main()
File "post-scripts/check-data-factory.py", line 65, in main
df = adf_client.factories.create_or_update(rg_name, data_factory_name, df_resource)
AttributeError: 'ComputeManagementClient' object has no attribute 'factories'
from azure.common.client_factory import get_client_from_cli_profile
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.datafactory import DataFactoryManagementClient
resource_client = get_client_from_cli_profile(ResourceManagementClient)
adf_client = get_client_from_cli_profile(DataFactoryManagementClient)