Merge pull request #48 from Azure/fix-roleDefinitionIds-issue

Fix multiple roleDefinitionIds issue #47
This commit is contained in:
Nick Price 2022-02-15 13:38:42 +11:00 коммит произвёл GitHub
Родитель 5df2ca312d 47e7e99231
Коммит 16d5c1d648
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 43 добавлений и 18 удалений

Просмотреть файл

@ -554,27 +554,52 @@
},
"properties": {
"mode": "Incremental",
"template" : {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"functions": [],
"variables": {},
"resources": [
"expressionEvaluationOptions": {
"scope": "inner"
},
"parameters":
{
"type": "Microsoft.Authorization/roleAssignments",
"name": "[guid(variables('policyAssignments')[copyIndex()].assignmentName)]",
"apiVersion": "2019-04-01-preview",
"location": "australiaeast",
"properties": {
"principalType": "ServicePrincipal",
"roleDefinitionId": "[concat('/providers/Microsoft.Authorization/roleDefinitions/', variables('policyAssignments')[copyIndex()].definition.roleDefinitionIds[0])]",
"principalId": "[toLower(reference(concat('/providers/Microsoft.Authorization/policyAssignments/', variables('policyAssignments')[copyIndex()].assignmentName), '2019-09-01', 'Full' ).identity.principalId)]"
"policyAssignment": {
"value": "[variables('policyAssignments')[copyIndex()]]"
},
"policyScopeId": {
"value": "[parameters('policyScopeId')]"
}
}
]
},
"template" : {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"policyAssignment": {
"type": "object"
},
"policyScopeId": {
"type": "string"
}
},
"functions": [],
"variables": {},
"resources": [
{
"type": "Microsoft.Authorization/roleAssignments",
"copy": {
"name": "Policy individual role assignments",
"count": "[length(parameters('policyAssignment').definition.roleDefinitionIds)]",
"mode": "Serial",
"batchSize": 1
},
"name": "[guid(parameters('policyAssignment').assignmentName,parameters('policyAssignment').definition.roleDefinitionIds[copyIndex('Policy individual role assignments')])]",
"apiVersion": "2019-04-01-preview",
"location": "australiaeast",
"properties": {
"principalType": "ServicePrincipal",
"roleDefinitionId": "[concat('/providers/Microsoft.Authorization/roleDefinitions/', parameters('policyAssignment').definition.roleDefinitionIds[copyIndex('Policy individual role assignments')])]",
"principalId": "[toLower(reference(concat(parameters('policyScopeId'),'/providers/Microsoft.Authorization/policyAssignments/', parameters('policyAssignment').assignmentName), '2019-09-01', 'Full' ).identity.principalId)]"
}
}
]
}
}
}
]
]
}