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, and scale out Windows and Linux virtual machines in Azure from your code with the management API.
Add a dependency to your Maven pom.xml
file to use the management API in your project.
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-mgmt-compute</artifactId>
<version>1.3.0</version>
</dependency>
Example
Create a new Linux virtual machine in a new Azure resource group.
VirtualMachine newLinuxVm = azure.virtualMachines().define(linuxVmName)
.withRegion(Region.US_EAST)
.withNewResourceGroup("myResourceGroup")
.withNewPrimaryNetwork("10.0.0.0/28")
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
.withRootUsername(userName)
.withSshKey(key)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.create();
Samples
Manage virtual machines
Manage virtual networks
Create a virtual machine from a custom image
Create virtual machines across regions in parallel
Create a virtual machine scale set with a load balancer
Explore more sample Java code for Azure virtual machines you can use in your apps.
Feedback
Submit and view feedback for