Please note, all packages in this repository have been deprecated.
com.azure.resourcemanager
from com.microsoft.azure.management
for more details on upgrading.If you are interested in learning how to use the new libraries for Azure resource management, please visit here. We have also prepared plenty of code samples.
New Management libraries can be identified by namespaces com.azure.resourcemanager
and artifact that start with azure-resourcemanager
, e.g. azure-resourcemanager-compute
. They follow the Azure SDK Design Guidelines for Java which aims to provide consistent, approachable, idiomatic, diagnosable, and dependable experience for developers.
This README is based on the released stable version (1.41.4). 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, that is optimized for ease of use, succinctness and consistency.
If you are looking for Java client libraries for consuming (rather than managing) individual Azure services (e.g. storage blob upload, JDBC, messaging, etc), please see https://docs.microsoft.com/en-us/java/azure/java-sdk-azure-install.
:triangular_flag_on_post: as of Version 1.41.4
Service | feature | Available as GA | Available as Preview | Coming soon |
---|---|---|---|
Compute | Virtual machines and VM extensions Virtual machine scale sets Managed disks |
Azure container service (AKS) + registry + instances Availability Zones |
More Availability Zones and MSI features |
Storage | Storage accounts Encryption (deprecated) |
Encryption (Blob) Encryption (File) |
|
SQL Database | Databases Firewalls and virtual network Elastic pools Import, export, recover and restore dbs Failover groups and replication links DNS aliasing and metrics Sync groups Encryption protectors |
More features | |
Networking | Virtual networks Network interfaces IP addresses Routing table Network security groups Load balancers Application gateways DNS Traffic managers |
Network peering Virtual Network Gateway Network watchers Express Route Application Security Groups |
More application gateway features |
More services | Resource Manager Key Vault Redis CDN Batch Service bus Graph RBAC |
Web apps Function Apps Cosmos DB Monitor Batch AI Search Event Hub |
Data Lake More Monitor features Logic Apps Event Grid |
Fundamentals | Authentication - 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.
The Azure
class is the simplest entry point for creating and interacting with Azure resources.
Azure azure = Azure.authenticate(credFile).withDefaultSubscription();
To learn more about authentication in the Azure Libraries for Java, see AUTH.md.
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());
You can update a virtual machine instance by using an update() … apply()
method chain.
linuxVM.update()
.withNewDataDisk(20, lun, CachingTypes.READ_WRITE)
.apply();
You can create a virtual machine scale set instance by using a 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)
.withNewDataDisk(100)
.withNewDataDisk(100, 1, CachingTypes.READ_WRITE)
.withNewDataDisk(100, 2, CachingTypes.READ_WRITE, StorageAccountTypes.STANDARD_LRS)
.withCapacity(3)
.create();
You can create a virtual network by using a define() … create()
method chain.
Network network = networks.define("mynetwork")
.withRegion(Region.US_EAST)
.withNewResourceGroup()
.withAddressSpace("10.0.0.0/28")
.withSubnet("subnet1", "10.0.0.0/29")
.withSubnet("subnet2", "10.0.0.8/29")
.create();
You can create a network security group instance by using a 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(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();
You can create a application gateway instance by using a 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();
You can create a Web App instance by using a define() … create()
method chain.
WebApp webApp = azure.webApps()
.define(appName)
.withRegion(Region.US_WEST)
.withNewResourceGroup(rgName)
.withNewWindowsPlan(PricingTier.STANDARD_S1)
.create();
You can create a Cosmos DB account by using a define() … create()
method chain.
CosmosAccount cosmosDBAccount = azure.cosmosDBAccounts().define(cosmosDBName)
.withRegion(Region.US_EAST)
.withNewResourceGroup(rgName)
.withKind(DatabaseAccountKind.GLOBAL_DOCUMENT_DB)
.withSessionConsistency()
.withWriteReplication(Region.US_WEST)
.withReadReplication(Region.US_CENTRAL)
.create()
You can create a SQL server instance by using a 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 a define() … create()
method chain.
SqlDatabase database = sqlServer.databases().define("myNewDatabase")
...
.create();
For instance, if you only need azure-mgmt-appservice library from 1.41.4, and wish to limit the dependencies, using following dependency instead in POM.
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-mgmt-appservice</artifactId>
<version>1.41.4</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-client-authentication</artifactId>
<version>1.7.14</version>
</dependency>
Create an authenticated client similarly as Azure.authenticate
, with credentials and subscription id - see how to create authentication info.
ApplicationTokenCredentials credentials = ...
AppServiceManager appServiceClient = AppServiceManager.authenticate(credentials, SUBSCRIPTION_ID);
Then, create a Web App instance using this appServiceClient
.
WebApp webApp = appServiceClient.webApps()
.define(appName)
.withRegion(Region.US_WEST)
.withNewResourceGroup(rgName)
.withNewWindowsPlan(PricingTier.STANDARD_S1)
.create();
If you are using released builds from 1.41.4, add the following to your POM file:
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure</artifactId>
<version>1.41.4</version>
</dependency>
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.41.5-SNAPSHOT</version>
</dependency>
If you are migrating your code from 1.41.3 to 1.41.4, you can use these release notes for preparing your code for 1.41.4 from 1.41.3.
In general, Azure Libraries for Java follow semantic versioning, so user code should continue working in a compatible fashion between minor versions of the same major version release train, with the following caveats:
methods and types annotated with @Beta
are not considered "generally available" and their design and functionality may change arbitrarily (including removal) in any future minor release of the libraries. To help identify such @Beta
breaking changes from one minor release to the next and see how to mitigate them, see the above mentioned release notes for each release.
occasionally the naming and structure of "fluent" interface definitions (i.e. the ones whose names start with With*
) may change between minor versions, as long as that change does not affect the fluent "flow" (the chaining of the methods in a definition or update chain).
the *Inner
types and their methods may occasionally change their naming and structure between minor versions in breaking ways. User code should generally avoid making a reference to those types though, unless their functionality is not yet exposed by the "fluent" API.
If you encounter any bugs with these libraries, please file issues via Issues or checkout StackOverflow for Azure Java SDK.
If you would like to become an active contributor to this project please follow the instructions provided in Microsoft Azure Projects Contribution Guidelines.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Version | SHA1 | Remarks |
---|---|---|
1.41.4 | 1.41.4 | Tagged release for 1.41.4 version of Azure management libraries |
1.41.3 | 1.41.3 | Tagged release for 1.41.3 version of Azure management libraries |
1.41.2 | 1.41.2 | Tagged release for 1.41.2 version of Azure management libraries |
1.41.1 | 1.41.1 | Tagged release for 1.41.1 version of Azure management libraries |
1.41.0 | 1.41.0 | Tagged release for 1.41.0 version of Azure management libraries |
1.40.0 | 1.40.0 | Tagged release for 1.40.0 version of Azure management libraries |
1.39.1 | 1.39.1 | Tagged release for 1.39.1 version of Azure management libraries |
1.39.0 | 1.39.0 | Tagged release for 1.39.0 version of Azure management libraries |
1.38.1 | 1.38.1 | Tagged release for 1.38.1 version of Azure management libraries |
1.38.0 | 1.38.0 | Tagged release for 1.38.0 version of Azure management libraries |
1.37.1 | 1.37.1 | Tagged release for 1.37.1 version of Azure management libraries |
1.37.0 | 1.37.0 | Tagged release for 1.37.0 version of Azure management libraries |
1.36.3 | 1.36.3 | Tagged release for 1.36.3 version of Azure management libraries |
1.36.2 | 1.36.2 | Tagged release for 1.36.2 version of Azure management libraries |
1.36.1 | 1.36.1 | Tagged release for 1.36.1 version of Azure management libraries |
1.36.0 | 1.36.0 | Tagged release for 1.36.0 version of Azure management libraries |
1.35.1 | 1.35.1 | Tagged release for 1.35.1 version of Azure management libraries |
1.35.0 | 1.35.0 | Tagged release for 1.35.0 version of Azure management libraries |
1.34.0 | 1.34.0 | Tagged release for 1.34.0 version of Azure management libraries |
1.33.1 | 1.33.1 | Tagged release for 1.33.1 version of Azure management libraries |
1.33.0 | 1.33.0 | Tagged release for 1.33.0 version of Azure management libraries |
1.32.1 | 1.32.1 | Tagged release for 1.32.1 version of Azure management libraries |
1.32.0 | 1.32.0 | Tagged release for 1.32.0 version of Azure management libraries |
1.31.1 | 1.31.1 | Tagged release for 1.31.1 version of Azure management libraries |
1.31.0 | 1.31.0 | Tagged release for 1.31.0 version of Azure management libraries |
1.30.0 | 1.30.0 | Tagged release for 1.30.0 version of Azure management libraries |
1.29.0 | 1.29.0 | Tagged release for 1.29.0 version of Azure management libraries |
1.28.0 | 1.28.0 | Tagged release for 1.28.0 version of Azure management libraries |
1.27.2 | 1.27.2 | Tagged release for 1.27.2 version of Azure management libraries |
1.27.0 | 1.27.0 | Tagged release for 1.27.0 version of Azure management libraries |
1.26.0 | 1.26.0 | Tagged release for 1.26.0 version of Azure management libraries |
1.25.0 | 1.25.0 | Tagged release for 1.25.0 version of Azure management libraries |
1.24.2 | 1.24.2 | Tagged release for 1.24.2 version of Azure management libraries |
1.24.1 | 1.24.1 | Tagged release for 1.24.1 version of Azure management libraries |
1.24.0 | 1.24.0 | Tagged release for 1.24.0 version of Azure management libraries |
1.23.0 | 1.23.0 | Tagged release for 1.23.0 version of Azure management libraries |
1.22.0 | 1.22.0 | Tagged release for 1.22.0 version of Azure management libraries |
1.21.0 | 1.21.0 | Tagged release for 1.21.0 version of Azure management libraries |
1.20.1 | 1.20.1 | Tagged release for 1.20.1 version of Azure management libraries |
1.20.0 | 1.20.0 | Tagged release for 1.20.0 version of Azure management libraries |
1.19.0 | 1.19.0 | Tagged release for 1.19.0 version of Azure management libraries |
1.18.0 | 1.18.0 | Tagged release for 1.18.0 version of Azure management libraries |
1.17.0 | 1.17.0 | Tagged release for 1.17.0 version of Azure management libraries |
1.16.0 | 1.16.0 | Tagged release for 1.16.0 version of Azure management libraries |
1.15.1 | 1.15.1 | Tagged release for 1.15.1 version of Azure management libraries |
1.15.0 | 1.15.0 | Tagged release for 1.15.0 version of Azure management libraries |
1.14.0 | 1.14.0 | Tagged release for 1.14.0 version of Azure management libraries |
1.13.0 | 1.13.0 | Tagged release for 1.13.0 version of Azure management libraries |
1.12.0 | 1.12.0 | Tagged release for 1.12.0 version of Azure management libraries |
1.11.0 | 1.11.0 | Tagged release for 1.11.0 version of Azure management libraries |
1.10.0 | 1.10.0 | Tagged release for 1.10.0 version of Azure management libraries |
1.9.0 | 1.9.0 | Tagged release for 1.9.0 version of Azure management libraries |
1.8.0 | 1.8.0 | Tagged release for 1.8.0 version of Azure management libraries |
1.7.0 | 1.7.0 | Tagged release for 1.7.0 version of Azure management libraries |
1.6.0 | 1.6.0 | Tagged release for 1.6.0 version of Azure management libraries |
1.5.1 | 1.5.1 | Tagged release for 1.5.1 version of Azure management libraries |
1.4.0 | 1.4.0 | Tagged release for 1.4.0 version of Azure management libraries |
1.3.0 | 1.3.0 | Tagged release for 1.3.0 version of Azure management libraries |
1.2.1 | 1.2.1 | Tagged release for 1.2.1 version of Azure management libraries |
1.1.0 | 1.1.0 | Tagged release for 1.1.0 version of Azure management libraries |
1.0.0 | 1.0.0 | Tagged release for 1.0.0 version of Azure management libraries |
1.0.0-beta5 | 1.0.0-beta5 | Tagged release for 1.0.0-beta5 version of Azure management libraries |
1.0.0-beta4.1 | 1.0.0-beta4.1 | Tagged release for 1.0.0-beta4.1 version of Azure management libraries |
1.0.0-beta3 | 1.0.0-beta3 | Tagged release for 1.0.0-beta3 version of Azure management libraries |
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 | 1.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 | 0.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.