python - 使用 Python 列出订阅中的所有 Azure 数据工厂

标签 python azure azure-data-factory

我正在尝试使用以下代码列出订阅中的所有 Azure Datafactories。我知道工厂操作类中的“列表”没有正确定义,但我没有从文档中获得有关其使用示例的太多信息,如果有的话请告知。 #newtopython

     from azure.mgmt.resource import ResourceManagementClient
     from azure.mgmt.datafactory import DataFactoryManagementClient
     from DataFactoryManagement import list
     from azure.mgmt.datafactory.models import *
     from datetime import datetime, timedelta
     import time
     credentials = ServicePrincipalCredentials(
         client_id='#####################',
         secret='###########',
         tenant='#############################'
     )
     subscription_id = '################'
     client = DataFactoryManagementClient(credentials, subscription_id)
     adf = client.factories:list()
     print (adf)

最佳答案

如果要列出订阅中的所有 ADF,则需要使用 list方法,在我这边效果很好。

示例:

from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.datafactory import DataFactoryManagementClient

subscription_id = 'xxxxx'
credentials = ServicePrincipalCredentials(client_id='xxxxx', secret='xxxxx', tenant='xxxxx')
adf_client = DataFactoryManagementClient(credentials, subscription_id)

Factories = adf_client.factories.list()
for factory in Factories:
    print(factory)

enter image description here

关于python - 使用 Python 列出订阅中的所有 Azure 数据工厂,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62996295/

相关文章:

python - 如何将数据帧从长转换为宽,值在索引中按年份分组?

python - 如何正确对 unicode 数据进行制表

sql-server - 我可以删除 SQL Server 安装引导日志文件吗?是否有一个设置可以自动管理这些文件?

Azure 数据缓存和区域

azure - 使用 ADF 复制一组文件

azure - 如何将 Azure 数据工厂与 SQL 端点连接而不是交互式集群?

python - SKLearn 朴素贝叶斯 : add feature after tfidf vectorization

python - 为什么 Pycharm 不知道将哪些参数传递给继承的 Python 数据类 __init__?

postgresql - 为什么无法将标签添加到 terraform 模块中

oracle - 将 SDO_GEOMETRY 类型序列化为文本非常慢