Skip to content

Conversation

tnc1997
Copy link

@tnc1997 tnc1997 commented Jun 13, 2024

What does this PR do?

This change adds an Azure App Configuration module using Emulator for Azure App Configuration.

Why is it important?

This module allows developers to more easily integration test applications that are dependent on Azure App Configuration.

Related issues

Copy link

netlify bot commented Jun 13, 2024

Deploy Preview for testcontainers-dotnet ready!

Name Link
🔨 Latest commit 4091134
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-dotnet/deploys/666b3ada4fd5e20008f954d2
😎 Deploy Preview https://deploy-preview-1200--testcontainers-dotnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@goldsam
Copy link

goldsam commented Jun 19, 2024

@tnc1997's container not support TLS and his module uses the insecure port of that container.

As had been previously discussed,

ConfigurationClient refuses to connect to a URI endpoint over an unsecured HTTP connection.

The Azure SDK (and specifically ConfigurationClient) enforce TLS everywhere.

The official CosmosDB emulator offers an endpoint for fetching the PEM certificate to make this requirement a little easier to deal with, however there are more issues in play such as the app config domain and scope/identity requirements which had also been discussed extensively.

I worked very hard to [address these issues in my Testcontainers module](https://github.com/goldsam/azure-app-configuration-emulator/blob/9adc28f418b7ae9030c90f859f77fa137aa46311/src/AzureAppConfigurationEmulator.Test containers/AzureAppConfigurationEmulatorBuilder.cs#L71-L91), and was quite disappointed that you discarded that work.

@tnc1997 I had spent a LOT of time contributing to your project throughout our discussions addressing these matters, so this feels like a bit of a slap in the face.

@tnc1997
Copy link
Author

tnc1997 commented Jun 19, 2024

@tnc1997's container not support TLS and his module uses the insecure port of that container.

As had been previously discussed,

ConfigurationClient refuses to connect to a URI endpoint over an unsecured HTTP connection.

The Azure SDK (and specifically ConfigurationClient) enforce TLS everywhere.

The official CosmosDB emulator offers an endpoint for fetching the PEM certificate to make this requirement a little easier to deal with, however there are more issues in play such as the app config domain and scope/identity requirements which had also been discussed extensively.

I worked very hard to [address these issues in my Testcontainers module](https://github.com/goldsam/azure-app-configuration-emulator/blob/9adc28f418b7ae9030c90f859f77fa137aa46311/src/AzureAppConfigurationEmulator.Test containers/AzureAppConfigurationEmulatorBuilder.cs#L71-L91), and was quite disappointed that you discarded that work.

@tnc1997 I had spent a LOT of time contributing to your project throughout our discussions addressing these matters, so this feels like a bit of a slap in the face.

Hi @goldsam, I appreciate your concerns.

Firstly, the Azure SDK does not enforce TLS everywhere, for example the storage clients to name a few:

Secondly, a test has been added that shows that the ConfigurationClient works fine without TLS:

Connecting to the emulator using HMAC authentication is the recommended approach, hence the GetConnectionString convenience method which aligns with other Testcontainer modules in this repository such as Azurite. Extending the out-of-the-box container that is returned to align with custom requirements is very easy due to the ContainerBuilder interface:

.crt & .key

var container = new AzureAppConfigurationBuilder()
    .WithEnvironment("ASPNETCORE_HTTP_PORTS", "8080")
    .WithEnvironment("ASPNETCORE_HTTPS_PORTS", "8081")
    .WithEnvironment("Kestrel__Certificates__Default__Path", "/usr/local/share/azureappconfigurationemulator/emulator.crt")
    .WithEnvironment("Kestrel__Certificates__Default__KeyPath", "/usr/local/share/azureappconfigurationemulator/emulator.key")
    .WithResourceMapping("emulator.crt", "/usr/local/share/azureappconfigurationemulator/emulator.crt")
    .WithResourceMapping("emulator.key", "/usr/local/share/azureappconfigurationemulator/emulator.key")
    .Build();

.pfx

var container = new AzureAppConfigurationBuilder()
    .WithEnvironment("ASPNETCORE_HTTP_PORTS", "8080")
    .WithEnvironment("ASPNETCORE_HTTPS_PORTS", "8081")
    .WithEnvironment("Kestrel__Certificates__Default__Password", "password")
    .WithEnvironment("Kestrel__Certificates__Default__Path", "/root/.aspnet/https/aspnetapp.pfx")
    .WithResourceMapping("aspnetapp.pfx", "/root/.aspnet/https/aspnetapp.pfx")
    .Build();

@HofmeisterAn HofmeisterAn added enhancement New feature or request module An official Testcontainers module labels Jun 22, 2024
@HofmeisterAn HofmeisterAn force-pushed the develop branch 3 times, most recently from 4900ecd to 8fa5f1b Compare October 3, 2025 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request module An official Testcontainers module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement]: Add Support for Emulator for Azure App Configuration
3 participants