<commit_before>[![Build Status](https://travis-ci.org/Azure/azure-sdk-for-java.svg?style=flat-square&label=build)](https://travis-ci.org/Azure/azure-sdk-for-java)

#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](#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 … 


> [Asir's note to editors] - will hyperlink as soon as these samples are visible

- Manage virtual machine
- Manage availability set
- List virtual machine images
- Manage virtual network
- Manage network interface
- Manage network security group
- Manage IP address
- Manage resource groups
- Manage resources
- Deploy resources with ARM templates
- Deploy resources with ARM templates (with progress)

# Download


**1.0.0-beta2**

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

```xml
<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'<commit_msg>changes to readme<commit_after>[![Build Status](https://travis-ci.org/Azure/azure-sdk-for-java.svg?style=flat-square&label=build)](https://travis-ci.org/Azure/azure-sdk-for-java)

#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](#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 … 


> [Asir's note to editors] - will hyperlink as soon as these samples are visible

- Manage virtual machine
- Manage availability set
- List virtual machine images
- Manage storage accounts
- Manage virtual network
- Manage network interface
- Manage network security group
- Manage IP address
- Manage resource groups
- Manage resources
- Deploy resources with ARM templates
- Deploy resources with ARM templates (with progress)

# Download


**1.0.0-beta2**

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

```xml
<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'
{'fraction_non_alphanumeric': 0.10010201479214487, 'fraction_numerical': 0.012496812037745473, 'mean_word_length': 3.347560975609756, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 23, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3242475', 'n_tokens_mistral': 2312, 'n_tokens_neox': 2189, 'n_words': 674}