Skip to content

Commit 854330c

Browse files
authored
.Net: Remove the HTTPS validations in AzureClientCore (#11943)
### Remove HTTPS validation from `AzureClientCore` class. We are redirecting requests internally to inject API keys securely and keep track of token usage in a transparent way, but this involves a YARP proxy in between certain applications and Azure OpenAI. That proxy, being internal behind our servers, doesn't use HTTPS and it doesn't need to use it either. The current version of Semantic Kernel throws an error when using a HTTP endpoint. Current fixes involve a lot of additional steps and going out of the server to come back in through our azure gateway or adding self-generated certificates and bypassing SSL errors, etc... This fix would be very helpful. * Remove the `Verify.StartsWith` validation for the `endpoint` parameter in the constructors of `AzureClientCore` class. * Remove the test case `ConstructorWithInvalidEndpointShouldThrowArgumentException` from `AzureClientCoreTests` class. * Ensure the remaining test cases do not enforce HTTPS validation.
1 parent 1602409 commit 854330c

File tree

2 files changed

+0
-15
lines changed

2 files changed

+0
-15
lines changed

dotnet/src/Connectors/Connectors.AzureOpenAI.UnitTests/Core/AzureClientCoreTests.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,6 @@ public void ConstructorWithValidParametersShouldInitializeCorrectly()
4343
Assert.Equal(new Uri(endpoint), azureClientCore.Endpoint);
4444
}
4545

46-
[Fact]
47-
public void ConstructorWithInvalidEndpointShouldThrowArgumentException()
48-
{
49-
// Arrange
50-
var deploymentName = "test-deployment";
51-
var invalidEndpoint = "http://invalid-endpoint";
52-
var apiKey = "test-api-key";
53-
54-
// Act & Assert
55-
Assert.Throws<ArgumentException>(() =>
56-
new AzureClientCore(deploymentName, invalidEndpoint, apiKey, this._httpClient, this._mockLogger.Object));
57-
}
58-
5946
[Fact]
6047
public void ConstructorWithTokenCredentialShouldInitializeCorrectly()
6148
{

dotnet/src/Connectors/Connectors.AzureOpenAI/Core/AzureClientCore.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ internal AzureClientCore(
5252
{
5353
Verify.NotNullOrWhiteSpace(deploymentName);
5454
Verify.NotNullOrWhiteSpace(endpoint);
55-
Verify.StartsWith(endpoint, "https://", "The Azure OpenAI endpoint must start with 'https://'");
5655
Verify.NotNullOrWhiteSpace(apiKey);
5756

5857
var options = GetAzureOpenAIClientOptions(httpClient, apiVersion);
@@ -85,7 +84,6 @@ internal AzureClientCore(
8584
{
8685
Verify.NotNullOrWhiteSpace(deploymentName);
8786
Verify.NotNullOrWhiteSpace(endpoint);
88-
Verify.StartsWith(endpoint, "https://", "The Azure OpenAI endpoint must start with 'https://'");
8987

9088
var options = GetAzureOpenAIClientOptions(httpClient, apiVersion);
9189

0 commit comments

Comments
 (0)