Freigeben über


AzureResourceManager Class

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

public final class 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();

Method Summary

Modifier and Type Method and Description
AccessManagement accessManagement()
ActionGroups actionGroups()
ActivityLogs activityLogs()
AlertRules alertRules()
AppServiceCertificateOrders appServiceCertificateOrders()
AppServiceCertificates appServiceCertificates()
AppServiceDomains appServiceDomains()
AppServicePlans appServicePlans()
ApplicationGateways applicationGateways()
ApplicationSecurityGroups applicationSecurityGroups()
static Authenticated authenticate(TokenCredential credential, AzureProfile profile)

Authenticate to Azure using an Azure credential object.

static Authenticated authenticate(HttpPipeline httpPipeline, AzureProfile profile)

Authenticates API access using a RestClient instance.

AutoscaleSettings autoscaleSettings()
AvailabilitySets availabilitySets()
CdnProfiles cdnProfiles()
ComputeSkus computeSkus()
ComputeUsages computeUsages()
static Configurable configure()

Configures the Azure client.

ContainerGroups containerGroups()
Registries containerRegistries()
RegistryTaskRuns containerRegistryTaskRuns()
RegistryTasks containerRegistryTasks()
CosmosDBAccounts cosmosDBAccounts()
DdosProtectionPlans ddosProtectionPlans()
Deployments deployments()
DiagnosticSettings diagnosticSettings()
DiskEncryptionSets diskEncryptionSets()
Disks disks()
DnsZones dnsZones()
EventHubDisasterRecoveryPairings eventHubDisasterRecoveryPairings()
EventHubNamespaces eventHubNamespaces()
EventHubs eventHubs()
ExpressRouteCircuits expressRouteCircuits()
ExpressRouteCrossConnections expressRouteCrossConnections()
Features features()
FunctionApps functionApps()

Entry point to managing function apps.

Galleries galleries()
GalleryImageVersions galleryImageVersions()
GalleryImages galleryImages()
GenericResources genericResources()
Subscription getCurrentSubscription()
Identities identities()
KubernetesClusters kubernetesClusters()
LoadBalancers loadBalancers()
LocalNetworkGateways localNetworkGateways()
ManagedHsms managedHsms()
ManagementLocks managementLocks()
MetricDefinitions metricDefinitions()
NetworkInterfaces networkInterfaces()
NetworkProfiles networkProfiles()
NetworkSecurityGroups networkSecurityGroups()
NetworkUsages networkUsages()
NetworkWatchers networkWatchers()
Networks networks()
PolicyAssignments policyAssignments()
PolicyDefinitions policyDefinitions()
PrivateDnsZones privateDnsZones()
PrivateEndpoints privateEndpoints()
Providers providers()
PublicIpAddresses publicIpAddresses()
PublicIpPrefixes publicIpPrefixes()
RedisCaches redisCaches()
ResourceGroups resourceGroups()
RouteFilters routeFilters()
RouteTables routeTables()
SearchServices searchServices()
ServiceBusNamespaces serviceBusNamespaces()
Snapshots snapshots()
SpringServices springServices()
SqlServers sqlServers()
StorageAccounts storageAccounts()

Entry point to managing storage accounts

BlobContainers storageBlobContainers()

Entry point to blob container management API.

BlobServices storageBlobServices()
ManagementPolicies storageManagementPolicies()
StorageSkus storageSkus()
Usages storageUsages()
String subscriptionId()
Subscriptions subscriptions()
TagOperations tagOperations()
String tenantId()
Tenants tenants()
TrafficManagerProfiles trafficManagerProfiles()
Vaults vaults()
VirtualMachineCustomImages virtualMachineCustomImages()
VirtualMachineImages virtualMachineImages()
VirtualMachineScaleSets virtualMachineScaleSets()
VirtualMachines virtualMachines()

Entry point to managing virtual machines.

VirtualNetworkGateways virtualNetworkGateways()
WebApps webApps()

Methods inherited from java.lang.Object

Method Details

accessManagement

public AccessManagement accessManagement()

Returns:

entry point to authentication and authorization management in Azure

actionGroups

public ActionGroups actionGroups()

Returns:

entry point to managing action groups in Azure

activityLogs

public ActivityLogs activityLogs()

Returns:

entry point to listing activity log events in Azure

alertRules

public AlertRules alertRules()

Returns:

entry point to managing alertRules in Azure

appServiceCertificateOrders

public AppServiceCertificateOrders appServiceCertificateOrders()

Returns:

entry point to managing certificates orders.

appServiceCertificates

public AppServiceCertificates appServiceCertificates()

Returns:

entry point to managing certificates.

appServiceDomains

public AppServiceDomains appServiceDomains()

Returns:

entry point to managing domains.

appServicePlans

public AppServicePlans appServicePlans()

Returns:

entry point to managing app service plans.

applicationGateways

public ApplicationGateways applicationGateways()

Returns:

entry point to managing application gateways

applicationSecurityGroups

public ApplicationSecurityGroups applicationSecurityGroups()

Returns:

entry point to managing express route circuits

authenticate

public static AzureResourceManager.Authenticated authenticate(TokenCredential credential, 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 object
profile - the profile to use

Returns:

the authenticated Azure client

authenticate

public static AzureResourceManager.Authenticated authenticate(HttpPipeline httpPipeline, 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

autoscaleSettings

public AutoscaleSettings autoscaleSettings()

Returns:

entry point to managing Autoscale Settings in Azure

availabilitySets

public AvailabilitySets availabilitySets()

Returns:

entry point to managing availability sets

cdnProfiles

public CdnProfiles cdnProfiles()

Returns:

entry point to managing cdn manager profiles.

computeSkus

public ComputeSkus computeSkus()

Returns:

the compute service SKU management API entry point

computeUsages

public ComputeUsages computeUsages()

Returns:

entry point to managing compute resource usages

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.

containerGroups

public ContainerGroups containerGroups()

Returns:

entry point to managing Azure Container Instances.

containerRegistries

public Registries containerRegistries()

Returns:

entry point to managing Container Registries.

containerRegistryTaskRuns

public RegistryTaskRuns containerRegistryTaskRuns()

Returns:

entry point to managing Container Registry RegistryTask Runs.

containerRegistryTasks

public RegistryTasks containerRegistryTasks()

Returns:

entry point to managing Container Registry RegistryTasks.

cosmosDBAccounts

public CosmosDBAccounts cosmosDBAccounts()

Returns:

entry point to managing Container Regsitries.

ddosProtectionPlans

public DdosProtectionPlans ddosProtectionPlans()

Returns:

entry point to managing DDoS protection plans

deployments

public Deployments deployments()

Returns:

entry point to managing deployments

diagnosticSettings

public DiagnosticSettings diagnosticSettings()

Returns:

entry point to listing diagnostic settings in Azure

diskEncryptionSets

public DiskEncryptionSets diskEncryptionSets()

Returns:

entry point to disk encryption sets management

disks

public Disks disks()

Returns:

entry point to managing managed disks

dnsZones

public DnsZones dnsZones()

Returns:

entry point to managing DNS zones.

eventHubDisasterRecoveryPairings

public EventHubDisasterRecoveryPairings eventHubDisasterRecoveryPairings()

Returns:

entry point to managing event hub namespace geo disaster recovery.

eventHubNamespaces

public EventHubNamespaces eventHubNamespaces()

Returns:

entry point to managing event hub namespaces.

eventHubs

public EventHubs eventHubs()

Returns:

entry point to managing event hubs.

expressRouteCircuits

public ExpressRouteCircuits expressRouteCircuits()

Returns:

entry point to managing express route circuits

expressRouteCrossConnections

public ExpressRouteCrossConnections expressRouteCrossConnections()

Returns:

entry point to managing express route cross connections

features

public Features features()

Returns:

entry point to managing features

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.

galleries

public Galleries galleries()

Returns:

entry point to manage compute galleries.

galleryImageVersions

public GalleryImageVersions galleryImageVersions()

Returns:

entry point to manage compute gallery image versions.

galleryImages

public GalleryImages galleryImages()

Returns:

entry point to manage compute gallery images.

genericResources

public GenericResources genericResources()

Returns:

entry point to managing generic resources

getCurrentSubscription

public Subscription getCurrentSubscription()

Returns:

the currently selected subscription this client is authenticated to work with

identities

public Identities identities()

Returns:

entry point to managing Managed Service Identity (MSI) identities.

kubernetesClusters

public KubernetesClusters kubernetesClusters()

Returns:

entry point to managing Kubernetes clusters.

loadBalancers

public LoadBalancers loadBalancers()

Returns:

entry point to managing load balancers

localNetworkGateways

public LocalNetworkGateways localNetworkGateways()

Returns:

entry point to managing local network gateways

managedHsms

public ManagedHsms managedHsms()

Returns:

entry point to Managed Hardware Security Module management

managementLocks

public ManagementLocks managementLocks()

Returns:

entry point to managing locks.

metricDefinitions

public MetricDefinitions metricDefinitions()

Returns:

entry point to listing metric definitions in Azure

networkInterfaces

public NetworkInterfaces networkInterfaces()

Returns:

entry point to managing network interfaces

networkProfiles

public NetworkProfiles networkProfiles()

Returns:

entry point to network profiles management

networkSecurityGroups

public NetworkSecurityGroups networkSecurityGroups()

Returns:

entry point to managing network security groups

networkUsages

public NetworkUsages networkUsages()

Returns:

entry point to managing network resource usages

networkWatchers

public NetworkWatchers networkWatchers()

Returns:

entry point to managing network watchers

networks

public Networks networks()

Returns:

entry point to managing virtual networks

policyAssignments

public PolicyAssignments policyAssignments()

Returns:

entry point to managing policy assignments.

policyDefinitions

public PolicyDefinitions policyDefinitions()

Returns:

entry point to managing policy definitions.

privateDnsZones

public PrivateDnsZones privateDnsZones()

Returns:

the private DNS zone management API entry point

privateEndpoints

public PrivateEndpoints privateEndpoints()

Returns:

entry point to private endpoints management

providers

public Providers providers()

Returns:

entry point to managing resource providers

publicIpAddresses

public PublicIpAddresses publicIpAddresses()

Returns:

entry point to managing public IP addresses

publicIpPrefixes

public PublicIpPrefixes publicIpPrefixes()

Returns:

entry point to managing public IP prefixes

redisCaches

public RedisCaches redisCaches()

Returns:

entry point to managing Redis Caches.

resourceGroups

public ResourceGroups resourceGroups()

Returns:

entry point to managing resource groups

routeFilters

public RouteFilters routeFilters()

Returns:

entry point to managing route filters

routeTables

public RouteTables routeTables()

Returns:

entry point to managing route tables

searchServices

public SearchServices searchServices()

Returns:

entry point to managing Search services.

serviceBusNamespaces

public ServiceBusNamespaces serviceBusNamespaces()

Returns:

entry point to managing Service Bus.

snapshots

public Snapshots snapshots()

Returns:

entry point to managing managed snapshots

springServices

public SpringServices springServices()

Returns:

the spring service management API entry point

sqlServers

public SqlServers sqlServers()

Returns:

entry point to managing Sql server.

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

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()

Returns:

the blob service management API entry point

storageManagementPolicies

public ManagementPolicies storageManagementPolicies()

Returns:

the blob service management API entry point

storageSkus

public StorageSkus storageSkus()

Returns:

entry point to managing storage service SKUs

storageUsages

public Usages storageUsages()

Returns:

entry point to managing storage account usages

subscriptionId

public String subscriptionId()

Returns:

the currently selected subscription ID this client is authenticated to work with

subscriptions

public Subscriptions subscriptions()

Returns:

entry point to managing subscriptions

tagOperations

public TagOperations tagOperations()

Returns:

entry point to tag management management

tenantId

public String tenantId()

Returns:

the currently selected tenant ID this client is authenticated to work with

tenants

public Tenants tenants()

Returns:

entry point to managing tenants

trafficManagerProfiles

public TrafficManagerProfiles trafficManagerProfiles()

Returns:

entry point to managing traffic manager profiles.

vaults

public Vaults vaults()

Returns:

entry point to managing key vaults

virtualMachineCustomImages

public VirtualMachineCustomImages virtualMachineCustomImages()

Returns:

entry point to managing virtual machine custom images

virtualMachineImages

public VirtualMachineImages virtualMachineImages()

Returns:

entry point to managing virtual machine images

virtualMachineScaleSets

public VirtualMachineScaleSets virtualMachineScaleSets()

Returns:

entry point to managing virtual machine scale sets.

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

virtualNetworkGateways

public VirtualNetworkGateways virtualNetworkGateways()

Returns:

entry point to managing virtual network gateways

webApps

public WebApps webApps()

Returns:

entry point to managing web apps.

Applies to