Skip to content

Commit d5e88ff

Browse files
Merge pull request #238762 from mingweihe/user/mingweihe/optimize-docs-for-UAI-workspace
optimize docs for UAI workspace
2 parents 3b3b940 + 9e576d3 commit d5e88ff

File tree

1 file changed

+48
-19
lines changed

1 file changed

+48
-19
lines changed

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

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -62,25 +62,22 @@ 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 a workspace with user assigned identity, 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 -f workspace_uai.yml
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
78-
name: <workspace name>
7978
location: <region name>
80-
resource_group: <resource group name>
8179
identity:
8280
type: user_assigned
83-
tenant_id: <tenant ID>
8481
user_assigned_identities:
8582
'<UAI resource ID 1>': {}
8683
'<UAI resource ID 2>': {}
@@ -97,41 +94,73 @@ primary_user_assigned_identity: <one of the UAI resource IDs in the above list>
9794
```python
9895
from azure.ai.ml import MLClient, load_workspace
9996
from azure.identity import DefaultAzureCredential
97+
10098
sub_id="<subscription ID>"
10199
rg_name="<resource group name>"
102100
ws_name="<workspace name>"
101+
103102
client = MLClient(DefaultAzureCredential(), sub_id, rg_name)
104-
wps = load_workspace("workspace_uai.yml")
103+
wps = load_workspace("workspace_creation_with_multiple_UAIs.yml")
104+
105105
workspace = client.workspaces.begin_create(workspace=wps).result()
106-
# update SAI workspace to SAI&UAI workspace
107-
wps = load_workspace("workspace_sai_and_uai.yml")
108-
workspace = client.workspaces.begin_update(workspace=wps).result()
109106
```
110107

111-
Where the contents of *workspace_sai_and_uai.yml* are as follows:
108+
# [Studio](#tab/azure-studio)
109+
110+
Not supported currently.
111+
112+
---
113+
114+
#### To update user assigned identities for a workspace, includes adding a new one or deleting the existing ones, use one of the following methods:
115+
116+
# [Azure CLI](#tab/cli)
117+
118+
[!INCLUDE [cli v2](../../includes/machine-learning-cli-v2.md)]
119+
120+
```azurecli
121+
az ml workspace update -f workspace_update_with_multiple_UAIs.yml --subscription <subscription ID> --resource-group <resource group name> --name <workspace name>
122+
```
123+
124+
Where the contents of *workspace_update_with_multiple_UAIs.yml* are as follows:
112125

113126
```yaml
114-
name: <workspace name>
115-
location: <region name>
116-
resource_group: <resource group name>
117127
identity:
118-
type: system_assigned, user_assigned
119-
tenant_id: <tenant ID>
128+
type: user_assigned
120129
user_assigned_identities:
121130
'<UAI resource ID 1>': {}
122131
'<UAI resource ID 2>': {}
123-
storage_account: <storage acccount resource ID>
124-
key_vault: <key vault resource ID>
125-
image_build_compute: <compute(virtual machine) resource ID>
126132
primary_user_assigned_identity: <one of the UAI resource IDs in the above list>
127133
```
128134
135+
# [Python SDK](#tab/python)
136+
137+
[!INCLUDE [sdk v2](../../includes/machine-learning-sdk-v2.md)]
138+
139+
```python
140+
from azure.ai.ml import MLClient, load_workspace
141+
from azure.identity import DefaultAzureCredential
142+
143+
sub_id="<subscription ID>"
144+
rg_name="<resource group name>"
145+
ws_name="<workspace name>"
146+
147+
client = MLClient(DefaultAzureCredential(), sub_id, rg_name)
148+
wps = load_workspace("workspace_update_with_multiple_UAIs.yml")
149+
150+
workspace = client.workspaces.begin_update(workspace=wps).result()
151+
```
152+
129153
# [Studio](#tab/azure-studio)
130154

131155
Not supported currently.
132156

133157
---
134158

159+
> [!TIP]
160+
> 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>
161+
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>
162+
To update identity type from SAI to UAI|SAI, you can change type from "user_assigned" to "system_assigned, user_assigned".
163+
135164
### Compute cluster
136165

137166
> [!NOTE]

0 commit comments

Comments
 (0)