Java: Manage Azure Container Service (AKS) and more

We released 1.4 of the Azure Management Libraries for Java. This release adds support for Azure Container Service (AKS) and more.

Getting started

Add the following dependency fragment to your Maven POM file to use 1.4 version of the libraries:


Create Kubernetes Cluster in Azure Container Service (AKS)

You can create a Kubernetes cluster by using a define() … create() method chain.

KubernetesCluster kubernetesCluster = azure.kubernetesClusters().define(aksName)
    .withDnsPrefix("dns-" + aksName)

You can instantiate a Kubernetes client using a community developed Kubernetes client library.

ernetesClient kubernetesClient = new DefaultKubernetesClient(config);

Deploy from Container Registry to Kubernetes Cluster

You can deploy an image from Azure Container Registry to a Kubernetes cluster using the same community developed Kubernetes client library and an image pull secret associated with the Container Registry.

ReplicationController rc = new ReplicationControllerBuilder()
        .addToLabels("acrsample-nginx", "nginx")
                  .addToLabels("acrsample-nginx", "nginx")

You can find the full sample code to deploy an image from container registry to Kubernetes cluster in Azure Container Service (AKS).

Apply Lock to Virtual Machine

You can create and apply a lock to a virtual machine by using a define() … create() method chain.

lockVirtualMachineRO = azure.managementLocks().define("virtualMachineLockRO")

You can find the full sample code to manage resource locks.

Create Express Route Circuit Peering

You can create an Express Route Circuit by using a define() … create() method chain.

ExpressRouteCircuit erc = azure.expressRouteCircuits().define(ercName)
    .withPeeringLocation("Silicon Valley")

Then, you can create an Express Route Circuit Peering by using another define() … create() method chain.


You can find the full sample code to create and configure Express Route Circuits.

Try it

You can get more samples from our GitHub repo. Give it a try and let us know what you think (via e-mail or comments below).
You can find plenty of additional info about Java on Azure at

Source: Azure Blog Feed

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.