Manage App Service, SQL Database, and more – Azure Management Libraries for Java

One Java statement to create a Web App. One statement to create a SQL Server and another statement to create a SQL Database. One statement to create an Application Gateway, etc.

Beta 4 of the Azure Management Libraries for Java is now available. Beta 4 adds support for the following Azure services and features:

✓ App Service (Web Apps)

✓ SQL Database

✓ Application Gateway

✓ Traffic Manager

✓ DNS

✓ CDN

✓ Redis Cache

 
 

https://github.com/azure/azure-sdk-for-java

Add the following to your Maven POM file to use Beta 4:

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

Last year, we announced previews of the new, simplified Azure management libraries for Java. Our goal is to improve the developer experience by providing a higher-level, object-oriented API, optimized for readability and writability. Thank you for trying the libraries and providing us with plenty of useful feedback.

Create a Web App

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

WebApp webApp = azure.webApps()
.define(appName)
.withNewResourceGroup(rgName)
.withNewAppServicePlan(planName)
.withRegion(Region.US_WEST)
.withPricingTier(AppServicePricingTier.STANDARD_S1)
.create();

Create a SQL Database

You can create a SQL server instance by using another 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 another define() … create() method chain.

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

Create an Application Gateway

You can create an application gateway instance by using another 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();

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, SQL Database, App Service (Web Apps), Key Vault, Redis, CDN and Batch.

Service
Management Scenario

Virtual Machines

Manage virtual machine
Manage availability set
List virtual machine images
Manage virtual machines using VM extensions
Create virtual machines from generalized image or specialized VHD
List virtual machine extension images

Virtual Machines – parallel execution

Create multiple virtual machines in parallel
Create multiple virtual machines with network in parallel
Create multiple virtual machines across regions in parallel

Virtual Machine Scale Sets

Manage virtual machine scale sets (behind an Internet facing load balancer)

Storage

Manage storage accounts

Networking

Manage virtual network
Manage network interface
Manage network security group
Manage IP address
Manage Internet facing load balancers
Manage internal load balancers

Networking – DNS

Host and manage domains

Traffic Manager

Manage traffic manager profiles

Application Gateway

Manage application gateways
Manage application gateways with backend pools

SQL Database

Manage SQL databases
Manage SQL databases in elastic pools
Manage firewalls for SQL databases
Manage SQL databases across regions

Redis Cache

Manage Redis Cache

App Service – Web Apps

Manage Web apps
Manage Web apps with custom domains
Configure deployment sources for Web apps
Manage staging and production slots for Web apps
Scale Web apps
Manage storage connections for Web apps
Manage data connections (such as SQL database and Redis cache) for Web apps

Resource Groups

Manage resource groups
Manage resources
Deploy resources with ARM templates
Deploy resources with ARM templates (with progress)

Key Vault

Manage key vaults

CDN

Manage CDNs

Batch

Manage batch accounts

Give it a try

You can run the samples above or go straight to our GitHub repo. Give it a try and let us know what do you think (via e-mail or comments below), particularly –

Usability and effectiveness of the new management libraries for Java.
What Azure services you would like to see supported soon?
What additional scenarios should be illustrated as sample code?

Over the next few weeks, we will be adding support for more Azure services and applying finishing touches to the API.

You can find plenty of additional info about Java on Azure at http://azure.com/java.
Quelle: Azure

Published by