Skip to content

Commit

Permalink
add aks managed identity permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
sebassem committed Jul 8, 2024
1 parent e777af6 commit 8257006
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
30 changes: 27 additions & 3 deletions azure_jumpstart_arcbox/ARM/azuredeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"_generator": {
"name": "bicep",
"version": "0.28.1.47646",
"templateHash": "4648116851621429118"
"templateHash": "5764046023032759632"
}
},
"parameters": {
Expand Down Expand Up @@ -8410,7 +8410,7 @@
"_generator": {
"name": "bicep",
"version": "0.28.1.47646",
"templateHash": "9258770347731613696"
"templateHash": "16902719430194420979"
}
},
"parameters": {
Expand Down Expand Up @@ -8621,6 +8621,30 @@
}
}
}
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"name": "[guid(resourceId('Microsoft.ContainerService/managedClusters', parameters('aksClusterName')), 'Microsoft.Authorization/roleAssignments', 'Owner')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ContainerService/managedClusters', parameters('aksClusterName')), '2023-10-02-preview', 'full').identity.principalId]",
"roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635')]"
},
"dependsOn": [
"[resourceId('Microsoft.ContainerService/managedClusters', parameters('aksClusterName'))]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"name": "[guid(resourceId('Microsoft.ContainerService/managedClusters', parameters('drClusterName')), 'Microsoft.Authorization/roleAssignments', 'Owner')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ContainerService/managedClusters', parameters('drClusterName')), '2023-10-02-preview', 'full').identity.principalId]",
"roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635')]"
},
"dependsOn": [
"[resourceId('Microsoft.ContainerService/managedClusters', parameters('drClusterName'))]"
]
}
]
}
Expand All @@ -8638,4 +8662,4 @@
"value": "[if(equals(parameters('flavor'), 'DataOps'), format('{0}@{1}', parameters('windowsAdminUsername'), parameters('addsDomainName')), '')]"
}
}
}
}s
20 changes: 20 additions & 0 deletions azure_jumpstart_arcbox/bicep/kubernetes/aks.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,23 @@ resource drClusterName_resource 'Microsoft.ContainerService/managedClusters@2023
}
}
}

// Add role assignment for the AKS cluster: Owner role
resource aksRoleAssignment_Owner 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(aksClusterName_resource.id, 'Microsoft.Authorization/roleAssignments', 'Owner')
scope: resourceGroup()
properties: {
principalId: aksClusterName_resource.identity.principalId
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635')
}
}

// Add role assignment for the AKS DR cluster: Owner role
resource aksDRRoleAssignment_Owner 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(drClusterName_resource.id, 'Microsoft.Authorization/roleAssignments', 'Owner')
scope: resourceGroup()
properties: {
principalId: drClusterName_resource.identity.principalId
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635')
}
}

0 comments on commit 8257006

Please sign in to comment.