Skip to content

Commit 238122d

Browse files
authored
Merge pull request #277368 from bwren/ci-pl-cli
CLI for Container insights private link
2 parents c5fec35 + eba55e6 commit 238122d

File tree

1 file changed

+87
-24
lines changed

1 file changed

+87
-24
lines changed

articles/azure-monitor/containers/container-insights-private-link.md

Lines changed: 87 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Enable private link with Container insights
33
description: Learn how to enable private link on an Azure Kubernetes Service (AKS) cluster.
44
ms.topic: conceptual
5-
ms.date: 10/18/2023
5+
ms.date: 06/05/2024
66
ms.custom: devx-track-azurecli
77
ms.reviewer: aul
88
---
@@ -13,39 +13,100 @@ This article describes how to configure Container insights to use Azure Private
1313

1414
## Cluster using managed identity authentication
1515

16+
### [CLI](#tab/cli)
17+
18+
1619
### Prerequisites
20+
- Azure CLI version 2.61.0 or higher.
21+
- Azure Monitor Private Link Scope (AMPLS)
22+
23+
24+
### Existing AKS Cluster
25+
26+
**Use default Log Analytics workspace**
27+
28+
```azurecli
29+
az aks enable-addons --addon monitoring --name <cluster-name> --resource-group <cluster-resource-group-name> --ampls-resource-id "<azure-monitor-private-link-scope-resource-id>"
30+
```
31+
32+
Example:
33+
34+
```azurecli
35+
az aks enable-addons --addon monitoring --name "my-cluster" --resource-group "my-resource-group" --workspace-resource-id "/subscriptions/my-subscription/resourceGroups/my-resource-group/providers/Microsoft.OperationalInsights/workspaces/my-workspace" --ampls-resource-id "/subscriptions/my-subscription /resourceGroups/ my-resource-group/providers/microsoft.insights/privatelinkscopes/my-ampls-resource"
36+
```
37+
38+
**Use existing Log Analytics workspace**
39+
40+
```azurecli
41+
az aks enable-addons --addon monitoring --name <cluster-name> --resource-group <cluster-resource-group-name> --workspace-resource-id <workspace-resource-id> --ampls-resource-id "<azure-monitor-private-link-scope-resource-id>"
42+
```
43+
44+
Example:
45+
46+
```azurecli
47+
az aks enable-addons --addon monitoring --name "my-cluster" --resource-group "my-resource-group" --workspace-resource-id "/subscriptions/my-subscription/resourceGroups/my-resource-group/providers/Microsoft.OperationalInsights/workspaces/my-workspace" --ampls-resource-id "/subscriptions/my-subscription /resourceGroups/ my-resource-group/providers/microsoft.insights/privatelinkscopes/my-ampls-resource"
48+
```
49+
50+
### New AKS cluster
51+
52+
```azurecli
53+
az aks create --resource-group rgName --name clusterName --enable-addons monitoring --workspace-resource-id "workspaceResourceId" --ampls-resource-id "azure-monitor-private-link-scope-resource-id"
54+
```
55+
56+
Example:
57+
58+
```azurecli
59+
az aks create --resource-group "my-resource-group" --name "my-cluster" --enable-addons monitoring --workspace-resource-id "/subscriptions/my-subscription/resourceGroups/my-resource-group/providers/Microsoft.OperationalInsights/workspaces/my-workspace" --ampls-resource-id "/subscriptions/my-subscription /resourceGroups/ my-resource-group/providers/microsoft.insights/privatelinkscopes/my-ampls-resource"
60+
```
61+
62+
63+
### [ARM](#tab/arm)
64+
65+
The following sections provide links to the template and parameter files for enabling private link with Container insights on an AKS and Arc-enabled clusters.
66+
67+
Edit the values in the parameter file and deploy the template using any valid method for deploying ARM templates. Retrieve the **resource ID** of the resources from the **JSON** View of their **Overview** page.
68+
69+
Based on your requirements, you can configure other parameters such `streams`, `enableContainerLogV2`, `enableSyslog`, `syslogLevels`, `syslogFacilities`, `dataCollectionInterval`, `namespaceFilteringModeForDataCollection` and `namespacesForDataCollection`.
70+
71+
### Prerequisites
72+
- Azure Monitor Private Link Scope (AMPLS)
1773
- The template must be deployed in the same resource group as the cluster.
1874

19-
### Download and install template
75+
### AKS cluster
76+
77+
**Template file:** https://aka.ms/aks-enable-monitoring-msi-onboarding-template-file<br>
78+
**Parameter file:** https://aka.ms/aks-enable-monitoring-msi-onboarding-template-parameter-file
2079

21-
1. Download ARM template and parameter file:
22-
23-
**AKS cluster**
24-
- Template file: https://aka.ms/aks-enable-monitoring-msi-onboarding-template-file
25-
- Parameter file: https://aka.ms/aks-enable-monitoring-msi-onboarding-template-parameter-file
2680

27-
**Arc-enabled Kubernetes cluster**
28-
- Template file: https://aka.ms/arc-k8s-azmon-extension-msi-arm-template
29-
- Parameter file: https://aka.ms/arc-k8s-azmon-extension-msi-arm-template-params
81+
| Parameter | Description |
82+
|:---|:---|
83+
| `aksResourceId`| Resource ID of the cluster. |
84+
| `aksResourceLocation` | Azure Region of the cluster. |
85+
| `workspaceResourceId`| Resource ID of the Log Analytics workspace. |
86+
| `workspaceRegion` | Region of the Log Analytics workspace. |
87+
| `resourceTagValues` | Tag values specified for the existing Container insights extension data collection rule (DCR) of the cluster and the name of the DCR. The name will be MSCI-\<clusterName\>-\<clusterRegion\>, and this resource created in an AKS clusters resource group. For first time onboarding, you can set arbitrary tag values. |
88+
| `useAzureMonitorPrivateLinkScope` | Boolean flag to indicate whether Azure Monitor link scope is used or not. |
89+
| `azureMonitorPrivateLinkScopeResourceId` | Resource ID of the Azure Monitor Private link scope. This only used if `useAzureMonitorPrivateLinkScope` is set to **true**. |
3090

31-
2. Edit the following values in the parameter file. Retrieve the **resource ID** of the resources from the **JSON** View of their **Overview** page.
91+
### Arc-enabled Kubernetes cluster
3292

33-
| Parameter | Description |
34-
|:---|:---|
35-
| AKS: `aksResourceId`<br>Arc: `clusterResourceId` | Resource ID of the cluster. |
36-
| AKS: `aksResourceLocation`<br>Arc: `clusterRegion` | Azure Region of the cluster. |
37-
| AKS: `workspaceResourceId`<br>Arc: `workspaceResourceId` | Resource ID of the Log Analytics workspace. |
38-
| AKS: `workspaceRegion`<br>Arc: `workspaceRegion` | Region of the Log Analytics workspace. |
39-
| Arc: `workspaceDomain` | Domain of the Log Analytics workspace:<br>`opinsights.azure.com` for Azure public cloud<br>`opinsights.azure.us` for Azure US Government<br>`opinsights.azure.cn` for Azure China Cloud |
40-
| AKS: `resourceTagValues` | Tag values specified for the existing Container insights extension data collection rule (DCR) of the cluster and the name of the DCR. The name will be MSCI-\<clusterName\>-\<clusterRegion\>, and this resource created in an AKS clusters resource group. For first time onboarding, you can set arbitrary tag values. |
41-
| AKS: `useAzureMonitorPrivateLinkScope`<br>Arc: `useAzureMonitorPrivateLinkScope` | Boolean flag to indicate whether Azure Monitor link scope is used or not. |
42-
| AKS: `azureMonitorPrivateLinkScopeResourceId`<br>Arc: `azureMonitorPrivateLinkScopeResourceId` | Resource ID of the Azure Monitor Private link scope. This only used if `useAzureMonitorPrivateLinkScope` is set to **true**. |
93+
**Template file:** https://aka.ms/arc-k8s-azmon-extension-msi-arm-template<br>
94+
**Parameter file:** https://aka.ms/arc-k8s-azmon-extension-msi-arm-template-params
4395

44-
Based on your requirements, you can configure other parameters such `streams`, `enableContainerLogV2`, `enableSyslog`, `syslogLevels`, `syslogFacilities`, `dataCollectionInterval`, `namespaceFilteringModeForDataCollection` and `namespacesForDataCollection`.
96+
| Parameter | Description |
97+
|:---|:---|
98+
| `clusterResourceId` | Resource ID of the cluster. |
99+
| `clusterRegion` | Azure Region of the cluster. |
100+
| `workspaceResourceId` | Resource ID of the Log Analytics workspace. |
101+
| `workspaceRegion` | Region of the Log Analytics workspace. |
102+
| `workspaceDomain` | Domain of the Log Analytics workspace:<br>`opinsights.azure.com` for Azure public cloud<br>`opinsights.azure.us` for Azure US Government<br>`opinsights.azure.cn` for Azure China Cloud |
103+
| `resourceTagValues` | Tag values specified for the existing Container insights extension data collection rule (DCR) of the cluster and the name of the DCR. The name will be MSCI-\<clusterName\>-\<clusterRegion\>, and this resource created in an AKS clusters resource group. For first time onboarding, you can set arbitrary tag values. |
104+
| `useAzureMonitorPrivateLinkScope` | Boolean flag to indicate whether Azure Monitor link scope is used or not. |
105+
| `azureMonitorPrivateLinkScopeResourceId` | Resource ID of the Azure Monitor Private link scope. This is only used if `useAzureMonitorPrivateLinkScope` is set to **true**. |
45106

46-
3. Deploy the template with the parameter file by using any valid method for deploying Resource Manager templates. For examples of different methods, see [Deploy the sample templates](../resource-manager-samples.md#deploy-the-sample-templates).
107+
---
47108

48-
### Cluster using legacy authentication
109+
## Cluster using legacy authentication
49110
Use the following procedures to enable network isolation by connecting your cluster to the Log Analytics workspace using [Azure Private Link](../logs/private-link-security.md) if your cluster is not using managed identity authentication. This requires a [private AKS cluster](../../aks/private-clusters.md).
50111

51112
1. Create a private AKS cluster following the guidance in [Create a private Azure Kubernetes Service cluster](../../aks/private-clusters.md).
@@ -72,6 +133,8 @@ Use the following procedures to enable network isolation by connecting your clus
72133
az aks enable-addons -a monitoring --resource-group <AKSClusterResourceGorup> --name <AKSClusterName> --workspace-resource-id <workspace-resource-id>
73134
```
74135
136+
137+
75138
## Next steps
76139
77140
* If you experience issues while you attempt to onboard the solution, review the [Troubleshooting guide](container-insights-troubleshoot.md).

0 commit comments

Comments
 (0)