-
Notifications
You must be signed in to change notification settings - Fork 271
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
Enable External Durable Client Managed Identity Support #2856
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some questions
src/WebJobs.Extensions.DurableTask/StandardConnectionInfoProvider.cs
Outdated
Show resolved
Hide resolved
string prefixedConnectionStringName = "AzureWebJobs" + name; | ||
IConfigurationSection section = this.configuration?.GetSection(prefixedConnectionStringName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused about this. Some questions:
(1) Are there other connection strings with prefix "AzureWebJobs" that aren't "AzureWebJobsStorage"?
(2) Why is it that we only apply this logic to connections with the "AzureWebJobs" prefix?
(3) How do we know the "name" parameter doesn't already include the "AzureWebJobs" prefix :) ?
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidmrdavid That's a good question, it's a little confusing here. This is a special case that is quite hard to explain and let me know if anything is unclear to you.
This is a scenario that specially for using a durable client in Functions App. When the Functions app started, the Functions Host will look for AzureWebJobsStorage
(side note: this is the default value, the connection name could be others, eg: MyCustomeStorage, but functions host will alwasy look for one with AzureWebJobs prefix, in this case it will be AzureWebJobsMyCustomeStorage) especially . If there is no such a value, the host will fail. So we have to check the connection name with AzureWebJobs
first so that the host can start successfully. Once the Host successfully started, then the method creating the external durable client will be called. In here, it will only look for connection name as xxx
especially with no prefix.
_client = clientFactory.CreateClient(new DurableClientOptions
{
ConnectionName = "xxx",
});
So to answer the second question, this is the only scenario that we need a prefix check, only at Functions the configuration always starts with AzureWebJobs so we don't need to check other prefix.
For (3), if it already includes, then the prefix name will be like AzureWebJobsAzureWebJobsStorage
. And thus the section it look for will be null ( checking bythe method IfExists()
), and thus the Resolve will look for the name itself with no prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment including the information in this thread? I'm mostly looking for a comment that explains why we added the code in the Resolve
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just added the comments inside Resolve method. Let me know if it isn't clear to you :)
src/WebJobs.Extensions.DurableTask/StandardConnectionInfoProvider.cs
Outdated
Show resolved
Hide resolved
string prefixedConnectionStringName = "AzureWebJobs" + name; | ||
IConfigurationSection section = this.configuration?.GetSection(prefixedConnectionStringName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment including the information in this thread? I'm mostly looking for a comment that explains why we added the code in the Resolve
method.
src/WebJobs.Extensions.DurableTask/StandardConnectionInfoProvider.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Let's make sure that the tests pass before merging.
* Update StandardConnectionInfoProvider.cs * Update StandardConnectionInfoProvider.cs * Update StandardConnectionInfoProvider.cs * Update StandardConnectionInfoProvider.cs * add description about the resolve method implementation * remove whitespace * update by comment
As titled.
When external durable client is used, it will use the
StandardConnectionInfoProvider
instead ofWebJobsConnectionInfoProvider
. This PR updates theResolve()
atStandardConnectionInfoProvider
so that it can read the configuration required for identity based authentication.Also, when using an external durable client within a Functions app (but not within a Durable Functions app),
AzureWebJobsStorage
configuration is required by Functions Host. To achieve this, the resolution process includes logic to first check the connection name with theAzureWebJobs
prefix and then verify the standard connection name.End-to-end test have been made with asp net core app and functions app at samples dir.
Pull request checklist
pending_docs.md
release_notes.md
/src/Worker.Extensions.DurableTask/AssemblyInfo.cs