-
Notifications
You must be signed in to change notification settings - Fork 236
[compose + CI/CD] - Introduce AZURE_PRINCIPAL_TYPE
to conditionally set user-only role assignments
#5285
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
[compose + CI/CD] - Introduce AZURE_PRINCIPAL_TYPE
to conditionally set user-only role assignments
#5285
Conversation
AZURE_PRINCIPAL_TYPE
to conditionally set user-only role assignmentsAZURE_PRINCIPAL_TYPE
to conditionally set user-only role assignments
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.
<3 Love it
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 PR introduces the new AZURE_PRINCIPAL_TYPE parameter to conditionally set user-only role assignments, ensuring that role assignments are only applied for principals of type "User". Key changes include:
- Adding a new principalType parameter to multiple Bicep templates and parameter files.
- Updating role assignment logic in Bicep modules to conditionally include user role assignments.
- Extending Go interfaces and tests to support retrieving the current principal type.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
cli/azd/resources/scaffold/templates/resources.bicept | Added a new principalType parameter and updated roleAssignments using a conditional concat. |
cli/azd/resources/scaffold/templates/main.parameters.jsont | Introduced the principalType parameter with an environment variable mapping. |
cli/azd/resources/scaffold/templates/main.bicept | Passed the new principalType through to the resources module. |
cli/azd/resources/scaffold/templates/ai-project.bicept | Conditionally wrapped role assignment resources for user principals. |
cli/azd/pkg/infra/provisioning/current_principal_id_provider.go | Implemented the CurrentPrincipalType method using authManager.LogInDetails. |
cli/azd/pkg/infra/provisioning/bicep/bicep_provider.go | Updated loadParameters to include principalType. |
cli/azd/pkg/environment/environment.go | Added PrincipalTypeEnvVarName constant. |
Test files (.go) | Updated tests and mocks to include the principal type. |
cli/azd/pkg/infra/provisioning/current_principal_id_provider.go
Outdated
Show resolved
Hide resolved
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash:
pwsh:
WindowsPowerShell install
MSI install
Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Fixes #5247
This PR fixes
azd pipeline config
for compose scenarios by introducing a Bicep parameterprincipalType
that maps to a new environment variableAZURE_PRINCIPAL_TYPE
(value ofUser
orServicePrincipal
). The generated Bicep now conditionally sets user-only role assignments only ifprincipalType=='User'
.This is so that the same generated Bicep can be used to
azd up
locally or in a pipeline environment. In a local environment, the user is given Storage Blob Data Contributor, but in a pipeline environment the pipeline user-assigned identity is not given the role assignment (but the ACA's user-assigned identity is):Testing
Validated by running
azd pipeline config
on compose project with various resources and verified provisioning succeeded and appropriate role assignments were set (pipeline MSI should not be assigned same assignments):