Bring-your-own OMS Agent identity
What happened: When using the OMSagent add-on, AKS creates a user-assigned MI in the generated resource group. This makes it harder to assign the required permissions as this identity requires Monitoring Metrics Publisher role to send AKS metrics to Azure Monitor.
What you expected to happen: BYO managed identity for OMSagent2, so that we can have an identity created with necessary roles attached and can be used while creating AKS cluster
Hi Harshith-Bhaskar, AKS bot here :wave: Thank you for posting on the AKS Repo, I'll do my best to get a kind human from the AKS team to assist you.
I might be just a bot, but I'm told my suggestions are normally quite good, as such:
- If this case is urgent, please open a Support Request so that our 24/7 support team may help you faster.
- Please abide by the AKS repo Guidelines and Code of Conduct.
- If you're having an issue, could it be described on the AKS Troubleshooting guides or AKS Diagnostics?
- Make sure your subscribed to the AKS Release Notes to keep up to date with all that's new on AKS.
- Make sure there isn't a duplicate of this issue already reported. If there is, feel free to close this one and '+1' the existing issue.
- If you have a question, do take a look at our AKS FAQ. We place the most common ones there!
The Container Insights team is working on an MSI private preview feature, where you can BYO identity to your cluster. Please reach out to us at [email protected], if you would like to onboard to it.
Triage required from @Azure/aks-pm
Action required from @Azure/aks-pm
Triage required from @Azure/aks-pm @austonli
@vishiy, @saaror would you be able to assist?
Issue Details
What happened: When using the OMSagent add-on, AKS creates a user-assigned MI in the generated resource group. This makes it harder to assign the required permissions as this identity requires Monitoring Metrics Publisher role to send AKS metrics to Azure Monitor.
What you expected to happen: BYO managed identity for OMSagent2, so that we can have an identity created with necessary roles attached and can be used while creating AKS cluster
| Author: | Harshith-Bhaskar |
|---|---|
| Assignees: | austonli |
| Labels: |
|
| Milestone: | - |
@Harshith-Bhaskar you can automate OMS agent role assignment with the following code. Put it after AKS resource definition in the same Bicep module, if you are using Bicep.
resource omsAgentRoleAssignment 'Microsoft.Authorization/roleAssignments@2020-10-01-preview' = {
name: guid(resourceGroup().name, 'omAgentMsi', roleDefinitionId)
scope: aks
properties: {
principalType: 'ServicePrincipal'
principalId: aks.properties.addonProfiles.omsagent.identity.objectId
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', roleDefinitionId)
}
}
Where aks is a symbolic name of AKS cluster resource definition,
roleDefinitionId is a role definition GUID, e.g. Monitoring Metrics Publisher role's GUID, which is 3913510d-42f4-4e42-8a64-420c390055eb.
You might need to adjust the role assignment name/GUID generation params so it'd be unique in your particular case.
Hi @Harshith-Bhaskar, this feature is now available in public preview https://azure.microsoft.com/en-us/updates/public-preview-use-managed-identitybased-authentication-to-enable-azure-monitor-container-insights/