REST API to Enable AKS Container Insights Performance Metrics (K8SContainer) Programmatically

Sree Aravind M 40 Reputation points
2026-06-29T12:58:55.1333333+00:00

We have successfully created an Azure Kubernetes Service (AKS) cluster and enabled Azure Monitor/Container Insights.

We need to retrieve performance metrics using the following Log Analytics query:

Perf

| where ObjectName == "K8SContainer"

However, the K8SContainer performance metrics are not available by default. We found that these metrics become available only after manually enabling Performance Metrics from the Azure portal by following these steps:

Go to Azure Monitor → Containers → All enabled clusters.

Select the AKS cluster.

Click Customize.

Choose Custom/Edit.

Enable the required performance metrics.

Click Save and then Review + Enable.

We would like to automate this configuration as part of our AKS deployment process and avoid manual portal intervention.

Request:

Is there a supported Azure REST API, to programmatically enable these Performance Metrics settings?

If an API is available, please provide the documentation and required request payload.

If no public API exists, please advise on the recommended automation approach for enabling these settings.

Our goal is to fully automate the AKS deployment and monitoring configuration without requiring manual configuration through the Azure portal.

Azure Monitor
Azure Monitor

An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.


1 answer

Sort by: Most helpful
  1. Alex Burlachenko 23,250 Reputation points MVP Volunteer Moderator
    2026-06-30T11:19:14.69+00:00

    Hi Sree Aravind M,

    Thx for sharing urs issue here at Q&A portal. For AKS Container Insights, the portal Customize flow usually updates the Container Insights data collection settings, not the AKS cluster itself.

    Programmatically, check the Data Collection Rule linked to the cluster and configure the Container Insights stream/settings there. In newer setups this is usually DCR/DCRA based, not an old OMS-agent setting.

    If u specifically need Perf | where ObjectName == 'K8SContainer', confirm that the DCR streams include the relevant Container Insights performance data and that the cluster is using Log Analytics, not only managed Prometheus metrics.

    Don’t automate portal clicks. Export/check the DCR after enabling it once manually, then reproduce that DCR/DCRA config through ARM/Bicep/REST in ur AKS deployment.

    Rgds,

    Alex

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.