Gå til hovedindhold

Azure Management Libraries for Java - v1.2

Udgivet den 30 august, 2017

Principal PM Architect, Java on Azure

We released 1.2 of the Azure Management Libraries for Java. This release adds support for additional security and deployment features, and more Azure services:

  • Managed service identity
  • Create users in Azure Active Directory, update service principals and assign permissions to apps
  • Storage service encryption
  • Deploy Web apps and functions using MS Deploy
  • Network watcher service
  • Search service


Getting Started

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


Create a Virtual Machine with Managed Service Identity (MSI)

You can create a virtual machine with MSI enabled using a define() … create() method chain:

VirtualMachine virtualMachine = azure.virtualMachines().define("myLinuxVM")

You can manage any MSI-enabled Azure resources from a virtual machine with MSI and add an MSI service principal to an Azure Active Directory security group.

Add New User to Azure Active Directory

You can add a new user to Azure Active Directory using a define() … create() method chain:

ActiveDirectoryUser user = authenticated.activeDirectoryUsers()

Similarly, you can create and update users and groups in Active Directory.

Enable Storage Service Encryption for a Storage Account

You can enable storage service encryption at a storage account level when you create a storage account using a define() … create() method chain:

StorageAccount storageAccount = azure.storageAccounts().define(storageAccountName)

Deploy Web apps and Functions using MS Deploy

You can use MS Deploy to deploy Web apps and functions by using the deploy() method:

// Create a Web app
WebApp webApp = azure.webApps().define(webAppName)
// Deploy a Web app using MS Deploy


// Create a function app 
FunctionApp functionApp = azure.appServices().functionApps()
// Deploy a function using MS Deploy

Create Network Watcher and start Packet Capture

You can visualize network traffic patterns to and from virtual machines by creating and starting a packet capture using a define() … create() method chain, downloading the packet capture and visualizing network traffic patterns using open source tools:

// Create a Network Watcher
Network Watcher networkWatcher = azure.networkWatchers().define(nwName)
// Start a Packet Capture
PacketCapture packetCapture = networkWatcher.packetCaptures()

Similarly, you can programmatically:

  • Verify if traffic is allowed to and from a virtual machine
  • Get the next hop type and IP address for a virtual machine
  • Retrieve network topology for a resource group
  • Analyze virtual machine security by examining effective network security rules applied to a virtual machine
  • Configure network security group flow logs.

Create a Managed Cloud Search Service

You can create a managed cloud search service (Azure Search) with replicas and partitions using a define() … create() method chain:

SearchService searchService = azure.searchServices().define(searchServiceName)

Similarly, you can programmatically:

  • Manage query keys
  • Update search service with replicas and partitions
  • Regenerate primary and secondary admin keys.

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 https://azure.com/java.