微软为azure创建了一个反人类api。如何通过蔚蓝python重新启动虚拟机?一些演示代码会很棒。
发布于 2017-04-05 10:16:10
虽然这是旧的,但这里有一个示例代码:
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.compute import ComputeManagementClient
credentials = ServicePrincipalCredentials(client_id=clientid, secret=secret,
tenant=tenantid)
compute_client = ComputeManagementClient(credentials, subscriptionid)
vm_restart = compute_client.virtual_machines.restart(resource_group_name, vm_name)
vm_restart.wait()
vm_instance = compute_client.virtual_machines.get(resource_group_name, vm_name)
其中vm_instance是包含其所有混杂信息的VM对象。
https://stackoverflow.com/questions/27264837
复制相似问题