feat: implement deployer-based role assignments in main.bicep and role.bicep #399
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Added use of deployer() function
to capture the identity of the user running the deployment.
Introduced variables deployerInfo, deployingUserPrincipalId, and enableUserRoleAssignment in main.bicep.
Extended role.bicep to assign roles to the deployer on Azure OpenAI (Cognitive Services) accounts — covering both newly created and existing resources.
Updated Cosmos DB role assignments to include both the container app’s system-assigned MI and the deployer identity.
Added a configurable parameter principalType (User, ServicePrincipal, Group, etc.) instead of hard-coded ServicePrincipal.
Added outputs (deployerInfo, userRoleAssignmentStatus) for visibility of assigned roles and deployment status.
Why These Changes
Automation: Removes the need for manual az role assignment steps after deployment.
Flexibility: Works for different identity types (User, ServicePrincipal, Group).
Consistency: Ensures deployer gets the required access for both new and existing OpenAI/Cosmos DB resources.
Transparency: Clear outputs confirm who received access and whether assignment logic executed.
Does this introduce a breaking change?
How to Test
What to Check
Verify that the following are valid
Other Information