Skip to content

Commit 1648654

Browse files
authored
Update howto-enable-secure-settings.md
1 parent df54adf commit 1648654

File tree

1 file changed

+18
-56
lines changed

1 file changed

+18
-56
lines changed

articles/iot-operations/deploy-iot-ops/howto-enable-secure-settings.md

Lines changed: 18 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -48,38 +48,16 @@ Use the following steps to enable workload identity on an existing connected K3s
4848

4949
1. Download and install a preview version of the `connectedk8s` extension for Azure CLI. GitHub: [connectedk8s-1.10.0](https://github.com/AzureArcForKubernetes/azure-cli-extensions/blob/connectedk8s/public/cli-extensions/connectedk8s-1.10.0-py2.py3-none-any.whl).
5050

51-
```bash
52-
curl -L -o connectedk8s-1.10.0-py2.py3-none-any.whl https://github.com/AzureArcForKubernetes/azure-cli-extensions/raw/refs/heads/connectedk8s/public/cli-extensions/connectedk8s-1.10.0-py2.py3-none-any.whl
53-
```
54-
55-
1. Use the [az extension remove](/cli/azure/extension#az-extension-remove) command to remove the existing connectedk8s cli extension if you already installed it.
56-
51+
1. Remove the existing connected k8s cli if any
5752
```azurecli
58-
#!/bin/bash
5953
az extension remove --name connectedk8s
6054
```
6155

62-
1. Use the [az extension add](/cli/azure/extension#az-extension-add) command to add the new connectedk8s cli source.
56+
1. Download and install a preview version of the `connectedk8s` extension for Azure CLI.
6357

6458
```azurecli
65-
#!/bin/bash
66-
az extension add --upgrade --source <PATH_TO_WHL_FILE>
67-
```
68-
69-
1. Use the [az connectedk8s upgrade](/cli/azure/connectedk8s#az-connectedk8s-upgrade) command to upgrade the Arc agent version to the private build that supports the workload identity feature.
70-
71-
```azurecli
72-
#!/bin/bash
73-
74-
# Variable block
75-
RESOURCE_GROUP="<RESOURCE_GROUP>"
76-
CLUSTER_NAME="<CLUSTER_NAME>"
77-
RELEASE_TAG="1.20.1"
78-
79-
# Update the Arc agent version
80-
az connectedk8s upgrade --resource-group $RESOURCE_GROUP \
81-
--name $CLUSTER_NAME \
82-
--agent-version $RELEASE_TAG
59+
curl -L -o connectedk8s-1.10.0-py2.py3-none-any.whl https://github.com/AzureArcForKubernetes/azure-cli-extensions/raw/refs/heads/connectedk8s/public/cli-extensions/connectedk8s-1.10.0-py2.py3-none-any.whl
60+
az extension add --upgrade --source connectedk8s-1.10.0-py2.py3-none-any.whl
8361
```
8462

8563
1. Use the [az connectedk8s update](/cli/azure/connectedk8s#az-connectedk8s-update) command to enable the workload identity feature on the cluster.
@@ -92,9 +70,7 @@ Use the following steps to enable workload identity on an existing connected K3s
9270
CLUSTER_NAME="<CLUSTER_NAME>"
9371
9472
# Enable workload identity
95-
az connectedk8s update --resource-group $RESOURCE_GROUP \
96-
--name $CLUSTER_NAME \
97-
--enable-oidc-issuer --enable-workload-identity
73+
az connectedk8s update --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --enable-oidc-issuer --enable-workload-identity
9874
```
9975

10076
1. Use the [az connectedk8s show](/cli/azure/connectedk8s#az-connectedk8s-show) command to to get the cluster's issuer url. Take a note to add it later in K3s config file.
@@ -114,7 +90,7 @@ Use the following steps to enable workload identity on an existing connected K3s
11490
1. Create a K3s config file.
11591

11692
```bash
117-
nano /etc/rancher/k3s/config.yaml
93+
sudo nano /etc/rancher/k3s/config.yaml
11894
```
11995

12096
1. Add the following content to the config.yaml file:
@@ -154,10 +130,7 @@ If you already have an Azure Key Vault with `Key Vault Secrets Officer` permissi
154130
LOCATION="<LOCATION>"
155131
156132
# Create the Key Vault
157-
az keyvault create --name $KEYVAULT_NAME \
158-
--resource-group $RESOURCE_GROUP \
159-
--location $LOCATION \
160-
--enable-rbac-authorization
133+
az keyvault create --name $KEYVAULT_NAME --resource-group $RESOURCE_GROUP --location $LOCATION --enable-rbac-authorization
161134
```
162135
163136
# [PowerShell](#tab/powershell)
@@ -191,9 +164,7 @@ If you already have an Azure Key Vault with `Key Vault Secrets Officer` permissi
191164
ASSIGNEE_ID=$(az ad signed-in-user show --query id -o tsv)
192165
193166
# Assign the "Key Vault Secrets Officer" role
194-
az role assignment create --role "Key Vault Secrets Officer" \
195-
--assignee $ASSIGNEE_ID \
196-
--scope /subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCE_GROUP/providers/Microsoft.KeyVault/vaults/$KEYVAULT_NAME
167+
az role assignment create --role "Key Vault Secrets Officer" --assignee $ASSIGNEE_ID --scope /subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCE_GROUP/providers/Microsoft.KeyVault/vaults/$KEYVAULT_NAME
197168
```
198169
199170
# [PowerShell](#tab/powershell)
@@ -228,9 +199,7 @@ RESOURCE_GROUP="<RESOURCE_GROUP>"
228199
LOCATION="LOCATION"
229200
230201
# Create the identity
231-
az identity create --name $USER_ASSIGNED_MI_NAME \
232-
--resource-group $RESOURCE_GROUP \
233-
--location $LOCATION
202+
az identity create --name $USER_ASSIGNED_MI_NAME --resource-group $RESOURCE_GROUP --location $LOCATION
234203
```
235204

236205
# [PowerShell](#tab/powershell)
@@ -261,7 +230,7 @@ Use the [az iot ops secretsync enable](/cli/azure/iot/ops) command to set up the
261230

262231
```azurecli
263232
# Variable block
264-
CLUSTER_NAME="<CLUSTER_NAME>"
233+
INSTANCE_NAME="<INSTANCE_NAME"
265234
RESOURCE_GROUP="<RESOURCE_GROUP>"
266235
USER_ASSIGNED_MI_NAME="<USER_ASSIGNED_MI_NAME>"
267236
KEYVAULT_NAME="<KEYVAULT_NAME>"
@@ -273,17 +242,14 @@ USER_ASSIGNED_MI_RESOURCE_ID=$(az identity show --name $USER_ASSIGNED_MI_NAME --
273242
KEYVAULT_RESOURCE_ID=$(az keyvault show --name $KEYVAULT_NAME --resource-group $RESOURCE_GROUP --query id --output tsv)
274243
275244
#Enable secret synchronization
276-
az iot ops secretsync enable --name $CLUSTER_NAME \
277-
--resource-group $RESOURCE_GROUP \
278-
--mi-user-assigned $USER_ASSIGNED_MI_RESOURCE_ID \
279-
--kv-resource-id $KEYVAULT_RESOURCE_ID
245+
az iot ops secretsync enable --name $INSTANCE_NAME --resource-group $RESOURCE_GROUP --mi-user-assigned $USER_ASSIGNED_MI_RESOURCE_ID --kv-resource-id $KEYVAULT_RESOURCE_ID
280246
```
281247

282248
# [PowerShell](#tab/powershell)
283249

284250
```azurecli
285251
# Variable block
286-
$CLUSTER_NAME="<CLUSTER_NAME>"
252+
INSTANCE_NAME="<INSTANCE_NAME"
287253
$RESOURCE_GROUP="<RESOURCE_GROUP>"
288254
$USER_ASSIGNED_MI_NAME="<USER_ASSIGNED_MI_NAME>"
289255
$KEYVAULT_NAME="<KEYVAULT_NAME>"
@@ -295,7 +261,7 @@ $USER_ASSIGNED_MI_RESOURCE_ID=$(az identity show --name $USER_ASSIGNED_MI_NAME -
295261
$KEYVAULT_RESOURCE_ID=$(az keyvault show --name $KEYVAULT_NAME --resource-group $RESOURCE_GROUP --query id --output tsv)
296262
297263
# Enable secret synchronization
298-
az iot ops secretsync enable --name $CLUSTER_NAME `
264+
az iot ops secretsync enable --name $INSTANCE_NAME `
299265
--resource-group $RESOURCE_GROUP `
300266
--mi-user-assigned $USER_ASSIGNED_MI_RESOURCE_ID `
301267
--kv-resource-id $KEYVAULT_RESOURCE_ID
@@ -320,9 +286,7 @@ Some Azure IoT Operations components like dataflow endpoints use user-assigned m
320286
LOCATION="LOCATION"
321287
322288
# Create the identity
323-
az identity create --name $USER_ASSIGNED_MI_NAME \
324-
--resource-group $RESOURCE_GROUP \
325-
--location $LOCATION
289+
az identity create --name $USER_ASSIGNED_MI_NAME --resource-group $RESOURCE_GROUP --location $LOCATION
326290
```
327291
328292
# [PowerShell](#tab/powershell)
@@ -350,24 +314,22 @@ Some Azure IoT Operations components like dataflow endpoints use user-assigned m
350314
351315
```azurecli
352316
# Variable block
353-
CLUSTER_NAME="<CLUSTER_NAME>"
317+
INSTANCE_NAME="<INSTANCE_NAME"
354318
RESOURCE_GROUP="<RESOURCE_GROUP>"
355319
USER_ASSIGNED_MI_NAME="<USER_ASSIGNED_MI_NAME FOR CLOUD CONNECTIONS>"
356320
357321
#Get the resource ID of the user-assigned managed identity
358322
USER_ASSIGNED_MI_RESOURCE_ID=$(az identity show --name $USER_ASSIGNED_MI_NAME --resource-group $RESOURCE_GROUP --query id --output tsv)
359323
360324
#Assign the identity to the Azure IoT Operations instance
361-
az iot ops identity assign --name $CLUSTER_NAME \
362-
--resource-group $RESOURCE_GROUP \
363-
--mi-user-assigned $USER_ASSIGNED_MI_RESOURCE_ID
325+
az iot ops identity assign --name $INSTANCE_NAME --resource-group $RESOURCE_GROUP --mi-user-assigned $USER_ASSIGNED_MI_RESOURCE_ID
364326
```
365327
366328
# [PowerShell](#tab/powershell)
367329
368330
```azurecli
369331
# Variable block
370-
$CLUSTER_NAME="<CLUSTER_NAME>"
332+
$INSTANCE_NAME="<INSTANCE_NAME"
371333
$RESOURCE_GROUP="<RESOURCE_GROUP>"
372334
$USER_ASSIGNED_MI_NAME="<USER_ASSIGNED_MI_NAME FOR CLOUD CONNECTIONS>"
373335
@@ -376,7 +338,7 @@ Some Azure IoT Operations components like dataflow endpoints use user-assigned m
376338
377339
378340
#Assign the identity to the Azure IoT Operations instance
379-
az iot ops identity assign --name $CLUSTER_NAME `
341+
az iot ops identity assign --name $INSTANCE_NAME `
380342
--resource-group $RESOURCE_GROUP `
381343
--mi-user-assigned $USER_ASSIGNED_MI_RESOURCE_ID
382344
```

0 commit comments

Comments
 (0)