Package com.azure.resourcemanager
Class AzureResourceManager
java.lang.Object
com.azure.resourcemanager.AzureResourceManager
The entry point for accessing resource management APIs in Azure.
Instantiating an Azure Client
AzureProfile profile = new AzureProfile(tenantId, subscriptionId, AzureEnvironment.AZURE);
TokenCredential credential = new DefaultAzureCredentialBuilder()
.authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
.build();
AzureResourceManager azure = AzureResourceManager
.authenticate(credential, profile)
.withDefaultSubscription();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceProvides authenticated access to a subset of Azure APIs that do not require a specific subscription.static interfaceThe interface allowing configurations to be made on the client. -
Method Summary
Modifier and TypeMethodDescriptionauthenticate(com.azure.core.credential.TokenCredential credential, com.azure.core.management.profile.AzureProfile profile) Authenticate to Azure using an Azure credential object.authenticate(com.azure.core.http.HttpPipeline httpPipeline, com.azure.core.management.profile.AzureProfile profile) Authenticates API access using a RestClient instance.Configures the Azure client.disks()dnsZones()features()Entry point to managing function apps.networks()Entry point to managing storage accountsEntry point to blob container management API.tenantId()tenants()vaults()Entry point to managing virtual machines.webApps()
-
Method Details
-
authenticate
public static AzureResourceManager.Authenticated authenticate(com.azure.core.credential.TokenCredential credential, com.azure.core.management.profile.AzureProfile profile) Authenticate to Azure using an Azure credential object.Code Samples
AzureProfile profile = new AzureProfile(tenantId, subscriptionId, AzureEnvironment.AZURE); TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) .build(); AzureResourceManager azure = AzureResourceManager .authenticate(credential, profile) .withDefaultSubscription();- Parameters:
credential- the credential objectprofile- the profile to use- Returns:
- the authenticated Azure client
-
authenticate
public static AzureResourceManager.Authenticated authenticate(com.azure.core.http.HttpPipeline httpPipeline, com.azure.core.management.profile.AzureProfile profile) Authenticates API access using a RestClient instance.- Parameters:
httpPipeline- theHttpPipelineconfigured with Azure authentication credential.profile- the profile used in Active Directory- Returns:
- authenticated Azure client
-
configure
Configures the Azure client.Code Samples
AzureResourceManager azure = AzureResourceManager .configure() .withLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .withPolicy(customPolicy) .withRetryPolicy(customRetryPolicy) .withHttpClient(httpClient) //...- Returns:
- an interface allow configurations on the client.
-
subscriptionId
- Returns:
- the currently selected subscription ID this client is authenticated to work with
-
tenantId
- Returns:
- the currently selected tenant ID this client is authenticated to work with
-
getCurrentSubscription
- Returns:
- the currently selected subscription this client is authenticated to work with
-
subscriptions
- Returns:
- entry point to managing subscriptions
-
tenants
- Returns:
- entry point to managing tenants
-
resourceGroups
- Returns:
- entry point to managing resource groups
-
deployments
- Returns:
- entry point to managing deployments
-
genericResources
- Returns:
- entry point to managing generic resources
-
features
- Returns:
- entry point to managing features
-
providers
- Returns:
- entry point to managing resource providers
-
policyDefinitions
- Returns:
- entry point to managing policy definitions.
-
policyAssignments
- Returns:
- entry point to managing policy assignments.
-
managementLocks
- Returns:
- entry point to managing locks.
-
storageAccounts
Entry point to managing storage accountsCode Samples
Create an Azure Storage Account
azure.storageAccounts().define("<storage-account-name>") .withRegion(Region.US_EAST) .withNewResourceGroup(resourceGroupName) .withSku(StorageAccountSkuType.STANDARD_LRS) .withGeneralPurposeAccountKindV2() .withOnlyHttpsTraffic() //... .create();- Returns:
- entry point to managing storage accounts
-
storageUsages
- Returns:
- entry point to managing storage account usages
-
storageSkus
- Returns:
- entry point to managing storage service SKUs
-
availabilitySets
- Returns:
- entry point to managing availability sets
-
networks
- Returns:
- entry point to managing virtual networks
-
routeTables
- Returns:
- entry point to managing route tables
-
loadBalancers
- Returns:
- entry point to managing load balancers
-
applicationGateways
- Returns:
- entry point to managing application gateways
-
networkSecurityGroups
- Returns:
- entry point to managing network security groups
-
networkUsages
- Returns:
- entry point to managing network resource usages
-
networkWatchers
- Returns:
- entry point to managing network watchers
-
virtualNetworkGateways
- Returns:
- entry point to managing virtual network gateways
-
localNetworkGateways
- Returns:
- entry point to managing local network gateways
-
expressRouteCircuits
- Returns:
- entry point to managing express route circuits
-
expressRouteCrossConnections
- Returns:
- entry point to managing express route cross connections
-
applicationSecurityGroups
- Returns:
- entry point to managing express route circuits
-
routeFilters
- Returns:
- entry point to managing route filters
-
ddosProtectionPlans
- Returns:
- entry point to managing DDoS protection plans
-
virtualMachines
Entry point to managing virtual machines.Code Samples
Create a Virtual Machine instance.
VirtualMachine linuxVM = azure.virtualMachines() .define(linuxVMName) .withRegion(region) .withNewResourceGroup(resourceGroupName) .withNewPrimaryNetwork("10.0.0.0/28") .withPrimaryPrivateIPAddressDynamic() .withoutPrimaryPublicIPAddress() .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_20_04_LTS_GEN2) .withRootUsername(userName) .withSsh(sshPublicKey) .withNewDataDisk(10) .withExistingDataDisk(dataDisk) .withSize(VirtualMachineSizeTypes.STANDARD_DS1_V2) .create();Restart Virtual Machine instance.
azure.virtualMachines().listByResourceGroupAsync(resourceGroupName) .flatMap(VirtualMachine::restartAsync) //...- Returns:
- entry point to managing virtual machines
-
virtualMachineScaleSets
- Returns:
- entry point to managing virtual machine scale sets.
-
virtualMachineImages
- Returns:
- entry point to managing virtual machine images
-
virtualMachineCustomImages
- Returns:
- entry point to managing virtual machine custom images
-
disks
- Returns:
- entry point to managing managed disks
-
snapshots
- Returns:
- entry point to managing managed snapshots
-
computeSkus
- Returns:
- the compute service SKU management API entry point
-
publicIpAddresses
- Returns:
- entry point to managing public IP addresses
-
publicIpPrefixes
- Returns:
- entry point to managing public IP prefixes
-
networkInterfaces
- Returns:
- entry point to managing network interfaces
-
computeUsages
- Returns:
- entry point to managing compute resource usages
-
vaults
- Returns:
- entry point to managing key vaults
-
trafficManagerProfiles
- Returns:
- entry point to managing traffic manager profiles.
-
redisCaches
- Returns:
- entry point to managing Redis Caches.
-
cdnProfiles
- Returns:
- entry point to managing cdn manager profiles.
-
dnsZones
- Returns:
- entry point to managing DNS zones.
-
webApps
- Returns:
- entry point to managing web apps.
-
functionApps
Entry point to managing function apps.Code Samples
Create an Azure Function App
Creatable<StorageAccount> creatableStorageAccount = azure.storageAccounts() .define("<storage-account-name>") .withRegion(Region.US_EAST) .withExistingResourceGroup(resourceGroupName) .withGeneralPurposeAccountKindV2() .withSku(StorageAccountSkuType.STANDARD_LRS); Creatable<AppServicePlan> creatableAppServicePlan = azure.appServicePlans() .define("<app-service-plan-name>") .withRegion(Region.US_EAST) .withExistingResourceGroup(resourceGroupName) .withPricingTier(PricingTier.STANDARD_S1) .withOperatingSystem(OperatingSystem.LINUX); FunctionApp linuxFunctionApp = azure.functionApps().define("<function-app-name>") .withRegion(Region.US_EAST) .withExistingResourceGroup(resourceGroupName) .withNewLinuxAppServicePlan(creatableAppServicePlan) .withBuiltInImage(FunctionRuntimeStack.JAVA_8) .withNewStorageAccount(creatableStorageAccount) .withHttpsOnly(true) .withAppSetting("WEBSITE_RUN_FROM_PACKAGE", "<function-app-package-url>") .create();- Returns:
- entry point to managing function apps.
-
appServicePlans
- Returns:
- entry point to managing app service plans.
-
appServiceDomains
- Returns:
- entry point to managing domains.
-
appServiceCertificates
- Returns:
- entry point to managing certificates.
-
appServiceCertificateOrders
- Returns:
- entry point to managing certificates orders.
-
sqlServers
- Returns:
- entry point to managing Sql server.
-
serviceBusNamespaces
- Returns:
- entry point to managing Service Bus.
-
kubernetesClusters
- Returns:
- entry point to managing Kubernetes clusters.
-
containerGroups
- Returns:
- entry point to managing Azure Container Instances.
-
containerRegistries
- Returns:
- entry point to managing Container Registries.
-
containerRegistryTasks
- Returns:
- entry point to managing Container Registry RegistryTasks.
-
containerRegistryTaskRuns
- Returns:
- entry point to managing Container Registry RegistryTask Runs.
-
cosmosDBAccounts
- Returns:
- entry point to managing Container Regsitries.
-
searchServices
- Returns:
- entry point to managing Search services.
-
identities
- Returns:
- entry point to managing Managed Service Identity (MSI) identities.
-
accessManagement
- Returns:
- entry point to authentication and authorization management in Azure
-
activityLogs
- Returns:
- entry point to listing activity log events in Azure
-
metricDefinitions
- Returns:
- entry point to listing metric definitions in Azure
-
diagnosticSettings
- Returns:
- entry point to listing diagnostic settings in Azure
-
actionGroups
- Returns:
- entry point to managing action groups in Azure
-
alertRules
- Returns:
- entry point to managing alertRules in Azure
-
autoscaleSettings
- Returns:
- entry point to managing Autoscale Settings in Azure
-
eventHubNamespaces
- Returns:
- entry point to managing event hub namespaces.
-
eventHubs
- Returns:
- entry point to managing event hubs.
-
eventHubDisasterRecoveryPairings
- Returns:
- entry point to managing event hub namespace geo disaster recovery.
-
galleries
- Returns:
- entry point to manage compute galleries.
-
galleryImages
- Returns:
- entry point to manage compute gallery images.
-
galleryImageVersions
- Returns:
- entry point to manage compute gallery image versions.
-
storageBlobContainers
Entry point to blob container management API.Code Samples
Create a Blob Container
azure.storageBlobContainers() .defineContainer("container") .withExistingStorageAccount(storageAccount) .withPublicAccess(PublicAccess.NONE) //... .create();- Returns:
- the blob container management API entry point
-
storageBlobServices
- Returns:
- the blob service management API entry point
-
storageManagementPolicies
- Returns:
- the blob service management API entry point
-
springServices
- Returns:
- the spring service management API entry point
-
privateDnsZones
- Returns:
- the private DNS zone management API entry point
-
privateEndpoints
- Returns:
- entry point to private endpoints management
-
tagOperations
- Returns:
- entry point to tag management management
-
networkProfiles
- Returns:
- entry point to network profiles management
-
diskEncryptionSets
- Returns:
- entry point to disk encryption sets management
-
managedHsms
- Returns:
- entry point to Managed Hardware Security Module management
-