0

create vnet and two subnet in azure using java sdk.

IntelliJ development setup with environment variable setup.

Share the git repository url

1 Answers1

0

As per the documentation:

Maven pom.xml:

<dependency>
    <groupId>com.azure.resourcemanager</groupId>
    <artifactId>azure-resourcemanager-network</artifactId>
    <version>2.7.0</version>
</dependency>

Example of virtual network with two subnets:

Network network = azure.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();

For more examples, you can refer to azure-sdk-for-java

Ecstasy
  • 1,866
  • 1
  • 9
  • 17