Skip to content
Azure Management Libraries for Java
Branch: master
Clone or download
Latest commit 7bd3623 Jul 15, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.azure-pipelines Fix CI for checkstyle. Jul 15, 2019
.github/ISSUE_TEMPLATE Update issue templates (#697) Feb 20, 2019
azure-mgmt-appservice Add function envelope. Jul 15, 2019
azure-mgmt-batch [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-batchai [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-cdn [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-compute update compute to the latest API version (#737) Jul 9, 2019
azure-mgmt-containerinstance [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-containerregistry [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-containerservice [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-cosmosdb update test session records. Jul 15, 2019
azure-mgmt-datalake-analytics [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-datalake-store [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-dns [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-eventhub [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-graph-rbac [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-keyvault [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-locks [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-monitor update compute to the latest API version (#737) Jul 9, 2019
azure-mgmt-msi
azure-mgmt-network [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-redis [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-resources update compute to the latest API version (#737) Jul 9, 2019
azure-mgmt-search [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-servicebus Fix servicebustests (#778) Jul 9, 2019
azure-mgmt-sql [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-storage [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-mgmt-trafficmanager [maven-release-plugin] prepare for next development iteration Jun 26, 2019
azure-samples Updating samples owner, fixing compilation errors in the generated sa… Jul 15, 2019
azure update compute to the latest API version (#737) Jul 9, 2019
ci Add ADO CI build config (#750) Jun 27, 2019
dev-notes Adding notes describing how to work with Canary (#714) Mar 14, 2019
notes Update notes for java 1.23.0 release. (#769) Jun 26, 2019
tools Remove push part in publish.py Oct 21, 2017
.gitignore fluent version of latest ACR stable release 2018-09 (#635) Dec 4, 2018
.travis.yml fixing CI (#324) Mar 18, 2018
AUTH.md [Auth.md update] Adding MSICredentials and AppServiceMSICredentials (#… Dec 4, 2018
CONTRIBUTING.md Merge pull request #896 from alvadb/master Oct 21, 2017
ChangeLog.txt Merge branch 'autorest' of github.com:Azure/azure-sdk-for-java into a… Oct 21, 2017
LICENSE.txt Merge branch 'autorest' of github.com:Azure/azure-sdk-for-java into a… Oct 21, 2017
README.md Update notes for java 1.23.0 release. (#769) Jun 26, 2019
api-specs.json update compute to the latest API version (#737) Jul 9, 2019
appveyor.yml [release] Bump up version to 1.0.0-beta3 Oct 21, 2017
bundler.properties Add bundler properties for devops publishing (#727) Apr 16, 2019
gulpfile.js Added javadoc generation for gh-pages branch (#205) Mar 2, 2018
jetty.xml Add ADO CI build config (#750) Jun 27, 2019
localsettings.properties [maven-release-plugin] prepare release v1.2.0 Oct 21, 2017
my.azureauth.txt.enc
package.json Updating Traffic Manager api-version to 2018-04 (#636) Nov 4, 2018
pom.xml Add ADO CI build config (#750) Jun 27, 2019
serial.output ACI: 2018 10 update (#744) Jun 21, 2019
spotbugs-excludeFilter.xml Bug fixes for issues found while running spotbugs tool (#353) Mar 20, 2018
spotbugs-includeFilter.xml Add spotbugs plugin, iclude only and exclude filter lists. (#234) Mar 9, 2018
swagger_to_sdk_config.json Update swagger_to_sdk_config.json (#242) Mar 9, 2018
translation.properties ACI: add missing annotations for Java to .NET conversion (#549) Aug 22, 2018
versionConfig.csv increment versions for 1.23 release Jun 26, 2019

README.md

Build Status

Azure Management Libraries for Java

This README is based on the released stable version (1.23.0). If you are looking for other releases, see More Information.

The Azure Management Libraries for Java is a higher-level, object-oriented API for managing Azure resources, that is optimized for ease of use, succinctness and consistency.

If you are looking for Java client libraries for consuming (rather than managing) individual Azure services (e.g. storage blob upload, JDBC, messaging, etc), please see https://docs.microsoft.com/en-us/java/azure/java-sdk-azure-install.

Table of contents

Feature Availability and Road Map

🚩 as of Version 1.23.0

Service | feature Available as GA Available as Preview Coming soon
Compute Virtual machines and VM extensions
Virtual machine scale sets
Managed disks
Azure container service (AKS) + registry + instances
Availability Zones
More Availability Zones and MSI features
Storage Storage accounts
Encryption (deprecated)
Encryption (Blob)
Encryption (File)
SQL Database Databases
Firewalls and virtual network
Elastic pools
Import, export, recover and restore dbs
Failover groups and replication links
DNS aliasing and metrics
Sync groups
Encryption protectors
More features
Networking Virtual networks
Network interfaces
IP addresses
Routing table
Network security groups
Load balancers
Application gateways
DNS
Traffic managers
Network peering
Virtual Network Gateway
Network watchers
Express Route
Application Security Groups
More application gateway features
More services Resource Manager
Key Vault
Redis
CDN
Batch
Service bus
Graph RBAC
Web apps
Function Apps
Cosmos DB
Monitor
Batch AI
Search
Event Hub
Data Lake
More Monitor features
Logic Apps
Event Grid
Fundamentals Authentication - core
Async methods
Managed Service Identity

Preview features are marked with the @Beta annotation at the class or interface or method level in libraries. These features are subject to change. They can be modified in any way, or even removed, in the future.

Code snippets and samples

Azure Authentication

The Azure class is the simplest entry point for creating and interacting with Azure resources.

Azure azure = Azure.authenticate(credFile).withDefaultSubscription();

To learn more about authentication in the Azure Libraries for Java, see AUTH.md.

Virtual Machines

Create a Virtual Machine

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

System.out.println("Creating a Linux VM");

VirtualMachine linuxVM = azure.virtualMachines().define("myLinuxVM")
	.withRegion(Region.US_EAST)
	.withNewResourceGroup(rgName)
	.withNewPrimaryNetwork("10.0.0.0/28")
	.withPrimaryPrivateIPAddressDynamic()
	.withNewPrimaryPublicIPAddress("mylinuxvmdns")
	.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
	.withRootUsername("tirekicker")
	.withSsh(sshKey)
	.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
	.create();

System.out.println("Created a Linux VM: " + linuxVM.id());

Update a Virtual Machine

You can update a virtual machine instance by using an update() … apply() method chain.

linuxVM.update()
	.withNewDataDisk(20,  lun,  CachingTypes.READ_WRITE)
	.apply();

Create a Virtual Machine Scale Set

You can create a virtual machine scale set instance by using a 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(loadBalancer1)
     .withPrimaryInternetFacingLoadBalancerBackends(backendPoolName1, backendPoolName2)
     .withPrimaryInternetFacingLoadBalancerInboundNatPools(natPool50XXto22, natPool60XXto23)
     .withoutPrimaryInternalLoadBalancer()
     .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
     .withRootUsername(userName)
     .withSsh(sshKey)
     .withNewDataDisk(100)
     .withNewDataDisk(100, 1, CachingTypes.READ_WRITE)
     .withNewDataDisk(100, 2, CachingTypes.READ_WRITE, StorageAccountTypes.STANDARD_LRS)
     .withCapacity(3)
     .create();

Ready-to-run code samples for virtual machines

Service Management Scenario
Virtual Machines
Virtual Machines - parallel execution
Virtual Machine Scale Sets

Networking

Create a virtual network

You can create a virtual network by using a define() … create() method chain.

Network network = networks.define("mynetwork")
	.withRegion(Region.US_EAST)
	.withNewResourceGroup()
	.withAddressSpace("10.0.0.0/28")
	.withSubnet("subnet1", "10.0.0.0/29")
	.withSubnet("subnet2", "10.0.0.8/29")
	.create();

Create a network security group

You can create a network security group instance by using a define() … create() method chain.

NetworkSecurityGroup frontEndNSG = azure.networkSecurityGroups().define(frontEndNSGName)
    .withRegion(Region.US_EAST)
    .withNewResourceGroup(rgName)
    .defineRule("ALLOW-SSH")
        .allowInbound()
        .fromAnyAddress()
        .fromAnyPort()
        .toAnyAddress()
        .toPort(22)
        .withProtocol(SecurityRuleProtocol.TCP)
        .withPriority(100)
        .withDescription("Allow SSH")
        .attach()
    .defineRule("ALLOW-HTTP")
        .allowInbound()
        .fromAnyAddress()
        .fromAnyPort()
        .toAnyAddress()
        .toPort(80)
        .withProtocol(SecurityRuleProtocol.TCP)
        .withPriority(101)
        .withDescription("Allow HTTP")
        .attach()
    .create();

Create an Application Gateway

You can create a application gateway instance by using a define() … create() method chain.

ApplicationGateway applicationGateway = azure.applicationGateways().define("myFirstAppGateway")
    .withRegion(Region.US_EAST)
    .withExistingResourceGroup(resourceGroup)
    // Request routing rule for HTTP from public 80 to public 8080
    .defineRequestRoutingRule("HTTP-80-to-8080")
        .fromPublicFrontend()
        .fromFrontendHttpPort(80)
        .toBackendHttpPort(8080)
        .toBackendIPAddress("11.1.1.1")
        .toBackendIPAddress("11.1.1.2")
        .toBackendIPAddress("11.1.1.3")
        .toBackendIPAddress("11.1.1.4")
        .attach()
    .withExistingPublicIPAddress(publicIpAddress)
    .create();

Ready-to-run code samples for networking

Service Management Scenario
Networking
DNS
Traffic Manager
Application Gateway
Express Route

Application Services

Create a Web App

You can create a Web App instance by using a define() … create() method chain.

WebApp webApp = azure.webApps()
    .define(appName)
    .withRegion(Region.US_WEST)
    .withNewResourceGroup(rgName)
    .withNewWindowsPlan(PricingTier.STANDARD_S1)
    .create();

Ready-to-run code samples for Application Services

Service Management Scenario
Web Apps on Windows
Web Apps on Linux
Functions

Databases and Storage

Create a Cosmos DB with CosmosDB Programming Model

You can create a Cosmos DB account by using a define() … create() method chain.

CosmosAccount cosmosDBAccount = azure.cosmosDBAccounts().define(cosmosDBName)
	.withRegion(Region.US_EAST)
	.withNewResourceGroup(rgName)
	.withKind(DatabaseAccountKind.GLOBAL_DOCUMENT_DB)
	.withSessionConsistency()
	.withWriteReplication(Region.US_WEST)
	.withReadReplication(Region.US_CENTRAL)
	.create()

Create a SQL Database

You can create a SQL server instance by using a define() … create() method chain.

SqlServer sqlServer = azure.sqlServers().define(sqlServerName)
    .withRegion(Region.US_EAST)
    .withNewResourceGroup(rgName)
    .withAdministratorLogin("adminlogin123")
    .withAdministratorPassword("myS3cureP@ssword")
    .withNewFirewallRule("10.0.0.1")
    .withNewFirewallRule("10.2.0.1", "10.2.0.10")
    .create();

Then, you can create a SQL database instance by using a define() … create() method chain.

SqlDatabase database = sqlServer.databases().define("myNewDatabase")
	...
    .create();

Ready-to-run code samples for databases

Service Management Scenario
Storage
SQL Database
Cosmos DB

Other code samples

Service Management Scenario
Active Directory
Container Service
Container Registry and
Container Instances
Service Bus
Resource Groups
Redis Cache
Key Vault
Monitor
CDN
Batch
Batch AI
Search
Event Hub

Download

Latest stable release

If you are using released builds from 1.23.0, add the following to your POM file:

<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure</artifactId>
    <version>1.23.0</version>
</dependency>

Latest snapshots

If you are using snapshots builds for this repo, add the following repository and dependency to your POM file:

  <repositories>
    <repository>
      <id>ossrh</id>
      <name>Sonatype Snapshots</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
      <layout>default</layout>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>always</updatePolicy>
      </snapshots>
    </repository>
  </repositories>
<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure</artifactId>
    <version>1.23.1-SNAPSHOT</version>
</dependency>
<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-client-runtime</artifactId>
    <version>1.6.5-SNAPSHOT</version>
</dependency>
<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-client-authentication</artifactId>
    <version>1.6.5-SNAPSHOT</version>
</dependency>
<dependency>
    <groupId>com.microsoft.rest</groupId>
    <artifactId>client-runtime</artifactId>
    <version>1.6.5-SNAPSHOT</version>
</dependency>

Prerequisites

Upgrading from older versions

If you are migrating your code from 1.22.0 to 1.23.0, you can use these release notes for preparing your code for 1.23.0 from 1.22.0.

In general, Azure Libraries for Java follow semantic versioning, so user code should continue working in a compatible fashion between minor versions of the same major version release train, with the following caveats:

  • methods and types annotated with @Beta are not considered "generally available" and their design and functionality may change arbitrarily (including removal) in any future minor release of the libraries. To help identify such @Beta breaking changes from one minor release to the next and see how to mitigate them, see the above mentioned release notes for each release.

  • occasionally the naming and structure of "fluent" interface definitions (i.e. the ones whose names start with With*) may change between minor versions, as long as that change does not affect the fluent "flow" (the chaining of the methods in a definition or update chain).

  • the *Inner types and their methods may occasionally change their naming and structure between minor versions in breaking ways. User code should generally avoid making a reference to those types though, unless their functionality is not yet exposed by the "fluent" API.

Help and Issues

If you encounter any bugs with these libraries, please file issues via Issues or checkout StackOverflow for Azure Java SDK.

Contribute Code

If you would like to become an active contributor to this project please follow the instructions provided in Microsoft Azure Projects Contribution Guidelines.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

More Information

Previous Releases and Corresponding Repo Branches

Version SHA1 Remarks
1.23.0 1.23.0 Tagged release for 1.23.0 version of Azure management libraries
1.22.0 1.22.0 Tagged release for 1.22.0 version of Azure management libraries
1.21.0 1.21.0 Tagged release for 1.21.0 version of Azure management libraries
1.20.1 1.20.1 Tagged release for 1.20.1 version of Azure management libraries
1.20.0 1.20.0 Tagged release for 1.20.0 version of Azure management libraries
1.19.0 1.19.0 Tagged release for 1.19.0 version of Azure management libraries
1.18.0 1.18.0 Tagged release for 1.18.0 version of Azure management libraries
1.17.0 1.17.0 Tagged release for 1.17.0 version of Azure management libraries
1.16.0 1.16.0 Tagged release for 1.16.0 version of Azure management libraries
1.15.1 1.15.1 Tagged release for 1.15.1 version of Azure management libraries
1.15.0 1.15.0 Tagged release for 1.15.0 version of Azure management libraries
1.14.0 1.14.0 Tagged release for 1.14.0 version of Azure management libraries
1.13.0 1.13.0 Tagged release for 1.13.0 version of Azure management libraries
1.12.0 1.12.0 Tagged release for 1.12.0 version of Azure management libraries
1.11.0 1.11.0 Tagged release for 1.11.0 version of Azure management libraries
1.10.0 1.10.0 Tagged release for 1.10.0 version of Azure management libraries
1.9.0 1.9.0 Tagged release for 1.9.0 version of Azure management libraries
1.8.0 1.8.0 Tagged release for 1.8.0 version of Azure management libraries
1.7.0 1.7.0 Tagged release for 1.7.0 version of Azure management libraries
1.6.0 1.6.0 Tagged release for 1.6.0 version of Azure management libraries
1.5.1 1.5.1 Tagged release for 1.5.1 version of Azure management libraries
1.4.0 1.4.0 Tagged release for 1.4.0 version of Azure management libraries
1.3.0 1.3.0 Tagged release for 1.3.0 version of Azure management libraries
1.2.1 1.2.1 Tagged release for 1.2.1 version of Azure management libraries
1.1.0 1.1.0 Tagged release for 1.1.0 version of Azure management libraries
1.0.0 1.0.0 Tagged release for 1.0.0 version of Azure management libraries
1.0.0-beta5 1.0.0-beta5 Tagged release for 1.0.0-beta5 version of Azure management libraries
1.0.0-beta4.1 1.0.0-beta4.1 Tagged release for 1.0.0-beta4.1 version of Azure management libraries
1.0.0-beta3 1.0.0-beta3 Tagged release for 1.0.0-beta3 version of Azure management libraries
1.0.0-beta2 1.0.0-beta2 Tagged release for 1.0.0-beta2 version of Azure management libraries
1.0.0-beta1 1.0.0-beta1 Maintenance branch for AutoRest generated raw clients
1.0.0-beta1+fixes 1.0.0-beta1+fixes Stable build for AutoRest generated raw clients
0.9.x-SNAPSHOTS 0.9 Maintenance branch for service management libraries
0.9.3 0.9.3 Latest release for service management libraries

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

You can’t perform that action at this time.