com.microsoft.azure.management.Azure.authenticate()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(288)

本文整理了Java中com.microsoft.azure.management.Azure.authenticate()方法的一些代码示例,展示了Azure.authenticate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Azure.authenticate()方法的具体详情如下:
包路径:com.microsoft.azure.management.Azure
类名称:Azure
方法名:authenticate

Azure.authenticate介绍

[英]Authenticate to Azure using an Azure credentials object.
[中]使用Azure凭据对象对Azure进行身份验证。

代码示例

代码示例来源:origin: gradle.plugin.com.intershop.gradle.plugin.azure/azurePlugin

protected Azure getClient(String subscriptionId)
{
  ApplicationTokenCredentials creds = new ApplicationTokenCredentials(clientId, domain, secret,
          AzureEnvironment.AZURE);
  return Azure.authenticate(creds).withSubscription(subscriptionId);
}

代码示例来源:origin: com.microsoft.azure/azure

@Override
public Authenticated authenticate(AzureTokenCredentials credentials) {
  if (credentials.defaultSubscriptionId() != null) {
    return Azure.authenticate(buildRestClient(credentials), credentials.domain(), credentials.defaultSubscriptionId());
  } else {
    return Azure.authenticate(buildRestClient(credentials), credentials.domain());
  }
}

代码示例来源:origin: Azure/azure-libraries-for-java

@Override
public Authenticated authenticate(AzureTokenCredentials credentials) {
  if (credentials.defaultSubscriptionId() != null) {
    return Azure.authenticate(buildRestClient(credentials), credentials.domain(), credentials.defaultSubscriptionId());
  } else {
    return Azure.authenticate(buildRestClient(credentials), credentials.domain());
  }
}

代码示例来源:origin: Azure/azure-libraries-for-java

@Override
  public Authenticated authenticate(File credentialsFile) throws IOException {
    ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credentialsFile);
    return Azure.authenticate(buildRestClient(credentials), credentials.domain(), credentials.defaultSubscriptionId());
  }
}

代码示例来源:origin: com.microsoft.azure/azure

@Override
  public Authenticated authenticate(File credentialsFile) throws IOException {
    ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credentialsFile);
    return Azure.authenticate(buildRestClient(credentials), credentials.domain(), credentials.defaultSubscriptionId());
  }
}

代码示例来源:origin: Microsoft/azure-tools-for-java

try {
  fileReporter.report("Checking: Azure.authenticate(authFile)...");
  Azure.Authenticated azureAuthenticated = Azure.authenticate(authFiel);
  fileReporter.report("Checking: azureAuthenticated.subscriptions().list()...");
  azureAuthenticated.subscriptions().list();

代码示例来源:origin: Microsoft/spring-cloud-azure

@Bean
@ConditionalOnMissingBean
public Azure azure(AzureProperties azureProperties) throws IOException {
  CredentialsProvider credentialsProvider = new DefaultCredentialsProvider(azureProperties);
  ApplicationTokenCredentials credentials = credentialsProvider.getCredentials();
  TelemetryCollector.getInstance().setSubscription(credentials.defaultSubscriptionId());
  RestClient restClient = new RestClient.Builder()
      .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
      .withCredentials(credentials).withSerializerAdapter(new AzureJacksonAdapter())
      .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
      .withInterceptor(new ProviderRegistrationInterceptor(credentials))
      .withInterceptor(new ResourceManagerThrottlingInterceptor()).withUserAgent(SPRING_CLOUD_USER_AGENT)
      .build();
  return Azure.authenticate(restClient, credentials.domain()).withDefaultSubscription();
}

代码示例来源:origin: com.microsoft.azure/spring-cloud-azure-autoconfigure

@Bean
@ConditionalOnMissingBean
public Azure azure(AzureProperties azureProperties) throws IOException {
  CredentialsProvider credentialsProvider = new DefaultCredentialsProvider(azureProperties);
  ApplicationTokenCredentials credentials = credentialsProvider.getCredentials();
  TelemetryCollector.getInstance().setSubscription(credentials.defaultSubscriptionId());
  RestClient restClient = new RestClient.Builder()
      .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
      .withCredentials(credentials).withSerializerAdapter(new AzureJacksonAdapter())
      .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
      .withInterceptor(new ProviderRegistrationInterceptor(credentials))
      .withInterceptor(new ResourceManagerThrottlingInterceptor()).withUserAgent(SPRING_CLOUD_USER_AGENT)
      .build();
  return Azure.authenticate(restClient, credentials.domain()).withDefaultSubscription();
}

相关文章