你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
AzureResourceManager Class
- java.
lang. Object - com.
azure. resourcemanager. AzureResourceManager
- com.
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
Methods inherited from java.lang.Object
Method Details
accessManagement
public AccessManagement accessManagement()
Returns:
actionGroups
public ActionGroups actionGroups()
Returns:
activityLogs
public ActivityLogs activityLogs()
Returns:
alertRules
public AlertRules alertRules()
Returns:
appServiceCertificateOrders
public AppServiceCertificateOrders appServiceCertificateOrders()
Returns:
appServiceCertificates
public AppServiceCertificates appServiceCertificates()
Returns:
appServiceDomains
public AppServiceDomains appServiceDomains()
Returns:
appServicePlans
public AppServicePlans appServicePlans()
Returns:
applicationGateways
public ApplicationGateways applicationGateways()
Returns:
applicationSecurityGroups
public ApplicationSecurityGroups applicationSecurityGroups()
Returns:
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:
Returns:
authenticate
public static AzureResourceManager.Authenticated authenticate(HttpPipeline httpPipeline, AzureProfile profile)
Authenticates API access using a RestClient instance.
Parameters:
Returns:
autoscaleSettings
public AutoscaleSettings autoscaleSettings()
Returns:
availabilitySets
public AvailabilitySets availabilitySets()
Returns:
cdnProfiles
public CdnProfiles cdnProfiles()
Returns:
computeSkus
public ComputeSkus computeSkus()
Returns:
computeUsages
public ComputeUsages computeUsages()
Returns:
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:
containerGroups
public ContainerGroups containerGroups()
Returns:
containerRegistries
public Registries containerRegistries()
Returns:
containerRegistryTaskRuns
public RegistryTaskRuns containerRegistryTaskRuns()
Returns:
containerRegistryTasks
public RegistryTasks containerRegistryTasks()
Returns:
cosmosDBAccounts
public CosmosDBAccounts cosmosDBAccounts()
Returns:
ddosProtectionPlans
public DdosProtectionPlans ddosProtectionPlans()
Returns:
deployments
public Deployments deployments()
Returns:
diagnosticSettings
public DiagnosticSettings diagnosticSettings()
Returns:
diskEncryptionSets
public DiskEncryptionSets diskEncryptionSets()
Returns:
disks
public Disks disks()
Returns:
dnsZones
public DnsZones dnsZones()
Returns:
eventHubDisasterRecoveryPairings
public EventHubDisasterRecoveryPairings eventHubDisasterRecoveryPairings()
Returns:
eventHubNamespaces
public EventHubNamespaces eventHubNamespaces()
Returns:
eventHubs
public EventHubs eventHubs()
Returns:
expressRouteCircuits
public ExpressRouteCircuits expressRouteCircuits()
Returns:
expressRouteCrossConnections
public ExpressRouteCrossConnections expressRouteCrossConnections()
Returns:
features
public Features features()
Returns:
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:
galleries
public Galleries galleries()
Returns:
galleryImageVersions
public GalleryImageVersions galleryImageVersions()
Returns:
galleryImages
public GalleryImages galleryImages()
Returns:
genericResources
public GenericResources genericResources()
Returns:
getCurrentSubscription
public Subscription getCurrentSubscription()
Returns:
identities
public Identities identities()
Returns:
kubernetesClusters
public KubernetesClusters kubernetesClusters()
Returns:
loadBalancers
public LoadBalancers loadBalancers()
Returns:
localNetworkGateways
public LocalNetworkGateways localNetworkGateways()
Returns:
managedHsms
public ManagedHsms managedHsms()
Returns:
managementLocks
public ManagementLocks managementLocks()
Returns:
metricDefinitions
public MetricDefinitions metricDefinitions()
Returns:
networkInterfaces
public NetworkInterfaces networkInterfaces()
Returns:
networkProfiles
public NetworkProfiles networkProfiles()
Returns:
networkSecurityGroups
public NetworkSecurityGroups networkSecurityGroups()
Returns:
networkUsages
public NetworkUsages networkUsages()
Returns:
networkWatchers
public NetworkWatchers networkWatchers()
Returns:
networks
public Networks networks()
Returns:
policyAssignments
public PolicyAssignments policyAssignments()
Returns:
policyDefinitions
public PolicyDefinitions policyDefinitions()
Returns:
privateDnsZones
public PrivateDnsZones privateDnsZones()
Returns:
privateEndpoints
public PrivateEndpoints privateEndpoints()
Returns:
providers
public Providers providers()
Returns:
publicIpAddresses
public PublicIpAddresses publicIpAddresses()
Returns:
publicIpPrefixes
public PublicIpPrefixes publicIpPrefixes()
Returns:
redisCaches
public RedisCaches redisCaches()
Returns:
resourceGroups
public ResourceGroups resourceGroups()
Returns:
routeFilters
public RouteFilters routeFilters()
Returns:
routeTables
public RouteTables routeTables()
Returns:
searchServices
public SearchServices searchServices()
Returns:
serviceBusNamespaces
public ServiceBusNamespaces serviceBusNamespaces()
Returns:
snapshots
public Snapshots snapshots()
Returns:
springServices
public SpringServices springServices()
Returns:
sqlServers
public SqlServers sqlServers()
Returns:
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:
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:
storageBlobServices
public BlobServices storageBlobServices()
Returns:
storageManagementPolicies
public ManagementPolicies storageManagementPolicies()
Returns:
storageSkus
public StorageSkus storageSkus()
Returns:
storageUsages
public Usages storageUsages()
Returns:
subscriptionId
public String subscriptionId()
Returns:
subscriptions
public Subscriptions subscriptions()
Returns:
tagOperations
public TagOperations tagOperations()
Returns:
tenantId
public String tenantId()
Returns:
tenants
public Tenants tenants()
Returns:
trafficManagerProfiles
public TrafficManagerProfiles trafficManagerProfiles()
Returns:
vaults
public Vaults vaults()
Returns:
virtualMachineCustomImages
public VirtualMachineCustomImages virtualMachineCustomImages()
Returns:
virtualMachineImages
public VirtualMachineImages virtualMachineImages()
Returns:
virtualMachineScaleSets
public VirtualMachineScaleSets virtualMachineScaleSets()
Returns:
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:
virtualNetworkGateways
public VirtualNetworkGateways virtualNetworkGateways()
Returns:
webApps
public WebApps webApps()
Returns: