Skip to content

Commit 8373020

Browse files
Merge pull request #287706 from Mzamankhan/patch-11
Update howto-enable-secure-settings.md
2 parents d11ddd6 + 910a5fe commit 8373020

File tree

1 file changed

+18
-58
lines changed

1 file changed

+18
-58
lines changed

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

Lines changed: 18 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -46,40 +46,16 @@ az connectedk8s show --name <CLUSTER_NAME> --resource-group <RESOURCE_GROUP> --q
4646
4747
Use the following steps to enable workload identity on an existing connected K3s cluster:
4848

49-
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).
50-
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-
49+
1. Remove the existing connected k8s cli if any
5750
```azurecli
58-
#!/bin/bash
5951
az extension remove --name connectedk8s
6052
```
6153

62-
1. Use the [az extension add](/cli/azure/extension#az-extension-add) command to add the new connectedk8s cli source.
63-
64-
```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.
54+
1. Download and install a preview version of the `connectedk8s` extension for Azure CLI.
7055

7156
```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
57+
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
58+
az extension add --upgrade --source connectedk8s-1.10.0-py2.py3-none-any.whl
8359
```
8460

8561
1. Use the [az connectedk8s update](/cli/azure/connectedk8s#az-connectedk8s-update) command to enable the workload identity feature on the cluster.
@@ -92,9 +68,7 @@ Use the following steps to enable workload identity on an existing connected K3s
9268
CLUSTER_NAME="<CLUSTER_NAME>"
9369
9470
# Enable workload identity
95-
az connectedk8s update --resource-group $RESOURCE_GROUP \
96-
--name $CLUSTER_NAME \
97-
--enable-oidc-issuer --enable-workload-identity
71+
az connectedk8s update --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --enable-oidc-issuer --enable-workload-identity
9872
```
9973

10074
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 +88,7 @@ Use the following steps to enable workload identity on an existing connected K3s
11488
1. Create a K3s config file.
11589

11690
```bash
117-
nano /etc/rancher/k3s/config.yaml
91+
sudo nano /etc/rancher/k3s/config.yaml
11892
```
11993

12094
1. Add the following content to the config.yaml file:
@@ -154,10 +128,7 @@ If you already have an Azure Key Vault with `Key Vault Secrets Officer` permissi
154128
LOCATION="<LOCATION>"
155129
156130
# Create the Key Vault
157-
az keyvault create --name $KEYVAULT_NAME \
158-
--resource-group $RESOURCE_GROUP \
159-
--location $LOCATION \
160-
--enable-rbac-authorization
131+
az keyvault create --name $KEYVAULT_NAME --resource-group $RESOURCE_GROUP --location $LOCATION --enable-rbac-authorization
161132
```
162133
163134
# [PowerShell](#tab/powershell)
@@ -191,9 +162,7 @@ If you already have an Azure Key Vault with `Key Vault Secrets Officer` permissi
191162
ASSIGNEE_ID=$(az ad signed-in-user show --query id -o tsv)
192163
193164
# 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
165+
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
197166
```
198167
199168
# [PowerShell](#tab/powershell)
@@ -228,9 +197,7 @@ RESOURCE_GROUP="<RESOURCE_GROUP>"
228197
LOCATION="LOCATION"
229198
230199
# Create the identity
231-
az identity create --name $USER_ASSIGNED_MI_NAME \
232-
--resource-group $RESOURCE_GROUP \
233-
--location $LOCATION
200+
az identity create --name $USER_ASSIGNED_MI_NAME --resource-group $RESOURCE_GROUP --location $LOCATION
234201
```
235202

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

262229
```azurecli
263230
# Variable block
264-
CLUSTER_NAME="<CLUSTER_NAME>"
231+
INSTANCE_NAME="<INSTANCE_NAME"
265232
RESOURCE_GROUP="<RESOURCE_GROUP>"
266233
USER_ASSIGNED_MI_NAME="<USER_ASSIGNED_MI_NAME>"
267234
KEYVAULT_NAME="<KEYVAULT_NAME>"
@@ -273,17 +240,14 @@ USER_ASSIGNED_MI_RESOURCE_ID=$(az identity show --name $USER_ASSIGNED_MI_NAME --
273240
KEYVAULT_RESOURCE_ID=$(az keyvault show --name $KEYVAULT_NAME --resource-group $RESOURCE_GROUP --query id --output tsv)
274241
275242
#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
243+
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
280244
```
281245

282246
# [PowerShell](#tab/powershell)
283247

284248
```azurecli
285249
# Variable block
286-
$CLUSTER_NAME="<CLUSTER_NAME>"
250+
INSTANCE_NAME="<INSTANCE_NAME"
287251
$RESOURCE_GROUP="<RESOURCE_GROUP>"
288252
$USER_ASSIGNED_MI_NAME="<USER_ASSIGNED_MI_NAME>"
289253
$KEYVAULT_NAME="<KEYVAULT_NAME>"
@@ -295,7 +259,7 @@ $USER_ASSIGNED_MI_RESOURCE_ID=$(az identity show --name $USER_ASSIGNED_MI_NAME -
295259
$KEYVAULT_RESOURCE_ID=$(az keyvault show --name $KEYVAULT_NAME --resource-group $RESOURCE_GROUP --query id --output tsv)
296260
297261
# Enable secret synchronization
298-
az iot ops secretsync enable --name $CLUSTER_NAME `
262+
az iot ops secretsync enable --name $INSTANCE_NAME `
299263
--resource-group $RESOURCE_GROUP `
300264
--mi-user-assigned $USER_ASSIGNED_MI_RESOURCE_ID `
301265
--kv-resource-id $KEYVAULT_RESOURCE_ID
@@ -320,9 +284,7 @@ Some Azure IoT Operations components like dataflow endpoints use user-assigned m
320284
LOCATION="LOCATION"
321285
322286
# Create the identity
323-
az identity create --name $USER_ASSIGNED_MI_NAME \
324-
--resource-group $RESOURCE_GROUP \
325-
--location $LOCATION
287+
az identity create --name $USER_ASSIGNED_MI_NAME --resource-group $RESOURCE_GROUP --location $LOCATION
326288
```
327289
328290
# [PowerShell](#tab/powershell)
@@ -350,24 +312,22 @@ Some Azure IoT Operations components like dataflow endpoints use user-assigned m
350312
351313
```azurecli
352314
# Variable block
353-
CLUSTER_NAME="<CLUSTER_NAME>"
315+
INSTANCE_NAME="<INSTANCE_NAME"
354316
RESOURCE_GROUP="<RESOURCE_GROUP>"
355317
USER_ASSIGNED_MI_NAME="<USER_ASSIGNED_MI_NAME FOR CLOUD CONNECTIONS>"
356318
357319
#Get the resource ID of the user-assigned managed identity
358320
USER_ASSIGNED_MI_RESOURCE_ID=$(az identity show --name $USER_ASSIGNED_MI_NAME --resource-group $RESOURCE_GROUP --query id --output tsv)
359321
360322
#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
323+
az iot ops identity assign --name $INSTANCE_NAME --resource-group $RESOURCE_GROUP --mi-user-assigned $USER_ASSIGNED_MI_RESOURCE_ID
364324
```
365325
366326
# [PowerShell](#tab/powershell)
367327
368328
```azurecli
369329
# Variable block
370-
$CLUSTER_NAME="<CLUSTER_NAME>"
330+
$INSTANCE_NAME="<INSTANCE_NAME"
371331
$RESOURCE_GROUP="<RESOURCE_GROUP>"
372332
$USER_ASSIGNED_MI_NAME="<USER_ASSIGNED_MI_NAME FOR CLOUD CONNECTIONS>"
373333
@@ -376,7 +336,7 @@ Some Azure IoT Operations components like dataflow endpoints use user-assigned m
376336
377337
378338
#Assign the identity to the Azure IoT Operations instance
379-
az iot ops identity assign --name $CLUSTER_NAME `
339+
az iot ops identity assign --name $INSTANCE_NAME `
380340
--resource-group $RESOURCE_GROUP `
381341
--mi-user-assigned $USER_ASSIGNED_MI_RESOURCE_ID
382342
```

0 commit comments

Comments
 (0)