Skip to content

Conversation

emasab
Copy link
Contributor

@emasab emasab commented Oct 3, 2025

What

Checklist

  • Contains customer facing changes? Including API/behavior changes
  • Did you add sufficient unit test and/or integration test coverage for this PR?
    • If not, please explain why it is not required

References

JIRA:

Test & Review

Open questions / Follow-ups

@emasab emasab requested review from a team as code owners October 3, 2025 17:53
@Copilot Copilot AI review requested due to automatic review settings October 3, 2025 17:53
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for OAuth Azure Instance Metadata Service (IMDS) authentication to the Confluent Kafka client library. It introduces a new metadata-based authentication type for OAUTHBEARER/OIDC that allows authentication using Azure IMDS endpoints with managed identities.

  • Added new SaslOauthbearerMetadataAuthenticationType enum with AzureIMDS option
  • Updated configuration generation to support the new Azure IMDS authentication type
  • Added a complete example demonstrating OAuth OIDC authentication with Azure IMDS

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/Confluent.Kafka/Config_gen.cs Auto-generated configuration file with new enum and property for Azure IMDS authentication
src/ConfigGen/Program.cs Added mapping for azure_imds to AzureIMDS in configuration generation
examples/OAuthOIDCAzureIMDS/Program.cs New example demonstrating OAuth OIDC authentication using Azure IMDS
examples/OAuthOIDCAzureIMDS/OAuthOIDCAzureIMDS.csproj Project file for the new Azure IMDS example
CHANGELOG.md Added changelog entry documenting the new OAuth OIDC Azure IMDS feature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 46 to 51
if (args.Length != 2)
{
Console.WriteLine("Usage: .. brokerList");
return;
}
var bootstrapServers = args[1];
Copy link
Preview

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Array index mismatch - the code checks for 2 arguments but accesses index 1 when the usage message suggests only one argument (brokerList). This should be args[0] if expecting one argument, or the argument count check should be updated.

Suggested change
if (args.Length != 2)
{
Console.WriteLine("Usage: .. brokerList");
return;
}
var bootstrapServers = args[1];
if (args.Length != 1)
{
Console.WriteLine("Usage: .. brokerList");
return;
}
var bootstrapServers = args[0];

Copilot uses AI. Check for mistakes.

}
}

private static void createTopic(ClientConfig config, String topicName)
Copy link
Preview

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use string instead of String - the lowercase alias is preferred in C# code.

Suggested change
private static void createTopic(ClientConfig config, String topicName)
private static void createTopic(ClientConfig config, string topicName)

Copilot uses AI. Check for mistakes.

using (var adminClient = new AdminClientBuilder(config).Build())
{
adminClient.CreateTopicsAsync(new TopicSpecification[] {
new TopicSpecification { Name = topicName, ReplicationFactor = 3, NumPartitions = 1 } }).Wait(); ;
Copy link
Preview

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double semicolon at the end of the line should be a single semicolon.

Suggested change
new TopicSpecification { Name = topicName, ReplicationFactor = 3, NumPartitions = 1 } }).Wait(); ;
new TopicSpecification { Name = topicName, ReplicationFactor = 3, NumPartitions = 1 } }).Wait();

Copilot uses AI. Check for mistakes.

Comment on lines 16 to 18
<ItemGroup>
<PackageReference Include="NJsonSchema" Version="10.8.0" />
</ItemGroup>
Copy link
Preview

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NJsonSchema package reference appears unused in the example code. Consider removing this dependency if it's not needed.

Suggested change
<ItemGroup>
<PackageReference Include="NJsonSchema" Version="10.8.0" />
</ItemGroup>
<!-- Removed unused NJsonSchema package reference -->

Copilot uses AI. Check for mistakes.

@airlock-confluentinc airlock-confluentinc bot force-pushed the dev_kafka_oautbearer_azure_imds branch from 8b772df to 8d757ab Compare October 3, 2025 18:17
@sonarqube-confluent

This comment has been minimized.

1 similar comment
@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

1 similar comment
@sonarqube-confluent
Copy link

Failed

  • 66.70% Coverage on New Code (is less than 80.00%)

Analysis Details

0 Issues

  • Bug 0 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 0 Code Smells

Coverage and Duplications

  • Coverage 66.70% Coverage (77.30% Estimated after merge)
  • Duplications No duplication information (0.00% Estimated after merge)

Project ID: confluent-kafka-dotnet

View in SonarQube

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant