Virtuele Azure-machinebibliotheken

Overzicht

Schaalbare computerresources op aanvraag met Linux of Windows.

Zie Een virtuele Linux-machine maken met de Azure Portal om aan de slag te gaan met Azure Virtual Machines.

Beheer-API

Maak, configureer, beheer en schaal virtuele Windows- en Linux-machines in Azure vanuit uw code met de beheer-API.

Installeer de bibliotheek via pip.

pip install azure-mgmt-compute

Voorbeeld

Maak een nieuwe virtuele Linux-machine in een bestaande Azure-resourcegroep met MSI-verificatie (Managed Service Identity).

VM_PARAMETERS={
        'location': 'LOCATION',
        'os_profile': {
            'computer_name': 'VM_NAME',
            'admin_username': 'USERNAME',
            'admin_password': 'PASSWORD'
        },
        'hardware_profile': {
            'vm_size': 'Standard_DS1_v2'
        },
        'storage_profile': {
            'image_reference': {
                'publisher': 'Canonical',
                'offer': 'UbuntuServer',
                'sku': '16.04.0-LTS',
                'version': 'latest'
            },
        },
        'network_profile': {
            'network_interfaces': [{
                'id': 'NIC_ID',
            }]
        },
    }

def create_vm()
    compute_client.virtual_machines.create_or_update(
        'RESOURCE_GROUP_NAME', 'VM_NAME', VM_PARAMETERS)

Voorbeelden

Bekijk de volledige lijst met voorbeelden van virtuele machines.