• 2 min read

Simpler Azure Management Libraries for Java – Beta 3

Beta 3 adds support for the following Azure services and features • Virtual machine scale sets • Load balancers • Parallel creation of virtual machines and other resources • Virtual machine extensions • Key vault and • Batch

Beta 3 adds support for the following Azure services and features

  • Virtual machine scale sets
  • Load balancers
  • Parallel creation of virtual machines and other resources
  • Virtual machine extensions
  • Key vault and
  • Batch

https://github.com/azure/azure-sdk-for-java

In July, we announced a developer preview of the new, simplified Azure management libraries for Java. Our goal is to improve the developer experience by providing a higher-level, object-oriented API, optimized for readability and writability. Thank you for trying the libraries and providing us with plenty of useful feedback.

Create a Virtual Machine Scale Set

You can create a virtual machine scale set instance by using another define() … create() method chain.

VirtualMachineScaleSet virtualMachineScaleSet = azure.virtualMachineScaleSets()
    .define(vmssName)
    .withRegion(Region.US_EAST)
    .withExistingResourceGroup(rgName)
    .withSku(VirtualMachineScaleSetSkuTypes.STANDARD_D3_V2)
    .withExistingPrimaryNetworkSubnet(network, "Front-end")
    .withPrimaryInternetFacingLoadBalancer(loadBalancer)
    .withPrimaryInternetFacingLoadBalancerBackends(backendPoolName)
    .withPrimaryInternetFacingLoadBalancerInboundNatPools(natPool50XXto22)
    .withoutPrimaryInternalLoadBalancer()
    .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
    .withRootUserName(userName)
    .withSsh(sshKey)
    .withNewStorageAccount(storageAccountName1)
    .withNewStorageAccount(storageAccountName2)
    .withCapacity(2)
    .create();

Create a Network Load Balancer

You can create a network load balancer instance by using another define() … create() method chain.

LoadBalancerloadBalancer=azure.loadBalancers().define(loadBalancerName)
	.withRegion(Region.US_EAST)
	.withExistingResourceGroup(rgName)
	.definePublicFrontend(frontendName)
		.withExistingPublicIpAddress(publicIpAddress)
		.attach()
	
	// Add a backend pool for HTTP
	.defineBackend(backendPoolName)
		.attach()
	
	// Add a probe for HTTP
	.defineHttpProbe(httpProbe)
		.withRequestPath("/")
		.withPort(80)
		.attach()
	
	// Add a load balancing rule that uses the above backend and probe
	.defineLoadBalancingRule(httpLoadBalancingRule)
		.withProtocol(TransportProtocol.TCP)
		.withFrontend(frontendName)
		.withFrontendPort(80)
		.withProbe(httpProbe)
		.withBackend(backendPoolName)
	       .attach()
	
	// Add a NAT pool to enable direct VM connectivity for
	//  SSH to port 22
	.defineInboundNatPool(natPool50XXto22)
		.withProtocol(TransportProtocol.TCP)
		.withFrontend(frontendName)
		.withFrontendPortRange(5000,5099)
		.withBackendPort(22)
		.attach()
	.create();

Sample Code

You can find plenty of sample code that illustrates management scenarios in Azure Virtual Machines, Virtual Machine Scale Sets, Storage, Networking, Resource Manager, Key Vault and Batch …

Service Management

Virtual Machines

Virtual Machines – parallel execution

Virtual Machine Scale Sets

Storage

Network

Resource Groups

Key Vault

Batch

Give it a try

You can run the samples above or go straight to our GitHub repo. Give it a try and let us know what do you think (via e-mail or comments below), particularly –

  • Usability and effectiveness of the new management libraries for Java?
  • What Azure services you would like to see supported soon?
  • What additional scenarios should be illustrated as sample code?

The next preview version of the Azure Management Libraries for Java is a work in-progress. We will be adding support for more Azure services and tweaking the API over the next few months.

You can find plenty of additional info about Java on Azure at https://azure.com/java.