使用Python从Azure中的磁盘创建Linux虚拟机



我想使用Python中的Azure中的磁盘创建Linux虚拟机。我找到了一些链接,建议它与VHD一起做某事,但没有清楚地解释如何做到这一点。任何人都可以使用Python解释答案(不在CLIpowershellJSON中(。

我转过了此文档:

VM_PARAMETERS = {
            'location': LOCATION,
            'os_profile': {
                'computer_name': VM_NAME,
                'admin_username': USERNAME,
                'admin_password': PASSWORD
            },
            'hardware_profile': {
                'vm_size': 'Basic_A0'
            },
            'storage_profile': {
                'image_reference': {
                    'publisher': 'Canonical',
                    'offer': 'UbuntuServer',
                    'sku': '16.04.0-LTS',
                    'version': 'latest'
                },
            },
            'network_profile': {
                'network_interfaces': [{
                    'id': nic_id,
                }]
            },
}
compute_client.virtual_machines.create_or_update(GROUP_NAME, VM_NAME, VM_PARAMETERS)

请帮助我。

您特别问...

任何人都可以使用python 解释答案(不是在CLI或POWERSHELL或JSON中(

然而,您在PowerShell Q&一个论坛中问问题。

您不应该在Python论坛上问问题吗?https://stackoverflow.com/questions/tagged/python

所说的话。VHD是虚拟硬盘。为了旋转虚拟机,您必须先将一个安装到VM。

如何使用Azurerm Python库创建Azure VM

使用至少两种使用Azure基础架构的方法 Python。您可以将官方的Azure SDK用于支持Python 所有的Azure功能或Azurerm REST包装库, 非官方并支持Azure REST API的子集。

https://msftstack.wordpress.com/2016/08/05/how-to-to-to-create-an-azure-vm-with-with-the-azurerm-python-library

最新更新