Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for AAD Audience in connection string (for sovereign cloud) & bump in autoconfigure version #4121

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

harsimar
Copy link
Contributor

@harsimar harsimar commented Mar 4, 2025

Fix # .
Note: Don't merge until this related change from the autoconfigure module is released.

This PR incorporates connection string parsing changes from the autoconfigure module to use the AAD audience that is either provided via the connection string (or a default audience if that isn't provided). This is applicable for sovereign cloud scenarios where customers may be using AAD auth - the LazyHttpClient would use the provided audience when creating a new http pipeline, and all calls to quickpulse/breeze/profiler would be made with that audience.

Tested in sovereign cloud environment via a local build.

For significant contributions please make sure you have completed the following items:

  • Design discussion issue #
  • Changes in public surface reviewed
  • CHANGELOG.md updated

@harsimar harsimar changed the title Support for AAD Audience in connection string (for sovereign cloud) Support for AAD Audience in connection string (for sovereign cloud) & bump in autoconfigure version Mar 20, 2025
@@ -353,6 +359,13 @@ public ConnectionString getConnectionString() {
return connectionString;
}

public String getAadAudienceWithScope() {
if (connectionString == null) {
return APPLICATIONINSIGHTS_AUTHENTICATION_SCOPE;
Copy link
Contributor Author

@harsimar harsimar Mar 21, 2025

Choose a reason for hiding this comment

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

This line was added because ConsumptionPlanEnabledTest & RunTimeAttachWithDelayedConnectionStringTest were failing without this check. This raises a few questions ~

  1. Are azure functions w/ consumption plan enabled supported in sovereign clouds? If so, would the connection string always be set with some delay? Or is it still possible in azure function consumption plans to not set the connection string with a delay?
  2. I noticed in these tests that the connection string is still null by the time the http pipelines are being created. Is there a need to refactor code such that http pipelines shouldn't be created unless the connection string is set to some value, or to be able to handle dynamic config for http pipeline somehow?

Copy link
Member

Choose a reason for hiding this comment

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

The runtime attachment is related to https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-spring-boot#enabling-programmatically.

The connection string can be configured at runtime (programmatically) with -javaagent or the runtime attachment.

With Azure function, the connection string retrieval is delayed:

runtimeConfig.connectionString = getAndLogAtDebug("APPLICATIONINSIGHTS_CONNECTION_STRING");

About question 1, I don't know.

About 2, it may have several options. The place where the connection string is set at runtime (programmatic configuration or Azure function):

@harsimar harsimar marked this pull request as ready for review March 21, 2025 21:52
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.

3 participants