You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-monitor/essentials/prometheus-metrics-enable.md
+95-26Lines changed: 95 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -119,21 +119,12 @@ The output will be similar to the following:
119
119
- If the Azure Managed Grafana instance is in a subscription other than the Azure Monitor Workspaces subscription, then please register the Azure Monitor Workspace subscription with the `Microsoft.Dashboard` resource provider following this [documentation](/azure-resource-manager/management/resource-providers-and-types#register-resource-provider.md#register-resource-provider).
120
120
- The Azure Monitor workspace and Azure Managed Grafana workspace must already be created.
121
121
- The template needs to be deployed in the same resource group as the Azure Managed Grafana workspace.
122
+
- Users with 'User Access Administrator' role in the subscription of the AKS cluster can be able to enable 'Monitoring Data Reader' role directly by deploying the template.
122
123
123
124
124
125
### Retrieve required values for Grafana resource
125
126
From the **Overview** page for the Azure Managed Grafana instance in the Azure portal, select **JSON view**.
126
127
127
-
Copy the value of the `principalId` field for the `SystemAssigned` identity.
If you're using an existing Azure Managed Grafana instance that already has been linked to an Azure Monitor workspace then you need the list of Grafana integrations. Copy the value of the `azureMonitorWorkspaceIntegrations` field. If it doesn't exist, then the instance hasn't been linked with any Azure Monitor workspace.
138
129
139
130
```json
@@ -151,15 +142,6 @@ If you're using an existing Azure Managed Grafana instance that already has been
151
142
}
152
143
```
153
144
154
-
### Assign role to system identity
155
-
The Azure Managed Grafana resource requires the `Monitoring Data Reader` role to read data from the Azure Monitor Workspace.
156
-
157
-
1. From the **Access control (IAM)** page for the Azure Managed Grafana instance in the Azure portal, select **Add** and then **Add role assignment**.
158
-
2. Select `Monitoring Data Reader`.
159
-
3. Select **Managed identity** and then **Select members**.
160
-
4. Select the **system-assigned managed identity** with the `principalId` from the Grafana resource.
161
-
5. Click **Select** and then **Review+assign**.
162
-
163
145
### Download and edit template and parameter file
164
146
165
147
1. Download the template at [https://aka.ms/azureprometheus-enable-arm-template](https://aka.ms/azureprometheus-enable-arm-template) and save it as **existingClusterOnboarding.json**.
@@ -207,9 +189,96 @@ The Azure Managed Grafana resource requires the `Monitoring Data Reader` role t
207
189
}
208
190
````
209
191
210
-
In this json, `full_resource_id_1` and `full_resource_id_2` were already in the Azure Managed Grafana resource JSON, and they're added here to the ARM template. If you have no existing Grafana integrations, then don't include these entries for `full_resource_id_1` and `full_resource_id_2`.
192
+
In this json, `full_resource_id_1` and `full_resource_id_2` were already in the Azure Managed Grafana resource JSON, and they're added here to the ARM template. If you have no existing Grafana integrations, then don't include these entries for `full_resource_id_1` and `full_resource_id_2`.
193
+
194
+
The final `azureMonitorWorkspaceResourceId` entry is already in the template and is used to link to the Azure Monitor Workspace resource ID provided in the parameters file.
195
+
196
+
## [Bicep](#tab/bicep)
197
+
198
+
### Prerequisites
199
+
200
+
- Register the `AKS-PrometheusAddonPreview` feature flag in the Azure Kubernetes clusters subscription with the following command in Azure CLI: `az feature register --namespace Microsoft.ContainerService --name AKS-PrometheusAddonPreview`.
201
+
- The Azure Monitor workspace and Azure Managed Grafana workspace must already be created.
202
+
- The template needs to be deployed in the same resource group as the Azure Managed Grafana workspace.
203
+
- Users with 'User Access Administrator' role in the subscription of the AKS cluster can be able to enable 'Monitoring Data Reader' role directly by deploying the template.
204
+
205
+
### Minor Limitation while deploying through bicep
206
+
Currently in bicep, there is no way to explicitly "scope" the Monitoring Data Reader role assignment on a string parameter "resource id" for Azure Monitor Workspace (like in ARM template). Bicep expects a value of type "resource | tenant" and currently there is no rest api [spec](https://github.com/Azure/azure-rest-api-specs) for Azure Monitor Workspace. So, as a workaround, the default scoping for Monitoring Data Reader role is on the resource group and thus the role is applied on the same Azure monitor workspace (by inheritance) which is the expected behavior. Thus, after deploying this bicep template, the Grafana resource will get read permissions in all the Azure Monitor Workspaces under the subscription.
207
+
208
+
209
+
### Retrieve required values for Grafana resource
210
+
211
+
From the **Overview** page for the Azure Managed Grafana instance in the Azure portal, select **JSON view**.
212
+
213
+
If you're using an existing Azure Managed Grafana instance that already has been linked to an Azure Monitor workspace then you need the list of Grafana integrations. Copy the value of the `azureMonitorWorkspaceIntegrations` field. If it doesn't exist, then the instance hasn't been linked with any Azure Monitor workspace.
### Download and edit templates and parameter file
231
+
232
+
1. Download the main bicep template from [here](https://aka.ms/azureprometheus-enable-bicep-template) and save it as **FullAzureMonitorMetricsProfile.bicep**.
233
+
2. Download the parameter file from [here](https://aka.ms/azureprometheus-enable-bicep-template-parameters) and save it as **FullAzureMonitorMetricsProfileParameters.json** in the same directory as the main bicep template.
234
+
3. Download the [nested_azuremonitormetrics_dcra_clusterResourceId.bicep](https://aka.ms/nested_azuremonitormetrics_dcra_clusterResourceId) and [nested_azuremonitormetrics_profile_clusterResourceId.bicep](https://aka.ms/nested_azuremonitormetrics_profile_clusterResourceId) files in the same directory as the main bicep template.
235
+
4. Edit the values in the parameter file.
236
+
5. The main bicep template creates all the required resources and uses 2 modules for creating the dcra and monitormetrics profile resources from the other two bicep files.
237
+
238
+
| Parameter | Value |
239
+
|:---|:---|
240
+
| `azureMonitorWorkspaceResourceId` | Resource ID for the Azure Monitor workspace. Retrieve from the **JSON view** on the **Overview** page for the Azure Monitor workspace. |
241
+
| `azureMonitorWorkspaceLocation` | Location of the Azure Monitor workspace. Retrieve from the **JSON view** on the **Overview** page for the Azure Monitor workspace. |
242
+
| `clusterResourceId` | Resource ID for the AKS cluster. Retrieve from the **JSON view** on the **Overview** page for the cluster. |
243
+
| `clusterLocation` | Location of the AKS cluster. Retrieve from the **JSON view** on the **Overview** page for the cluster. |
244
+
| `metricLabelsAllowlist` | Comma-separated list of Kubernetes labels keys that will be used in the resource's labels metric. |
245
+
| `metricAnnotationsAllowList` | Comma-separated list of additional Kubernetes label keys that will be used in the resource's labels metric. |
246
+
| `grafanaResourceId` | Resource ID for the managed Grafana instance. Retrieve from the **JSON view** on the **Overview** page for the Grafana instance. |
247
+
| `grafanaLocation` | Location for the managed Grafana instance. Retrieve from the **JSON view** on the **Overview** page for the Grafana instance. |
248
+
| `grafanaSku` | SKU for the managed Grafana instance. Retrieve from the **JSON view** on the **Overview** page for the Grafana instance. Use the **sku.name**. |
249
+
250
+
251
+
6. Open the template file and update the `grafanaIntegrations` property at the end of the file with the values that you retrieved from the Grafana instance. This will be similar to the following:
In this json, `full_resource_id_1` and `full_resource_id_2` were already in the Azure Managed Grafana resource JSON, and they're added here to the ARM template. If you have no existing Grafana integrations, then don't include these entries for `full_resource_id_1` and `full_resource_id_2`.
211
280
212
-
The final `azureMonitorWorkspaceResourceId` entry is already in the template and is used to link to the Azure Monitor Workspace resource ID provided in the parameters file.
281
+
The final `azureMonitorWorkspaceResourceId` entry is already in the template and is used to link to the Azure Monitor Workspace resource ID provided in the parameters file.
213
282
214
283
215
284
### Deploy template
@@ -224,8 +293,6 @@ Deploy the template with the parameter file using any valid method for deploying
224
293
225
294
---
226
295
227
-
228
-
229
296
## Verify Deployment
230
297
231
298
Run the following command to which verify that the daemon set was deployed properly:
- CPU and Memory requests and limits can't be changed for Container insights metrics addon. If changed, they'll be reconciled and replaced by original values in a few seconds.
264
-
- Metrics addon doesn't work on AKS clusters configured with HTTP proxy.
331
+
- Metrics addon doesn't work on AKS clusters configured with HTTP proxy.
265
332
266
333
267
334
## Uninstall metrics addon
268
-
Currently, Azure CLI is the only option to remove the metrics addon and stop sending Prometheus metrics to Azure Monitor managed service for Prometheus.
335
+
Currently, Azure CLI is the only option to remove the metrics addon and stop sending Prometheus metrics to Azure Monitor managed service for Prometheus.
269
336
270
-
If you don't already have it, install the aks-preview extension with the following command.
337
+
If you don't already have it, install the aks-preview extension with the following command.
271
338
272
339
The `aks-preview` extension needs to be installed using the following command. For more information on how to install a CLI extension, see [Use and manage extensions with the Azure CLI](/cli/azure/azure-cli-extensions-overview).
273
340
@@ -336,7 +403,9 @@ When you allow a default Azure Monitor workspace to be created when you install
336
403
337
404
## Next steps
338
405
406
+
339
407
- [See the default configuration for Prometheus metrics](./prometheus-metrics-scrape-default.md).
340
408
- [Customize Prometheus metric scraping for the cluster](./prometheus-metrics-scrape-configuration.md).
341
409
- [Use Azure Monitor managed service for Prometheus (preview) as data source for Grafana](./prometheus-grafana.md)
342
410
- [Configure self-hosted Grafana to use Azure Monitor managed service for Prometheus (preview)](./prometheus-self-managed-grafana-azure-active-directory.md)
0 commit comments