@@ -70,7 +70,7 @@ In addition, Azure subscription ID can be configured via environment variable `A
7070With above configuration, ` azure ` client can be authenticated by following code:
7171
7272``` java
73- AzureProfile profile = new AzureProfile (AzureEnvironment . AZURE, true );
73+ AzureProfile profile = new AzureProfile (AzureEnvironment . AZURE );
7474TokenCredential credential = new DefaultAzureCredentialBuilder ()
7575 .authorityHost(profile. environment(). getActiveDirectoryEndpoint())
7676 .build();
@@ -90,6 +90,9 @@ See [Samples][sample] for code snippets and samples.
9090The key concepts of Azure Management Libraries includes:
9191
9292- Fluent interface to manage Azure resources.
93+ - Dependency across Azure resources.
94+ - Batch Azure resource provisioning.
95+ - Integration with Azure role-based access control.
9396- Asynchronous operations with [ Reactor] [ reactor ] .
9497- Configurable client, e.g. configuring HTTP client, retries, logging, etc.
9598
@@ -108,7 +111,7 @@ The key concepts of Azure Management Libraries includes:
108111
109112### Fluent interface
110113
111- You can create a virtual machine instance, together with required virtual network and ip address.
114+ You can create a virtual machine instance, together with required virtual network and ip address created automatically .
112115
113116``` java
114117VirtualMachine linuxVM = azure. virtualMachines(). define(" myLinuxVM" )
@@ -132,12 +135,78 @@ linuxVM.update()
132135 .apply();
133136```
134137
138+ ### Dependency across Azure resources.
139+
140+ You can create a function app, together with required storage account and app service plan created on specification.
141+
142+ ``` java
143+ Creatable<StorageAccount > creatableStorageAccount = azure. storageAccounts()
144+ .define(storageAccountName)
145+ .withRegion(Region . US_EAST )
146+ .withExistingResourceGroup(rgName)
147+ .withGeneralPurposeAccountKindV2()
148+ .withSku(StorageAccountSkuType . STANDARD_LRS );
149+
150+ Creatable<AppServicePlan > creatableAppServicePlan = azure. appServicePlans()
151+ .define(appServicePlanName)
152+ .withRegion(Region . US_EAST )
153+ .withExistingResourceGroup(rgName)
154+ .withPricingTier(PricingTier . STANDARD_S1 )
155+ .withOperatingSystem(OperatingSystem . LINUX );
156+
157+ FunctionApp linuxFunctionApp = azure. functionApps(). define(functionAppName)
158+ .withRegion(Region . US_EAST )
159+ .withExistingResourceGroup(rgName)
160+ .withNewLinuxAppServicePlan(creatableAppServicePlan)
161+ .withBuiltInImage(FunctionRuntimeStack . JAVA_8 )
162+ .withNewStorageAccount(creatableStorageAccount)
163+ .withHttpsOnly(true )
164+ .withAppSetting(" WEBSITE_RUN_FROM_PACKAGE" , functionAppPackageUrl)
165+ .create();
166+ ```
167+
168+ ### Batch Azure resource provisioning
169+
170+ You can batch create and delete managed disk instances.
171+
172+ ``` java
173+ List<String > diskNames = Arrays . asList(" datadisk1" , " datadisk2" );
174+
175+ List<Creatable<Disk > > creatableDisks = diskNames. stream()
176+ .map(diskName - > azure. disks()
177+ .define(diskName)
178+ .withRegion(Region . US_EAST )
179+ .withExistingResourceGroup(rgName)
180+ .withData()
181+ .withSizeInGB(1 )
182+ .withSku(DiskSkuTypes . STANDARD_LRS ))
183+ .collect(Collectors . toList());
184+
185+ Collection<Disk > disks = azure. disks(). create(creatableDisks). values();
186+
187+ azure. disks(). deleteByIds(disks. stream(). map(Disk :: id). collect(Collectors . toList()));
188+ ```
189+
190+ ### Integration with Azure role-based access control
191+
192+ You can assign Contributor for an Azure resource to a service principal.
193+
194+ ``` java
195+ String raName = UUID . randomUUID(). toString();
196+ RoleAssignment roleAssignment = azure. accessManagement(). roleAssignments()
197+ .define(raName)
198+ .forServicePrincipal(servicePrincipal)
199+ .withBuiltInRole(BuiltInRole . CONTRIBUTOR )
200+ .withScope(resource. id())
201+ .create();
202+ ```
203+
135204### Asynchronous operations
136205
137206You can create storage account, then blob container, in reactive programming.
138207
139208``` java
140- azure. storageAccounts(). define(" mystorageaccount " )
209+ azure. storageAccounts(). define(storageAccountName )
141210 .withRegion(Region . US_EAST )
142211 .withNewResourceGroup(rgName)
143212 .withSku(StorageAccountSkuType . STANDARD_LRS )
@@ -151,7 +220,16 @@ azure.storageAccounts().define("mystorageaccount")
151220 .withExistingBlobService(rgName, ((StorageAccount ) indexable). name())
152221 .withPublicAccess(PublicAccess . BLOB )
153222 .createAsync()
154- ). blockLast();
223+ )
224+ ...
225+ ```
226+
227+ You can operate on virtual machines in parallel.
228+
229+ ``` java
230+ azure. virtualMachines(). listByResourceGroupAsync(rgName)
231+ .flatMap(VirtualMachine :: restartAsync)
232+ ...
155233```
156234
157235### Configurable client
0 commit comments