Azure Management Libraries for Java
Java Other
Latest commit a5358dd Dec 9, 2016 @hovsepm hovsepm committed on GitHub CDN bugfix (#1316)
CDN bugfix
Permalink
Failed to load latest commit information.
azure-batch Add comments to wrapper APIs. Nov 10, 2016
azure-keyvault-core [release] Prepare for next development iteration (1.0.0-beta4-SNAPSHOT) Oct 6, 2016
azure-keyvault-cryptography Prepare for next iteration of development Nov 10, 2016
azure-keyvault-extensions [release] Prepare for next development iteration (1.0.0-beta4-SNAPSHOT) Oct 6, 2016
azure-keyvault-webkey [release] Prepare for next development iteration (1.0.0-beta4-SNAPSHOT) Oct 6, 2016
azure-keyvault Updating the api-version and adding innererror Nov 10, 2016
azure-mgmt-appservice Add fluent annotations Dec 7, 2016
azure-mgmt-batch Enabling streaming on createAsync Dec 5, 2016
azure-mgmt-cdn CDN bugfix (#1316) Dec 9, 2016
azure-mgmt-compute Adding LangDefinition for impls in compute Dec 8, 2016
azure-mgmt-datalake-analytics fix poms. Nov 15, 2016
azure-mgmt-datalake-store Changed to fix move back to beta1.3 Nov 15, 2016
azure-mgmt-dns dns annotations and adding missing license headers Nov 22, 2016
azure-mgmt-graph-rbac Support for streaming created resources Dec 1, 2016
azure-mgmt-keyvault Fix references in tests and samples Oct 25, 2016
azure-mgmt-network Merge remote-tracking branch 'upstream/master' into martin-networking Dec 8, 2016
azure-mgmt-redis Fix references in tests and samples Oct 25, 2016
azure-mgmt-resources Add web app & slot tests and fix some config bugs Dec 7, 2016
azure-mgmt-search Snap onto a fixed runtime nightly version Oct 11, 2016
azure-mgmt-sql Updated Sql with newer swagger changes Dec 8, 2016
azure-mgmt-storage Enabling streaming on createAsync Dec 5, 2016
azure-mgmt-trafficmanager Annotations for traffic manager Nov 22, 2016
azure-samples CDN bugfix (#1316) Dec 9, 2016
azure Merge remote-tracking branch 'upstream/master' into martin-networking Dec 8, 2016
notes Changes to README (#1168) Oct 6, 2016
tools Remove subtree checks in travis Jul 23, 2016
.gitignore Moving translation.properties from Microsoft/java-to-csharp-api-gener… Dec 7, 2016
.travis.yml Fix checktyle Dec 3, 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 Changes to README (#1168) Oct 6, 2016
appveyor.yml update appveyor.yml: use && Aug 19, 2016
gulpfile.js Rename website to appservice Dec 2, 2016
package.json Add gulp file for easy code regeneration Nov 12, 2015
pom.xml Rename website to appservice Dec 2, 2016
translation.properties Update translation file with name changes. Dec 7, 2016

README.md

Build Status

Azure Management Libraries for Java

This README is based on the latest released preview version (1.0.0-beta3). 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-beta3 is a developer preview that supports major parts of Azure Virtual Machines, Virtual Machine Scale Sets, Storage, Networking, Resource Manager, Key Vault and Batch. 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 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()
    .defineNewDataDisk(dataDiskName)
    .withSizeInGB(20)
    .withCaching(CachingTypes.READ_WRITE)
    .attach()
    .apply();

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(loadBalancer1)
     .withPrimaryInternetFacingLoadBalancerBackends(backendPoolName1, backendPoolName2)
     .withPrimaryInternetFacingLoadBalancerInboundNatPools(natPool50XXto22, natPool60XXto23)
     .withoutPrimaryInternalLoadBalancer()
     .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
     .withRootUserName(userName)
     .withSsh(sshKey)
     .withNewStorageAccount(storageAccountName1)
     .withNewStorageAccount(storageAccountName2)
     .withCapacity(3)
     .create();

Create a Network Security Group

You can create a network security group instance by using another 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 Virtual Machines, Virtual Machine Scale Sets, Storage, Networking, Resource Manager, Key Vault and Batch …

Service Management Scenario
Virtual Machines
Virtual Machines - parallel execution
Virtual Machine Scale Sets
Storage
Network
Resource Groups
Key Vault
Batch

Download

1.0.0-beta3

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

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

Pre-requisites

Help

If you are migrating your code to 1.0.0-beta3, you can use these notes for preparing your code for 1.0.0-beta3 from 1.0.0-beta2.

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-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 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.