|
1 | 1 | ---
|
2 | 2 | title: Enable secure settings
|
3 |
| -description: Enable secure settings on your Azure IoT Operations deployment by configuring an Azure Key Vault and enabling workload identities. |
| 3 | +description: Enable secure settings in your Azure IoT Operations instance for developing a production-ready scenario. |
4 | 4 | author: asergaz
|
5 | 5 | ms.author: sergaz
|
6 | 6 | ms.topic: how-to
|
7 |
| -ms.date: 11/04/2024 |
| 7 | +ms.date: 11/19/2024 |
8 | 8 |
|
9 |
| -#CustomerIntent: I deployed Azure IoT Operations with test settings for the quickstart scenario, and now I want to enable secure settings to use the full feature set. |
| 9 | +#CustomerIntent: I deployed Azure IoT Operations with test settings, and now I want to enable secure settings to use the full feature set. |
10 | 10 | ---
|
11 | 11 |
|
12 |
| -# Enable secure settings in Azure IoT Operations deployment |
| 12 | +# Enable secure settings in Azure IoT Operations |
13 | 13 |
|
14 | 14 | The secure settings for Azure IoT Operations include the setup of secrets management and a user-assigned managed identity for cloud connections; for example, an OPC UA server or dataflow endpoints.
|
15 | 15 |
|
16 | 16 | This article provides instructions for enabling secure settings if you didn't do so during your initial deployment.
|
17 | 17 |
|
18 | 18 | ## Prerequisites
|
19 | 19 |
|
20 |
| -* An Azure IoT Operations instance deployed with test settings. For example, follow the instructions in [Quickstart: Run Azure IoT Operations in GitHub Codespaces](../get-started-end-to-end-sample/quickstart-deploy.md). |
| 20 | +* An Azure IoT Operations instance deployed with test settings. For example, you chose **Test Settings** when following the instructions in [Deploy Azure IoT Operations to an Arc-enabled Kubernetes cluster](howto-deploy-iot-operations.md). |
21 | 21 |
|
22 |
| -* Azure CLI installed on your development machine. This scenario requires Azure CLI version 2.64.0 or later. Use `az --version` to check your version and `az upgrade` to update, if necessary. For more information, see [How to install the Azure CLI](/cli/azure/install-azure-cli). |
| 22 | +* Azure CLI installed on your development machine. This scenario requires Azure CLI version 2.64.0 or higher. Use `az --version` to check your version and `az upgrade` to update if necessary. For more information, see [How to install the Azure CLI](/cli/azure/install-azure-cli). |
23 | 23 |
|
24 |
| -* The latest versions of the following extensions for the Azure CLI: |
| 24 | +* The Azure IoT Operations extension for Azure CLI. Use the following command to add the extension or update it to the latest version: |
25 | 25 |
|
26 | 26 | ```azurecli
|
27 | 27 | az extension add --upgrade --name azure-iot-ops
|
28 |
| - az extension add --upgrade --name connectedk8s |
29 | 28 | ```
|
30 | 29 |
|
31 |
| -## Configure a cluster for a workload identity |
32 |
| - |
33 |
| -A *workload identity* is an identity that you assign to a software workload (such as an application, service, script, or container) to authenticate and access other services and resources. The workload identity feature needs to be enabled on your cluster, so that the [Azure Key Vault Secret Store extension for Kubernetes](/azure/azure-arc/kubernetes/secret-store-extension) and Azure IoT Operations can access Microsoft Entra ID protected resources. To learn more, see [What are workload identities?](/entra/workload-id/workload-identities-overview). |
34 |
| - |
35 |
| -> [!NOTE] |
36 |
| -> This step applies only to Ubuntu + K3s clusters. The quickstart script for Azure Kubernetes Service (AKS) Edge Essentials used in [Prepare your Azure Arc-enabled Kubernetes cluster](../deploy-iot-ops/howto-prepare-cluster.md) enables a workload identity by default. If you have an AKS Edge Essentials cluster, continue to the next section. |
37 |
| -
|
38 |
| -If you aren't sure whether or not your K3s cluster already has workload identity enabled, run the [az connectedk8s show](/cli/azure/connectedk8s#az-connectedk8s-show) command to check: |
39 |
| - |
40 |
| -```azurecli |
41 |
| -az connectedk8s show --name <CLUSTER_NAME> --resource-group <RESOURCE_GROUP> --query "{oidcIssuerEnabled:oidcIssuerProfile.enabled, workloadIdentityEnabled: securityProfile.workloadIdentity.enabled}" |
42 |
| -``` |
43 |
| - |
44 |
| -To enable a workload identity on an existing connected K3s cluster: |
45 |
| - |
46 |
| -1. Use the [az connectedk8s update](/cli/azure/connectedk8s#az-connectedk8s-update) command to enable the workload identity feature on the cluster: |
47 |
| - |
48 |
| - ```azurecli |
49 |
| - #!/bin/bash |
50 |
| -
|
51 |
| - # Variable block |
52 |
| - RESOURCE_GROUP="<RESOURCE_GROUP>" |
53 |
| - CLUSTER_NAME="<CLUSTER_NAME>" |
54 |
| -
|
55 |
| - # Enable a workload identity |
56 |
| - az connectedk8s update --resource-group $RESOURCE_GROUP \ |
57 |
| - --name $CLUSTER_NAME \ |
58 |
| - --enable-oidc-issuer --enable-workload-identity |
59 |
| - ``` |
60 |
| - |
61 |
| -1. Use the [az connectedk8s show](/cli/azure/connectedk8s#az-connectedk8s-show) command to get the cluster's issuer URL. You'll add the URL later in the K3s configuration file. |
62 |
| - |
63 |
| - ```azurecli |
64 |
| - #!/bin/bash |
65 |
| -
|
66 |
| - # Variable block |
67 |
| - RESOURCE_GROUP="<RESOURCE_GROUP>" |
68 |
| - CLUSTER_NAME="<CLUSTER_NAME>" |
69 |
| - |
70 |
| - # Get the cluster's issuer URL |
71 |
| - SERVICE_ACCOUNT_ISSUER=$(az connectedk8s show --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --query oidcIssuerProfile.issuerUrl --output tsv) |
72 |
| - echo "SERVICE_ACCOUNT_ISSUER = $SERVICE_ACCOUNT_ISSUER" |
73 |
| - ``` |
74 |
| - |
75 |
| -1. Create a K3s configuration file: |
76 |
| - |
77 |
| - ```bash |
78 |
| - sudo nano /etc/rancher/k3s/config.yaml |
79 |
| - ``` |
80 |
| - |
81 |
| -1. Add the following content to the config.yaml file: |
82 |
| - |
83 |
| - ```yml |
84 |
| - kube-apiserver-arg: |
85 |
| - - service-account-issuer=<SERVICE_ACCOUNT_ISSUER> |
86 |
| - - service-account-max-token-expiration=24h |
87 |
| - ``` |
88 |
| -
|
89 |
| -1. Save and close the file editor. |
90 |
| -
|
91 |
| -1. Restart k3s: |
92 |
| -
|
93 |
| - ```bash |
94 |
| - systemctl restart k3s |
95 |
| - ``` |
96 |
| - |
97 | 30 | ## Set up secrets management
|
98 | 31 |
|
99 | 32 | Secrets management for Azure IoT Operations uses the Secret Store extension to sync the secrets from an Azure key vault and store them on the edge as Kubernetes secrets. The Secret Store extension requires a user-assigned managed identity with access to the Azure key vault where secrets are stored. To learn more, see [What are managed identities for Azure resources?](/entra/identity/managed-identities-azure-resources/overview).
|
|
0 commit comments