How to give the system-assigned identity access to key vault in the same deployment with the usage of symbolic names logic in Bicep? API Management with KV #6543
-
Hi project maintainers and contributors, Heavy user of the great Bicep tooling here. What is the correct way to actually give system-assigned identity access to the key vault in the same main.bicep/deployment AND let it grab out what it might need from the key vault? I taught that Bicep logic would be able to understand the dependencies between the resources when it comes to that system-assigned identity must be created beforehand, in order to be able to give the identity to the key vault AND let it grab what it might need. But maybe this is more due to Azure Resource Manager limitation than Bicep? On the internet there is of course tons of ways to solve this with hackering and making not good code hygiene, but I really think to use the nature and logic of Bicep would be number 1. Documentation is stating. https://docs.microsoft.com/en-us/learn/modules/build-first-bicep-template/3-define-resources Example: By declaring the app resource with a property that references the symbolic name of the plan, Azure understands the implicit dependency between the App Service app and the plan. When it deploys the resources, Azure will make sure it fully deploys the plan before it starts to deploy the app. Example: In this example, symbolic names are used for the reference between the modules. This helps Bicep to automatically understand the relationships between the modules. Is this not applicable for system-managed identity that gets configured for an resource in the deployment as well that wants access to a new key vault and take out what it might need in the same deployment? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
if you create the resource and system assigned identity in a Bicep Module. You should be able to assign a roleAssignment in another module, you can use an |
Beta Was this translation helpful? Give feedback.
if you create the resource and system assigned identity in a Bicep Module.
You should be able to assign a roleAssignment in another module, you can use an
existing
resource within this module to pull out the system identity clientid that you need for the objectid in the roleassignment.