Skip to content

Commit 47a13f5

Browse files
author
Mingwei He
committed
fix
1 parent 2afbb71 commit 47a13f5

File tree

1 file changed

+53
-12
lines changed

1 file changed

+53
-12
lines changed

articles/machine-learning/how-to-identity-based-service-authentication.md

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,17 @@ For automated creation of role assignments on your user-assigned managed identit
6262
> [!TIP]
6363
> For a workspace with [customer-managed keys for encryption](concept-data-encryption.md), you can pass in a user-assigned managed identity to authenticate from storage to Key Vault. Use the `user-assigned-identity-for-cmk-encryption` (CLI) or `user_assigned_identity_for_cmk_encryption` (SDK) parameters to pass in the managed identity. This managed identity can be the same or different as the workspace primary user assigned managed identity.
6464
65-
To create or update a workspace with user assigned identity/identities, use one of the following methods:
65+
#### To create a workspace with multiple user assigned identities, use one of the following methods:
6666

6767
# [Azure CLI](#tab/cli)
6868

6969
[!INCLUDE [cli v2](../../includes/machine-learning-cli-v2.md)]
7070

7171
```azurecli
72-
az ml workspace create/update -f workspace_uai.yml --subscription <subscription ID> --resource-group <resource group name> --name <workspace name>
72+
az ml workspace create -f workspace_creation_with_multiple_UAIs.yml --subscription <subscription ID> --resource-group <resource group name> --name <workspace name>
7373
```
7474

75-
Where the contents of *workspace_uai.yml* are as follows:
75+
Where the contents of *workspace_creation_with_multiple_UAIs.yml* are as follows:
7676

7777
```yaml
7878
location: <region name>
@@ -81,14 +81,12 @@ identity:
8181
user_assigned_identities:
8282
'<UAI resource ID 1>': {}
8383
'<UAI resource ID 2>': {}
84+
storage_account: <storage acccount resource ID>
85+
key_vault: <key vault resource ID>
86+
image_build_compute: <compute(virtual machine) resource ID>
8487
primary_user_assigned_identity: <one of the UAI resource IDs in the above list>
8588
```
8689
87-
> [!TIP]
88-
> To add a new UAI, you can specify the new UAI ID under the section user_assigned_identities in addition to the existing UAIs, it's required to pass all the existing UAI IDs.<br>
89-
To delete one or more existing UAIs, you can put the UAI IDs which needs to be preserved under the section user_assigned_identities, the rest UAI IDs would be deleted.<br>
90-
To update identity type from SAI to UAI|SAI, you can change type from "user_assigned" to "system_assigned, user_assigned".
91-
9290
# [Python SDK](#tab/python)
9391
9492
[!INCLUDE [sdk v2](../../includes/machine-learning-sdk-v2.md)]
@@ -100,11 +98,49 @@ sub_id="<subscription ID>"
10098
rg_name="<resource group name>"
10199
ws_name="<workspace name>"
102100
client = MLClient(DefaultAzureCredential(), sub_id, rg_name)
103-
# create a workspace with identity type UAI
104-
wps = load_workspace("workspace_uai.yml")
101+
wps = load_workspace("workspace_creation_with_multiple_UAIs.yml")
105102
workspace = client.workspaces.begin_create(workspace=wps).result()
106-
# update
107-
wps = load_workspace("workspace_uai.yml")
103+
```
104+
105+
# [Studio](#tab/azure-studio)
106+
107+
Not supported currently.
108+
109+
---
110+
111+
#### To update user assigned identities for a workspace, includes adding a new one or deleting the existing ones, use one of the following methods:
112+
113+
# [Azure CLI](#tab/cli)
114+
115+
[!INCLUDE [cli v2](../../includes/machine-learning-cli-v2.md)]
116+
117+
```azurecli
118+
az ml workspace update -f workspace_update_with_multiple_UAIs.yml --subscription <subscription ID> --resource-group <resource group name> --name <workspace name>
119+
```
120+
121+
Where the contents of *workspace_update_with_multiple_UAIs.yml* are as follows:
122+
123+
```yaml
124+
identity:
125+
type: user_assigned
126+
user_assigned_identities:
127+
'<UAI resource ID 1>': {}
128+
'<UAI resource ID 2>': {}
129+
primary_user_assigned_identity: <one of the UAI resource IDs in the above list>
130+
```
131+
132+
# [Python SDK](#tab/python)
133+
134+
[!INCLUDE [sdk v2](../../includes/machine-learning-sdk-v2.md)]
135+
136+
```python
137+
from azure.ai.ml import MLClient, load_workspace
138+
from azure.identity import DefaultAzureCredential
139+
sub_id="<subscription ID>"
140+
rg_name="<resource group name>"
141+
ws_name="<workspace name>"
142+
client = MLClient(DefaultAzureCredential(), sub_id, rg_name)
143+
wps = load_workspace("workspace_update_with_multiple_UAIs.yml")
108144
workspace = client.workspaces.begin_update(workspace=wps).result()
109145
```
110146

@@ -114,6 +150,11 @@ Not supported currently.
114150

115151
---
116152

153+
> [!TIP]
154+
> To add a new UAI, you can specify the new UAI ID under the section user_assigned_identities in addition to the existing UAIs, it's required to pass all the existing UAI IDs.<br>
155+
To delete one or more existing UAIs, you can put the UAI IDs which needs to be preserved under the section user_assigned_identities, the rest UAI IDs would be deleted.<br>
156+
To update identity type from SAI to UAI|SAI, you can change type from "user_assigned" to "system_assigned, user_assigned".
157+
117158
### Compute cluster
118159

119160
> [!NOTE]

0 commit comments

Comments
 (0)