Class AzureResourceManager

java.lang.Object
com.azure.resourcemanager.AzureResourceManager

public final class AzureResourceManager extends Object
The entry point for accessing resource management APIs in Azure.

Instantiating an Azure Client

 AzureProfile profile = new AzureProfile(tenantId, subscriptionId, AzureCloud.AZURE_PUBLIC_CLOUD);
 TokenCredential credential = new DefaultAzureCredentialBuilder()
     .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
     .build();
 AzureResourceManager azure = AzureResourceManager
     .authenticate(credential, profile)
     .withDefaultSubscription();
 
  • 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, AzureCloud.AZURE_PUBLIC_CLOUD);
       TokenCredential credential = new DefaultAzureCredentialBuilder()
           .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
           .build();
       AzureResourceManager azure = AzureResourceManager
           .authenticate(credential, profile)
           .withDefaultSubscription();
       
      Parameters:
      credential - the credential object
      profile - 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 - the HttpPipeline configured with Azure authentication credential.
      profile - the profile used in Active Directory
      Returns:
      authenticated Azure client
    • configure

      public static AzureResourceManager.Configurable 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

      public String subscriptionId()
      Gets the currently selected subscription ID this client is authenticated to work with.
      Returns:
      the currently selected subscription ID this client is authenticated to work with
    • tenantId

      public String tenantId()
      Gets the currently selected tenant ID this client is authenticated to work with.
      Returns:
      the currently selected tenant ID this client is authenticated to work with
    • getCurrentSubscription

      public Subscription getCurrentSubscription()
      Gets the currently selected subscription this client is authenticated to work with.
      Returns:
      the currently selected subscription this client is authenticated to work with
    • subscriptions

      public Subscriptions subscriptions()
      Gets entry point to managing subscriptions.
      Returns:
      entry point to managing subscriptions
    • tenants

      public Tenants tenants()
      Gets entry point to managing tenants.
      Returns:
      entry point to managing tenants
    • resourceGroups

      public ResourceGroups resourceGroups()
      Gets entry point to managing resource groups.
      Returns:
      entry point to managing resource groups
    • deployments

      public Deployments deployments()
      Gets entry point to managing deployments.
      Returns:
      entry point to managing deployments
    • genericResources

      public GenericResources genericResources()
      Gets entry point to managing generic resources.
      Returns:
      entry point to managing generic resources
    • features

      public Features features()
      Gets entry point to managing features.
      Returns:
      entry point to managing features
    • providers

      public Providers providers()
      Gets entry point to managing resource providers.
      Returns:
      entry point to managing resource providers
    • policyDefinitions

      public PolicyDefinitions policyDefinitions()
      Gets entry point to managing policy definitions.
      Returns:
      entry point to managing policy definitions.
    • policyAssignments

      public PolicyAssignments policyAssignments()
      Gets entry point to managing policy assignments.
      Returns:
      entry point to managing policy assignments.
    • managementLocks

      public ManagementLocks managementLocks()
      Gets entry point to managing locks.
      Returns:
      entry point to managing locks.
    • storageAccounts

      public StorageAccounts storageAccounts()
      Entry point to managing storage accounts

      Code 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

      public Usages storageUsages()
      Gets entry point to managing storage account usages.
      Returns:
      entry point to managing storage account usages
    • storageSkus

      public StorageSkus storageSkus()
      Gets entry point to managing storage service SKUs.
      Returns:
      entry point to managing storage service SKUs
    • availabilitySets

      public AvailabilitySets availabilitySets()
      Gets entry point to managing availability sets.
      Returns:
      entry point to managing availability sets
    • networks

      public Networks networks()
      Gets entry point to managing virtual networks.
      Returns:
      entry point to managing virtual networks
    • routeTables

      public RouteTables routeTables()
      Gets entry point to managing route tables.
      Returns:
      entry point to managing route tables
    • loadBalancers

      public LoadBalancers loadBalancers()
      Gets entry point to managing load balancers.
      Returns:
      entry point to managing load balancers
    • applicationGateways

      public ApplicationGateways applicationGateways()
      Gets entry point to managing application gateways.
      Returns:
      entry point to managing application gateways
    • networkSecurityGroups

      public NetworkSecurityGroups networkSecurityGroups()
      Gets entry point to managing network security groups.
      Returns:
      entry point to managing network security groups
    • networkUsages

      public NetworkUsages networkUsages()
      Gets entry point to managing network resource usages.
      Returns:
      entry point to managing network resource usages
    • networkWatchers

      public NetworkWatchers networkWatchers()
      Gets entry point to managing network watchers.
      Returns:
      entry point to managing network watchers
    • virtualNetworkGateways

      public VirtualNetworkGateways virtualNetworkGateways()
      Gets entry point to managing virtual network gateways.
      Returns:
      entry point to managing virtual network gateways
    • localNetworkGateways

      public LocalNetworkGateways localNetworkGateways()
      Gets entry point to managing local network gateways.
      Returns:
      entry point to managing local network gateways
    • expressRouteCircuits

      public ExpressRouteCircuits expressRouteCircuits()
      Gets entry point to managing express route circuits.
      Returns:
      entry point to managing express route circuits
    • expressRouteCrossConnections

      public ExpressRouteCrossConnections expressRouteCrossConnections()
      Gets entry point to managing express route cross connections.
      Returns:
      entry point to managing express route cross connections
    • applicationSecurityGroups

      public ApplicationSecurityGroups applicationSecurityGroups()
      Gets entry point to managing express route circuits.
      Returns:
      entry point to managing express route circuits
    • routeFilters

      public RouteFilters routeFilters()
      Gets entry point to managing route filters.
      Returns:
      entry point to managing route filters
    • ddosProtectionPlans

      public DdosProtectionPlans ddosProtectionPlans()
      Gets entry point to managing DDoS protection plans.
      Returns:
      entry point to managing DDoS protection plans
    • virtualMachines

      public VirtualMachines 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

      public VirtualMachineScaleSets virtualMachineScaleSets()
      Gets entry point to managing virtual machine scale sets.
      Returns:
      entry point to managing virtual machine scale sets.
    • virtualMachineImages

      public VirtualMachineImages virtualMachineImages()
      Gets entry point to managing virtual machine images.
      Returns:
      entry point to managing virtual machine images
    • virtualMachineCustomImages

      public VirtualMachineCustomImages virtualMachineCustomImages()
      Gets entry point to managing virtual machine custom images.
      Returns:
      entry point to managing virtual machine custom images
    • disks

      public Disks disks()
      Gets entry point to managing managed disks.
      Returns:
      entry point to managing managed disks
    • snapshots

      public Snapshots snapshots()
      Gets entry point to managing managed snapshots.
      Returns:
      entry point to managing managed snapshots
    • computeSkus

      public ComputeSkus computeSkus()
      Gets the compute service SKU management API entry point.
      Returns:
      the compute service SKU management API entry point
    • publicIpAddresses

      public PublicIpAddresses publicIpAddresses()
      Gets entry point to managing public IP addresses.
      Returns:
      entry point to managing public IP addresses
    • publicIpPrefixes

      public PublicIpPrefixes publicIpPrefixes()
      Gets entry point to managing public IP prefixes.
      Returns:
      entry point to managing public IP prefixes
    • networkInterfaces

      public NetworkInterfaces networkInterfaces()
      Gets entry point to managing network interfaces.
      Returns:
      entry point to managing network interfaces
    • computeUsages

      public ComputeUsages computeUsages()
      Gets entry point to managing compute resource usages.
      Returns:
      entry point to managing compute resource usages
    • vaults

      public Vaults vaults()
      Gets entry point to managing key vaults.
      Returns:
      entry point to managing key vaults
    • trafficManagerProfiles

      public TrafficManagerProfiles trafficManagerProfiles()
      Gets entry point to managing traffic manager profiles.
      Returns:
      entry point to managing traffic manager profiles.
    • redisCaches

      public RedisCaches redisCaches()
      Gets entry point to managing Redis Caches.
      Returns:
      entry point to managing Redis Caches.
    • cdnProfiles

      public CdnProfiles cdnProfiles()
      Gets entry point to managing cdn manager profiles.
      Returns:
      entry point to managing cdn manager profiles.
    • dnsZones

      public DnsZones dnsZones()
      Gets entry point to managing DNS zones.
      Returns:
      entry point to managing DNS zones.
    • webApps

      public WebApps webApps()
      Gets entry point to managing web apps.
      Returns:
      entry point to managing web apps.
    • functionApps

      public FunctionApps 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

      public AppServicePlans appServicePlans()
      Gets entry point to managing app service plans.
      Returns:
      entry point to managing app service plans.
    • appServiceDomains

      public AppServiceDomains appServiceDomains()
      Gets entry point to managing domains.
      Returns:
      entry point to managing domains.
    • appServiceCertificates

      public AppServiceCertificates appServiceCertificates()
      Gets entry point to managing certificates.
      Returns:
      entry point to managing certificates.
    • appServiceCertificateOrders

      public AppServiceCertificateOrders appServiceCertificateOrders()
      Gets entry point to managing certificates orders.
      Returns:
      entry point to managing certificates orders.
    • sqlServers

      public SqlServers sqlServers()
      Gets entry point to managing Sql server.
      Returns:
      entry point to managing Sql server.
    • serviceBusNamespaces

      public ServiceBusNamespaces serviceBusNamespaces()
      Gets entry point to managing Service Bus.
      Returns:
      entry point to managing Service Bus.
    • kubernetesClusters

      public KubernetesClusters kubernetesClusters()
      Gets entry point to managing Kubernetes clusters.
      Returns:
      entry point to managing Kubernetes clusters.
    • containerGroups

      public ContainerGroups containerGroups()
      Gets entry point to managing Azure Container Instances.
      Returns:
      entry point to managing Azure Container Instances.
    • containerRegistries

      public Registries containerRegistries()
      Gets entry point to managing Container Registries.
      Returns:
      entry point to managing Container Registries.
    • containerRegistryTasks

      public RegistryTasks containerRegistryTasks()
      Gets entry point to managing Container Registry RegistryTasks.
      Returns:
      entry point to managing Container Registry RegistryTasks.
    • containerRegistryTaskRuns

      public RegistryTaskRuns containerRegistryTaskRuns()
      Gets entry point to managing Container Registry RegistryTask Runs.
      Returns:
      entry point to managing Container Registry RegistryTask Runs.
    • cosmosDBAccounts

      public CosmosDBAccounts cosmosDBAccounts()
      Gets entry point to managing Container Regsitries.
      Returns:
      entry point to managing Container Regsitries.
    • searchServices

      public SearchServices searchServices()
      Gets entry point to managing Search services.
      Returns:
      entry point to managing Search services.
    • identities

      public Identities identities()
      Gets entry point to managing Managed Service Identity (MSI) identities.
      Returns:
      entry point to managing Managed Service Identity (MSI) identities.
    • accessManagement

      public AccessManagement accessManagement()
      Gets entry point to authentication and authorization management in Azure.
      Returns:
      entry point to authentication and authorization management in Azure
    • activityLogs

      public ActivityLogs activityLogs()
      Gets entry point to listing activity log events in Azure.
      Returns:
      entry point to listing activity log events in Azure
    • metricDefinitions

      public MetricDefinitions metricDefinitions()
      Gets entry point to listing metric definitions in Azure.
      Returns:
      entry point to listing metric definitions in Azure
    • diagnosticSettings

      public DiagnosticSettings diagnosticSettings()
      Gets entry point to listing diagnostic settings in Azure.
      Returns:
      entry point to listing diagnostic settings in Azure
    • actionGroups

      public ActionGroups actionGroups()
      Gets entry point to managing action groups in Azure.
      Returns:
      entry point to managing action groups in Azure
    • alertRules

      public AlertRules alertRules()
      Gets entry point to managing alertRules in Azure.
      Returns:
      entry point to managing alertRules in Azure
    • autoscaleSettings

      public AutoscaleSettings autoscaleSettings()
      Gets entry point to managing Autoscale Settings in Azure.
      Returns:
      entry point to managing Autoscale Settings in Azure
    • eventHubNamespaces

      public EventHubNamespaces eventHubNamespaces()
      Gets entry point to managing event hub namespaces.
      Returns:
      entry point to managing event hub namespaces.
    • eventHubs

      public EventHubs eventHubs()
      Gets entry point to managing event hubs.
      Returns:
      entry point to managing event hubs.
    • eventHubDisasterRecoveryPairings

      public EventHubDisasterRecoveryPairings eventHubDisasterRecoveryPairings()
      Gets entry point to managing event hub namespace geo disaster recovery.
      Returns:
      entry point to managing event hub namespace geo disaster recovery.
    • galleries

      public Galleries galleries()
      Gets entry point to managing compute galleries.
      Returns:
      entry point to managing compute galleries.
    • galleryImages

      public GalleryImages galleryImages()
      Gets entry point to managing compute gallery images.
      Returns:
      entry point to managing compute gallery images.
    • galleryImageVersions

      public GalleryImageVersions galleryImageVersions()
      Gets entry point to managing compute gallery image versions.
      Returns:
      entry point to managing compute gallery image versions.
    • storageBlobContainers

      public BlobContainers 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

      public BlobServices storageBlobServices()
      Gets the blob service management API entry point.
      Returns:
      the blob service management API entry point
    • storageManagementPolicies

      public ManagementPolicies storageManagementPolicies()
      Gets the blob service management API entry point.
      Returns:
      the blob service management API entry point
    • springServices

      @Deprecated public SpringServices springServices()
      Deprecated.
      azure-resourcemanager-appplatform has been deprecated and will no longer be maintained after 03/31/2025.

      We recommend azure-resourcemanager-appcontainers and azure-resourcemanager-containerservice as the replacement libraries.

      Refer to Azure Spring Apps retirement announcement for more retirement details and how to migrate to the new services.

      Refer to our deprecation policy for more details.

      Gets the spring service management API entry point.
      Returns:
      the spring service management API entry point
    • privateDnsZones

      public PrivateDnsZones privateDnsZones()
      Gets the private DNS zone management API entry point.
      Returns:
      the private DNS zone management API entry point
    • privateEndpoints

      public PrivateEndpoints privateEndpoints()
      Gets entry point to private endpoints management.
      Returns:
      entry point to private endpoints management
    • tagOperations

      public TagOperations tagOperations()
      Gets entry point to tag management.
      Returns:
      entry point to tag management
    • networkProfiles

      public NetworkProfiles networkProfiles()
      Gets entry point to network profiles management.
      Returns:
      entry point to network profiles management
    • diskEncryptionSets

      public DiskEncryptionSets diskEncryptionSets()
      Gets entry point to disk encryption sets management.
      Returns:
      entry point to disk encryption sets management
    • managedHsms

      public ManagedHsms managedHsms()
      Gets entry point to Managed Hardware Security Module management.
      Returns:
      entry point to Managed Hardware Security Module management