Skip to content

Conversation

@FullStackChef
Copy link
Contributor

Added a using directive for Azure.Provisioning.Roles and refactored the ConfigureForManagedIdentityAuthentication method. The method now retrieves provisionable resources more efficiently and correctly uses the PrincipalId from UserAssignedIdentity for setting the azureClientId metadata.

Closes #874

This pull request updates the managed identity authentication logic for Azure Redis Cache in Dapr hosting extensions. The main change is to ensure that the correct UserAssignedIdentity is used for authentication metadata, rather than relying on the managed environment's identity. This improves reliability and correctness when configuring Dapr components for Redis.

Managed Identity Authentication Improvements:

  • Updated the logic to select the UserAssignedIdentity from provisionable resources instead of using the identity from ContainerAppManagedEnvironment, ensuring the correct principal is used for Azure Redis authentication.
  • Changed the assignment of the azureClientId metadata value to use the principal ID from the selected UserAssignedIdentity rather than the managed environment's identity.

Dependency Updates:

  • Added a new using directive for Azure.Provisioning.Roles to support working with user-assigned identities.

PR Checklist

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • PR doesn't include merge commits (always rebase on top of our main, if needed)
  • New integration
    • Docs are written
    • Added description of major feature to project description for NuGet package (4000 total character limit, so don't push entire description over that)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Contains NO breaking changes
  • Every new API (including internal ones) has full XML docs
  • Code follows all style conventions

Other information

Added a using directive for `Azure.Provisioning.Roles` and refactored the `ConfigureForManagedIdentityAuthentication` method. The method now retrieves provisionable resources more efficiently and correctly uses the `PrincipalId` from `UserAssignedIdentity` for setting the `azureClientId` metadata.
Copilot AI review requested due to automatic review settings September 27, 2025 00:45
Copy link
Contributor

Copilot AI left a 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 enhances the managed identity authentication logic for Azure Redis Cache in Dapr hosting extensions. The main purpose is to ensure that the correct UserAssignedIdentity is used for authentication metadata instead of relying on the managed environment's identity.

  • Refactored the ConfigureForManagedIdentityAuthentication method to retrieve provisionable resources more efficiently
  • Updated the authentication logic to use the correct UserAssignedIdentity principal for Azure Redis authentication
  • Added dependency on Azure.Provisioning.Roles namespace

@FullStackChef FullStackChef requested review from aaronpowell and removed request for Copilot September 27, 2025 00:45
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.

Dapr components using incorrect property for bicep deploy

2 participants