Skip to content

Latest commit

History

52 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Build Status

Azure Management Libraries for Java

This README is based on the released stable version (1.3.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. If you are looking for Java client libraries for Azure services, please see Azure libraries for Java - this page will be maintained regularly to ensure that it is up to date.

Note: This page will be maintained regularly to ensure that it is up to date.

Feature Availability and Road Map as of Version 1.3.0

Service | featureAvailable as GAAvailable as PreviewComing soon
ComputeVirtual machines and VM extensions
Virtual machine scale sets
Managed disks
Azure container service + registry + instances
Availability Zones
More Azure container registry features
StorageStorage accountsEncryption
SQL DatabaseDatabases
Firewalls
Elastic pools
More features
NetworkingVirtual networks
Network interfaces
IP addresses
Routing table
Network security groups
Application gateways
DNS
Traffic managers
Load balancers
Network peering
Virtual Network Gateway
Network watchers
VPN
More application gateway features
More servicesResource Manager
Key Vault
Redis
CDN
Batch
Web apps
Function Apps
Service bus
Graph RBAC
Cosmos DB
Search
Monitor
Data Lake
FundamentalsAuthentication - 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.

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 Cosmos DB with CosmosDB Programming Model

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

CosmosAccountcosmosDBAccount = azure.cosmosDBs().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 Virtual Machine

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

System.out.println("Creating a Linux VM");
VirtualMachinelinuxVM = 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 another define() … create() method chain.

VirtualMachineScaleSetvirtualMachineScaleSet = 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();

Create a Network Security Group

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

NetworkSecurityGroupfrontEndNSG = 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 another define() … create() method chain.

ApplicationGatewayapplicationGateway = 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();

Create a Web App

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

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

Create a SQL Database

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

SqlServersqlServer = 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 another define() … create() method chain.

SqlDatabasedatabase = sqlServer.databases().define("myNewDatabase")
.create();

Sample Code

You can find plenty of sample code that illustrates management scenarios (95+ end-to-end scenarios) for Azure Virtual Machines, Virtual Machine Scale Sets, Managed Disks, Active Directory Azure Container Service and Registry, Storage, Networking, Resource Manager, SQL Database, Cosmos DB, App Service (Web Apps on Windows and Linux), Functions, Service Bus, Key Vault, Redis, CDN and Batch …

ServiceManagement Scenario
Virtual Machines
Virtual Machines - parallel execution
Virtual Machine Scale Sets
Active Directory
Container Service
Container Registry and
Container Instances
Storage
Networking
Networking - DNS
Traffic Manager
Application Gateway
SQL Database
App Service - Web Apps on Windows
App Service - Web Apps on Linux
Functions
Cosmos DB
Service Bus
Resource Groups
Redis Cache
Key Vault
CDN
Batch
Search

Download

1.3.0

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

<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure</artifactId>
<version>1.3.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.3.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-client-runtime</artifactId>
<version>1.1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-client-authentication</artifactId>
<version>1.1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.microsoft.rest</groupId>
<artifactId>client-runtime</artifactId>
<version>1.1.1-SNAPSHOT</version>
</dependency>

Pre-requisites

Help

If you are migrating your code to 1.3.0, you can use these notes for preparing your code for 1.3.0 from 1.2.0.

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

VersionSHA1Remarks
1.2.11.2.1Tagged release for 1.2.1 version of Azure management libraries
1.1.01.1.0Tagged release for 1.1.0 version of Azure management libraries
1.0.01.0.0Tagged release for 1.0.0 version of Azure management libraries
1.0.0-beta51.0.0-beta5Tagged release for 1.0.0-beta5 version of Azure management libraries
1.0.0-beta4.11.0.0-beta4.1Tagged release for 1.0.0-beta4.1 version of Azure management libraries
1.0.0-beta31.0.0-beta3Tagged release for 1.0.0-beta3 version of Azure management libraries
1.0.0-beta21.0.0-beta2Tagged release for 1.0.0-beta2 version of Azure management libraries
1.0.0-beta11.0.0-beta1Maintenance branch for AutoRest generated raw clients
1.0.0-beta1+fixes1.0.0-beta1+fixesStable build for AutoRest generated raw clients
0.9.x-SNAPSHOTS0.9Maintenance branch for service management libraries
0.9.30.9.3Latest 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.

About

Azure Management Libraries for Java

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages