Issue with Role assignment across resource group #5276
-
Hi Team, I am trying to a assign role for storage account to a keyvault in different resource group but it is not working but if I do the same for keyvault/storage in same resource group then it works.I have tried to explicitly set the scope on module but it doesn't do what I am looking for Calling keyvault-role-assignment.bicep from storage.bicep ---> module akvrole '../iam-module/resource/keyvault-role-assignment.bicep' = { keyvault-role-assignment.bicep---> param keyVaultName string resource keyvault 'Microsoft.KeyVault/vaults@2021-04-01-preview' existing = { resource roleAssignment 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = [for spId in resourceSPObjectIds: { module roleAssignmentWait '../../util/wait.bicep' = [for (spId, idx) in resourceSPObjectIds: { |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Here is a sample of a resource scoped role assignment. A few things:
param kvName string = 'kvGlobal'
resource kv 'Microsoft.KeyVault/vaults@2021-06-01-preview' existing = {
name: kvName
}
param roleAssignment object = {
UserId: '39fbc045-15e0-4855-b63a-e6cdf74ef2ea'
RoleId: '21090545-7ca7-4776-b22c-e363652d74d2'
uniqueGUID: 'bce4256e-32fa-4eec-801d-b9c3d7a886dd'
}
resource roleDefinition 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' existing = {
name: roleAssignment.RoleId
}
resource RA 'Microsoft.Authorization/roleAssignments@2020-08-01-preview' = {
name: roleAssignment.uniqueGUID
scope: kv
properties: {
roleDefinitionId: roleDefinition.id
principalId: roleAssignment.UserId
}
}
output roleAssignment string = RA.id |
Beta Was this translation helpful? Give feedback.
-
Sorry for the late reply ,yes all is good on my side. We may close this
thread now
…On Mon, Nov 29, 2021, 8:15 PM Ben Wilkinson ***@***.***> wrote:
@akhoslabinary <https://github.com/akhoslabinary> if you are still seeing
issues, please share your updated code samples.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5276 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALJMA7JBHWUMP4ZEUNMDMSLUOQQS3ANCNFSM5I7SQOEQ>
.
|
Beta Was this translation helpful? Give feedback.
Here is a sample of a resource scoped role assignment.
A few things: