Skip to content

Implementors of IResourceWithAzureFunctionsConfig should set additional params for identity-based configuration. #8116

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

Open
1 task done
mattchenderson opened this issue Mar 17, 2025 · 5 comments · May be fixed by #8868
Open
1 task done
Labels
area-integrations Issues pertaining to Aspire Integrations packages azure-functions Issues related to the Azure Functions integration
Milestone

Comments

@mattchenderson
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

Aspire will set AZURE_CLIENT_ID to inform connections of the client ID to use. When exploring scale rules setup for Azure Functions, it appears that KEDA is one example of a component that doesn't process AZURE_CLIENT_ID yet.

Describe the solution you'd like

Functions also offers a combination of two other parameters, and this is the typical recommendation for setting up connections with a user-assigned identity: <CONNECTION_NAME_PREFIX>__credential (always set to "managedidentity") and <CONNECTION_NAME_PREFIX>__clientId (set to the client ID). These are documented here.

This combination of settings should be valid for all existing implementers of IResourceWithAzureFunctionsConfig, but this should be approached on a case-by-case basis.

There's a bit of repetition and verbosity here, but it ensures the components will work as expected. Longer-term, KEDA could be updated to process AZURE_CLIENT_ID, and we could explore removing some of the repetition if needed.

Additional context

Triggers and bindings will mostly be set up to consume AZURE_CLIENT_ID, but there may be some variance in the overall config approach. Ensuring we capture a complete setup within each IResourceWithAzureFunctionsConfig will improve resilience to this.

This would also be preferable if there were to be support for multiple identities in the distributed application.

Note that these settings should be set together. Setting only one will not have the desired effect. Today, the integration uses DefaultAzureCredential, which during probing picks up AZURE_CLIENT_ID to use for MI. Just setting the connection-level client ID would be ignored. By setting the credential property, though, we force the system to instead use ManagedIdentityCredential, and without the client ID setting, it would just attempt to resolve a system-assigned managed identity, which would not exist in normal Aspire configurations.

@github-actions github-actions bot added the area-integrations Issues pertaining to Aspire Integrations packages label Mar 17, 2025
@captainsafia captainsafia added the azure-functions Issues related to the Azure Functions integration label Mar 17, 2025
@captainsafia
Copy link
Member

This combination of settings should be valid for all existing implementers of IResourceWithAzureFunctionsConfig, but this should be approached on a case-by-case basis.

What do we need to consider when evaluating case-by-case for the existing resources we have?

@mattchenderson
Copy link
Author

Apologies - I didn't phrase that well. If implemented in the expected way, all of our triggers and bindings should do the right thing here. There have, however, been some hiccups in the past, so this was me flagging a "something to think about / check on" for the future as we expand the integration set. I can assert that the existing integration set complies with this correctly, and there should be nothing blocking those.

Typing that prompted me to consider if we would set this centrally or ask this of each IResourceWithAzureFunctionsConfig implementation. I think having it within each allows us to handle deviation if ever needed. That's also just aligned better with the way things are in the code base today. We'd lose out on enforcement and could have mistaken omissions, but it should be easy enough to catch this in review.

@davidfowl
Copy link
Member

I think I know how this should work. @eerhardt , it’s similar to known parameters though I’d want it to be a sentinel value though

@davidfowl
Copy link
Member

We may need to tweak IResourceWithAzureFunctionsConfig, we need the target resource to do this inside of the resource itself.

@davidfowl davidfowl added this to the 9.3 milestone Apr 18, 2025
@davidfowl davidfowl linked a pull request Apr 18, 2025 that will close this issue
16 tasks
@davidfowl
Copy link
Member

Actually, it might be possible to do this without API changes, see #8868

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-integrations Issues pertaining to Aspire Integrations packages azure-functions Issues related to the Azure Functions integration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants