Azure virtual machine libraries
Overview
On-demand, scalable computing resources running Linux or Windows.
To get started with Azure Virtual Machines, see Create a Linux virtual machine with the Azure portal.
Management API
Create, configure, manage and scale Windows and Linux virtual machines in Azure from your code with the management API.
Install the library via pip.
pip install azure-mgmt-compute
Example
Create a new Linux virtual machine in an existing Azure resource group with Managed Service Identity(MSI) authentication.
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)
Samples
- Manage virtual machines
- Create a virtual machine with Managed Service Identity Extension
- Manage a load balancer
- Create and configure managed disks
- Monitor virtual machines
View the complete list of virtual machine samples.
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Azure SDK for Python