Skip to content

Commit

Permalink
Merge pull request #28 from fabnord/main
Browse files Browse the repository at this point in the history
BugFix: customRole to use TenantId as unique identifier
  • Loading branch information
fabnord authored Jan 24, 2025
2 parents 1163628 + b50bb13 commit a402816
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/iom/azureRoleDefinitionAssignableScope.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ targetScope = 'subscription'
param customRoleName string

resource existingCustomRoleDefinition 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
name: guid(customRoleName, subscription().id)
name: guid(customRoleName, tenant().tenantId)
}

output assignableScopes array = existingCustomRoleDefinition.properties.assignableScopes
2 changes: 1 addition & 1 deletion modules/iom/azureSubscriptionExistingRoleDefinition.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module assignableScope 'azureRoleDefinitionAssignableScope.bicep' = {
}

resource modifyExistingCustomRoleDefinition 'Microsoft.Authorization/roleDefinitions@2022-04-01' = {
name: guid(customRole.roleName, subscription().id)
name: guid(customRole.roleName, tenant().tenantId)
properties: {
assignableScopes: union(assignableScope.outputs.assignableScopes,[subscriptionId])
description: customRole.roleDescription
Expand Down
4 changes: 2 additions & 2 deletions modules/iom/azureSubscriptionRoleDefinition.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var customRole = {
}

resource customRoleDefinition 'Microsoft.Authorization/roleDefinitions@2022-04-01' = {
name: guid(customRole.roleName, subscription().id,'test')
name: guid(customRole.roleName, tenant().tenantId)
properties: {
assignableScopes: [subscription().id]
description: customRole.roleDescription
Expand All @@ -32,4 +32,4 @@ resource customRoleDefinition 'Microsoft.Authorization/roleDefinitions@2022-04-0
}
}

output customRoleDefinitionId string = customRoleDefinition.id
output customRoleDefinitionId string = customRoleDefinition.id

0 comments on commit a402816

Please sign in to comment.