Azure Management Libraries for Java
Java Other
Latest commit 13e8c08 Sep 30, 2016 @martinsawicki martinsawicki committed on GitHub Merge pull request #1140 from martinsawicki/martin-plumbing
fixing issues in Subnet., Network, NIC
Permalink
Failed to load latest commit information.
azure-batch Generate beta2 runtime compatible batch data plane code Sep 7, 2016
azure-keyvault-core Removed annotation dependency from keyvault libs Sep 22, 2016
azure-keyvault-cryptography Removed annotation dependency from keyvault libs Sep 22, 2016
azure-keyvault-extensions Remove runtimes from SDK Sep 29, 2016
azure-keyvault-webkey Change IssuerReference to IssuerParameters and adding CertificateType. Sep 23, 2016
azure-keyvault Remove runtimes from SDK Sep 29, 2016
azure-mgmt-batch Merge remote-tracking branch 'upstream/master' into martin-plumbing Sep 29, 2016
azure-mgmt-compute Adding Method annotations Sep 29, 2016
azure-mgmt-datalake-analytics Remove runtimes from SDK Sep 29, 2016
azure-mgmt-datalake-store-uploader Remove runtimes from SDK Sep 29, 2016
azure-mgmt-datalake-store Remove runtimes from SDK Sep 29, 2016
azure-mgmt-graph-rbac Fix checkstyle Sep 29, 2016
azure-mgmt-keyvault Update key vault with latest annotations Sep 29, 2016
azure-mgmt-network checkstyle issue Sep 29, 2016
azure-mgmt-redis Remove runtimes from SDK Sep 29, 2016
azure-mgmt-resources fixed style check issues. Sep 29, 2016
azure-mgmt-search Remove runtimes from SDK Sep 29, 2016
azure-mgmt-storage Remove runtimes from SDK Sep 29, 2016
azure-mgmt-website Remove runtimes from SDK Sep 29, 2016
azure-samples potential NPE bug fix in NetworkImpl#dnsServerIps and rename to follo… Sep 29, 2016
azure potential NPE bug fix in NetworkImpl#dnsServerIps and rename to follo… Sep 29, 2016
tools Remove subtree checks in travis Jul 23, 2016
.gitignore Adding translation file to gitignore Sep 26, 2016
.travis.yml Use JDK 1.7 as build version Sep 26, 2016
AUTH.md Add subscription info Sep 28, 2016
CONTRIBUTING.md Remove codegen info in contributing guide Mar 29, 2016
ChangeLog.txt Update change log for 1.0.0-beta1 Mar 3, 2016
LICENSE.txt Fix license to MIT Mar 3, 2016
README.md Fixed readme.md typo Aug 26, 2016
appveyor.yml update appveyor.yml: use && Aug 19, 2016
gulpfile.js [Ready for review] Redis Client implementation (#1057) Sep 20, 2016
package.json Add gulp file for easy code regeneration Nov 12, 2015
pom.xml Use beta3 for checkstyle Sep 29, 2016

README.md

Build Status

Azure Management Libraries for Java

This README is based on the latest released preview version (1.0.0-beta2). 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.

1.0.0-beta2 is a developer preview that supports major parts of Azure Compute, Storage, Networking and Resource Manager. 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.

Azure Authentication

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

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

Create a Virtual Machine

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

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

VirtualMachine linuxVM = azure.virtualMachines().define("myLinuxVM")
    .withRegion(Region.US_EAST)
    .withNewResourceGroup("myResourceGroup")
    .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 the update() … apply() method chain.

linuxVM.update()
    .defineNewDataDisk(dataDiskName)
    .withSizeInGB(20)
    .withCaching(CachingTypes.READ_WRITE)
    .attach()
    .apply();

Create a Network Security Group

You can create a network security group instance by using the 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(NetworkSecurityRule.Protocol.TCP)
        .withPriority(100)
        .withDescription("Allow SSH")
        .attach()
    .defineRule("ALLOW-HTTP")
        .allowInbound()
        .fromAnyAddress()
        .fromAnyPort()
        .toAnyAddress()
        .toPort(80)
        .withProtocol(NetworkSecurityRule.Protocol.TCP)
        .withPriority(101)
        .withDescription("Allow HTTP")
        .attach()
    .create();

Sample Code

You can find plenty of sample code that illustrates management scenarios in Azure Compute, Storage, Network and Resource Manager …

Download

1.0.0-beta2

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

<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure</artifactId>
    <version>1.0.0-beta2</version>
</dependency>

or Gradle:

compile group: 'com.microsoft.azure', name: 'azure', version: '1.0.0-beta2'

Snapshots builds for this repo

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.0.0-SNAPSHOT</version>
</dependency>

or Gradle:

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    ....
}
compile group: 'com.microsoft.azure', name: 'azure', version: '1.0.0-SNAPSHOTS'

Pre-requisites

Help

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.0.0-beta1 1.0.0-beta1 Maintenance branch for AutoRest generated raw clients
1.0.0-beta1+fixes v1.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 v0.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.