Azure Python SDK-获取自动化帐户中的更新管理信息

时间:2019-07-22 10:52:25

标签: python azure azure-sdk-python

我的要求是在自动化帐户中提取有关更新管理的信息。我需要获取更新管理中计算机的详细信息。有什么办法可以获取有关这些机器的信息。我在下面的代码中尝试了几件事。但是仍然无法更新管理。

from azure.common.credentials import UserPassCredentials
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.compute import ComputeManagementClient
from azure.mgmt.automation import AutomationClient
from azure.mgmt.automation.operations.automation_account_operations import AutomationAccountOperations
from azure.mgmt.automation import operations


GROUP_NAME = 'patching'
AUTOMATION_ACCOUNT_NAME = 'account-name'

subscription_id = '111111-11111111-1111-111111'

credentials = UserPassCredentials(
    'account_name@abc.com',
    '123456'
)


client = ResourceManagementClient(credentials, subscription_id)
compute_client = ComputeManagementClient(credentials,subscription_id)
automation_client = AutomationClient(credentials,subscription_id)

def get_automation_details():
    for item in automation_client.automation_account.list_by_resource_group(GROUP_NAME):
        print(item.name)

def get_job_details():
    for item in automation_client.job.list_by_automation_account(GROUP_NAME,AUTOMATION_ACCOUNT_NAME):
        print("job name:" ,item.name,"job id:",item.job_id,"job status:",item.status)

def get_hybrid_runbook_workers():
    item =automation_client.hybrid_runbook_worker_group.list_by_automation_account(GROUP_NAME,AUTOMATION_ACCOUNT_NAME)
    for items in item:
        print(items)

我能够使用hybrid_runbook_worker_group获取节点,但无法在更新管理中获取那些节点的属性。我需要一种查询更新管理和其中的计算机信息的方法。有办法吗?

谢谢

0 个答案:

没有答案