Code review comment: not sure we need to be consistent across languages on this condition to set headers, but just want to point it. LGTM otherwise.

Code under review:
private HttpPipeline getDefaultHttpPipeline(Configuration buildConfiguration) {
        
        final List<HttpPipelinePolicy> policies = new ArrayList<>();

        
        if (tokenCredential != null) {
            policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPE));
        } else if (!CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getSubscriptionKey())
            || !CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getApiKey())) {
            headers.put(OCP_APIM_SUBSCRIPTION_KEY, metricsAdvisorKeyCredential.getSubscriptionKey());
            headers.put(API_KEY, metricsAdvisorKeyCredential.getApiKey());
        } else {
            
            throw logger.logExceptionAsError(
                new IllegalArgumentException("Missing credential information while building a client."));
        }

        policies.add(new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion,
            buildConfiguration));
        policies.add(new RequestIdPolicy());
        policies.add(new AddHeadersPolicy(headers));

        HttpPolicyProviders.addBeforeRetryPolicies(policies);
        policies.add(retryPolicy == null ? DEFAULT_RETRY_POLICY : retryPolicy);
        policies.add(new AddDatePolicy());

        policies.addAll(this.policies);
        HttpPolicyProviders.addAfterRetryPolicies(policies);

        return new HttpPipelineBuilder()
            .policies(policies.toArray(new HttpPipelinePolicy[0]))
            .httpClient(httpClient)
            .build();
    }

Line commented on: || !CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getApiKey())) {

Revised code:
private HttpPipeline getDefaultHttpPipeline(Configuration buildConfiguration) {
        
        final List<HttpPipelinePolicy> policies = new ArrayList<>();

        
        if (tokenCredential != null) {
            policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPE));
        } else if (!CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getSubscriptionKey())
            || !CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getApiKey())) {
            headers.put(OCP_APIM_SUBSCRIPTION_KEY, metricsAdvisorKeyCredential.getSubscriptionKey());
            headers.put(API_KEY, metricsAdvisorKeyCredential.getApiKey());
        } else {
            
            throw logger.logExceptionAsError(
                new IllegalArgumentException("Missing credential information while building a client."));
        }

        policies.add(new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion,
            buildConfiguration));
        policies.add(new RequestIdPolicy());
        policies.add(new AddHeadersPolicy(headers));

        HttpPolicyProviders.addBeforeRetryPolicies(policies);
        policies.add(retryPolicy == null ? DEFAULT_RETRY_POLICY : retryPolicy);
        policies.add(new AddDatePolicy());

        policies.addAll(this.policies);
        HttpPolicyProviders.addAfterRetryPolicies(policies);

        return new HttpPipelineBuilder()
            .policies(policies.toArray(new HttpPipelinePolicy[0]))
            .httpClient(httpClient)
            .build();
    }