Skip to content

Commit

Permalink
fix issue Azure#16595 (Azure#16673)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacko9et authored Oct 22, 2020
1 parent fe7f5b9 commit 89cf240
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import com.azure.spring.cloud.context.core.impl.DefaultCredentialsProvider;
import com.microsoft.rest.RestClient;
import java.io.IOException;
import java.util.Optional;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
Expand Down Expand Up @@ -56,12 +58,10 @@ public Azure azure(AzureTokenCredentials credentials, AzureProperties azurePrope
.withInterceptor(new ResourceManagerThrottlingInterceptor()).withUserAgent(SPRING_CLOUD_USER_AGENT)
.build();

if (azureProperties.getSubscriptionId() == null) {
return Azure.authenticate(restClient, credentials.domain()).withDefaultSubscription();
} else {
return Azure.authenticate(restClient, credentials.domain())
.withSubscription(azureProperties.getSubscriptionId());
}
String subscriptionId = Optional.of(azureProperties.getSubscriptionId())
.orElseGet(credentials::defaultSubscriptionId);
return Azure.authenticate(restClient, credentials.domain())
.withSubscription(subscriptionId);
}

@Bean
Expand Down

0 comments on commit 89cf240

Please sign in to comment.