-
Notifications
You must be signed in to change notification settings - Fork 122
Enhance Dapr integration with managed identity support and role assig… #882
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
base: main
Are you sure you want to change the base?
Enhance Dapr integration with managed identity support and role assig… #882
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.
Pull Request Overview
This pull request refactors Dapr component provisioning in Azure environments to use a dedicated managed identity for authentication and role assignments. The enhancement introduces centralized identity management for Dapr components, replacing scattered principal ID parameter usage with a unified approach that enables fine-grained role assignments for Azure resources like Redis and Key Vault.
Key changes:
- Introduced a dedicated managed identity for all Dapr components with automatic role assignment infrastructure
- Updated Dapr component infrastructure callbacks to accept and use the managed identity instead of principal ID parameters
- Added new extension methods for role assignment management with built-in Azure roles
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
AzureContainerAppEnvironmentResourceBuilderExtensions.cs | Adds dedicated managed identity creation and role assignment infrastructure for Dapr components |
AzureDaprComponentPublishingAnnotation.cs | Updates publishing annotation to accept managed identity parameter |
AzureDaprHostingExtensions.cs | Adds new role assignment extension methods and helper functions |
AzureKeyVaultDaprHostingExtensions.cs | Updates Key Vault configuration to use managed identity instead of principal ID parameter |
AzureRedisCacheDaprHostingExtensions.cs | Updates Redis configuration to use managed identity and adds role assignments |
Program.cs | Adds Redis reference to service configuration |
settings.json | Adds new project configuration file |
src/CommunityToolkit.Aspire.Hosting.Azure.Dapr/AzureDaprHostingExtensions.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Aspire.Hosting.Azure.Dapr/AzureKeyVaultDaprHostingExtensions.cs
Show resolved
Hide resolved
src/CommunityToolkit.Aspire.Hosting.Azure.Dapr.Redis/AzureRedisCacheDaprHostingExtensions.cs
Show resolved
Hide resolved
...tyToolkit.Aspire.Hosting.Azure.Dapr/AzureContainerAppEnvironmentResourceBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
...tyToolkit.Aspire.Hosting.Azure.Dapr/AzureContainerAppEnvironmentResourceBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
…gExtensions.cs Co-authored-by: Copilot <[email protected]>
…ppEnvironmentResourceBuilderExtensions.cs Co-authored-by: Copilot <[email protected]>
Not ready for merging |
Updated namespaces and resource models to use `CdkRedisResource` and `RedisResource` instead of `AzureRedisResource` and `RedisBuiltInRole`. Introduced managed identity authentication logic with dynamic `RedisCacheAccessPolicyAssignment` creation for "Data Contributor" access. Commented out legacy role assignment code to align with the new approach. Refactored Redis resource handling to support the updated resource model. Enhanced metadata handling for `state.redis` components, ensuring proper configuration of `actorStateStore`. Maintained infrastructure output logic for Redis connection strings, now operating on the new resource type.
Updated the `ConfigureForManagedIdentityAuthentication` method to use `BicepIdentifier` for identifying existing `RedisCacheAccessPolicyAssignment` resources instead of the `Name` property. Introduced `policyBicepIdentifier` for consistent resource identification and dynamically generated the `Name` property using `BicepFunction.CreateGuid`. These changes enhance clarity and ensure consistency in resource management.
…nments
Closes #881
This pull request introduces a refactor to how Dapr components are provisioned and authenticated in Azure environments, focusing on managed identity usage and role assignments. The main improvement is the introduction of a dedicated managed identity for Dapr components, which streamlines authentication and enables fine-grained role assignments for resources like Redis and Key Vault. The changes also update infrastructure configuration callbacks to consistently use this managed identity, and introduce new extension methods to simplify role assignment logic.
Managed Identity & Role Assignment Improvements:
daprManagedIdentity
) for Dapr components in theWithDaprComponents
extension, ensuring all Dapr components use a single identity for authentication and role assignment. (Fa5acb9cL16R16, src/CommunityToolkit.Aspire.Hosting.Azure.Dapr/AzureContainerAppEnvironmentResourceBuilderExtensions.csR63-L62)WithRoleAssignments
extension method and supporting logic to facilitate assigning Azure roles to resources for Dapr components, leveraging the managed identity. [1] [2]Annotation & Publishing Refactor:
AzureDaprComponentPublishingAnnotation
to accept the managed identity in its publishing action, enabling consistent identity usage across Dapr component provisioning.Dependency & File Updates:
using
directives for new dependencies related to role management and authorization. [1] [2] [3] [4]settings.json
file for the AppHost project, improving project configuration.These changes collectively improve security, maintainability, and clarity in how Dapr components interact with Azure resources, making it easier to manage permissions and authentication in distributed applications.
PR Checklist
Other information