Skip to content

Commit 7e4df5e

Browse files
authored
Merge pull request #114701 from Blackmist/template
updating to refer to template in the quickstart gallery
2 parents 5d36f71 + d7de310 commit 7e4df5e

File tree

1 file changed

+67
-189
lines changed

1 file changed

+67
-189
lines changed

articles/machine-learning/how-to-create-workspace-template.md

Lines changed: 67 additions & 189 deletions
Original file line numberDiff line numberDiff line change
@@ -82,201 +82,79 @@ The following example template demonstrates how to create a workspace with three
8282

8383
For more information, see [Encryption at rest](concept-enterprise-security.md#encryption-at-rest).
8484

85-
```json
86-
{
87-
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
88-
"contentVersion": "1.0.0.0",
89-
"parameters": {
90-
"workspaceName": {
91-
"type": "string",
92-
"metadata": {
93-
"description": "Specifies the name of the Azure Machine Learning workspace."
94-
}
95-
},
96-
"location": {
97-
"type": "string",
98-
"defaultValue": "southcentralus",
99-
"allowedValues": [
100-
"eastus",
101-
"eastus2",
102-
"southcentralus",
103-
"southeastasia",
104-
"westcentralus",
105-
"westeurope",
106-
"westus2"
107-
],
108-
"metadata": {
109-
"description": "Specifies the location for all resources."
110-
}
111-
},
112-
"sku":{
113-
"type": "string",
114-
"defaultValue": "basic",
115-
"allowedValues": [
116-
"basic",
117-
"enterprise"
118-
],
119-
"metadata": {
120-
"description": "Specifies the sku, also referred to as 'edition' of the Azure Machine Learning workspace."
121-
}
122-
},
123-
"high_confidentiality":{
124-
"type": "string",
125-
"defaultValue": "false",
126-
"allowedValues": [
127-
"false",
128-
"true"
129-
],
130-
"metadata": {
131-
"description": "Specifies that the Azure Machine Learning workspace holds highly confidential data."
132-
}
133-
},
134-
"encryption_status":{
135-
"type": "string",
136-
"defaultValue": "Disabled",
137-
"allowedValues": [
138-
"Enabled",
139-
"Disabled"
140-
],
141-
"metadata": {
142-
"description": "Specifies if the Azure Machine Learning workspace should be encrypted with the customer managed key."
143-
}
144-
},
145-
"cmk_keyvault":{
146-
"type": "string",
147-
"metadata": {
148-
"description": "Specifies the customer managed keyvault Resource Manager ID."
149-
}
150-
},
151-
"resource_cmk_uri":{
152-
"type": "string",
153-
"metadata": {
154-
"description": "Specifies the customer managed keyvault key uri."
155-
}
156-
}
157-
},
158-
"variables": {
159-
"storageAccountName": "[concat('sa',uniqueString(resourceGroup().id))]",
160-
"storageAccountType": "Standard_LRS",
161-
"keyVaultName": "[concat('kv',uniqueString(resourceGroup().id))]",
162-
"tenantId": "[subscription().tenantId]",
163-
"applicationInsightsName": "[concat('ai',uniqueString(resourceGroup().id))]",
164-
"containerRegistryName": "[concat('cr',uniqueString(resourceGroup().id))]"
165-
},
166-
"resources": [
167-
{
168-
"type": "Microsoft.Storage/storageAccounts",
169-
"apiVersion": "2018-07-01",
170-
"name": "[variables('storageAccountName')]",
171-
"location": "[parameters('location')]",
172-
"sku": {
173-
"name": "[variables('storageAccountType')]"
174-
},
175-
"kind": "StorageV2",
176-
"properties": {
177-
"encryption": {
178-
"services": {
179-
"blob": {
180-
"enabled": true
181-
},
182-
"file": {
183-
"enabled": true
184-
}
185-
},
186-
"keySource": "Microsoft.Storage"
187-
},
188-
"supportsHttpsTrafficOnly": true
189-
}
190-
},
191-
{
192-
"type": "Microsoft.KeyVault/vaults",
193-
"apiVersion": "2018-02-14",
194-
"name": "[variables('keyVaultName')]",
195-
"location": "[parameters('location')]",
196-
"properties": {
197-
"tenantId": "[variables('tenantId')]",
198-
"sku": {
199-
"name": "standard",
200-
"family": "A"
201-
},
202-
"accessPolicies": []
203-
}
204-
},
205-
{
206-
"type": "Microsoft.Insights/components",
207-
"apiVersion": "2015-05-01",
208-
"name": "[variables('applicationInsightsName')]",
209-
"location": "[if(or(equals(parameters('location'),'eastus2'),equals(parameters('location'),'westcentralus')),'southcentralus',parameters('location'))]",
210-
"kind": "web",
211-
"properties": {
212-
"Application_Type": "web"
213-
}
214-
},
215-
{
216-
"type": "Microsoft.ContainerRegistry/registries",
217-
"apiVersion": "2017-10-01",
218-
"name": "[variables('containerRegistryName')]",
219-
"location": "[parameters('location')]",
220-
"sku": {
221-
"name": "Standard"
222-
},
223-
"properties": {
224-
"adminUserEnabled": true
225-
}
226-
},
227-
{
228-
"type": "Microsoft.MachineLearningServices/workspaces",
229-
"apiVersion": "2020-01-01",
230-
"name": "[parameters('workspaceName')]",
231-
"location": "[parameters('location')]",
232-
"dependsOn": [
233-
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
234-
"[resourceId('Microsoft.KeyVault/vaults', variables('keyVaultName'))]",
235-
"[resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))]",
236-
"[resourceId('Microsoft.ContainerRegistry/registries', variables('containerRegistryName'))]"
237-
],
238-
"identity": {
239-
"type": "systemAssigned"
240-
},
241-
"sku": {
242-
"tier": "[parameters('sku')]",
243-
"name": "[parameters('sku')]"
244-
},
245-
"properties": {
246-
"friendlyName": "[parameters('workspaceName')]",
247-
"keyVault": "[resourceId('Microsoft.KeyVault/vaults',variables('keyVaultName'))]",
248-
"applicationInsights": "[resourceId('Microsoft.Insights/components',variables('applicationInsightsName'))]",
249-
"containerRegistry": "[resourceId('Microsoft.ContainerRegistry/registries',variables('containerRegistryName'))]",
250-
"storageAccount": "[resourceId('Microsoft.Storage/storageAccounts/',variables('storageAccountName'))]",
251-
"encryption": {
252-
"status": "[parameters('encryption_status')]",
253-
"keyVaultProperties": {
254-
"keyVaultArmId": "[parameters('cmk_keyvault')]",
255-
"keyIdentifier": "[parameters('resource_cmk_uri')]"
256-
}
257-
},
258-
"hbiWorkspace": "[parameters('high_confidentiality')]"
259-
}
260-
}
261-
]
262-
}
263-
```
85+
> [!IMPORTANT]
86+
> There are some specific requirements your subscription must meet before using this template:
87+
> * The __Azure Machine Learning__ application must be a __contributor__ for your Azure subscription.
88+
> * You must have an existing Azure Key Vault that contains an encryption key.
89+
> * You must have an access policy in the Azure Key Vault that grants __get__, __wrap__, and __unwrap__ access to the __Azure Cosmos DB__ application.
90+
> * The Azure Key Vault must be in the same region where you plan to create the Azure Machine Learning workspace.
91+
> * Your subscription must support __customer-managed keys__ for Azure Cosmos DB.
26492
265-
To get the ID of the Key Vault, and the key URI needed by this template, you can use the Azure CLI. The following command gets the Key Vault ID:
93+
__To add the Azure Machine Learning app as a contributor__, use the following commands:
26694

267-
```azurecli-interactive
268-
az keyvault show --name mykeyvault --resource-group myresourcegroup --query "id"
269-
```
95+
1. To authenticate to Azure from the CLI, use the following command:
27096

271-
This command returns a value similar to `"/subscriptions/{subscription-guid}/resourceGroups/myresourcegroup/providers/Microsoft.KeyVault/vaults/mykeyvault"`.
97+
```azurecli-interactive
98+
az login
99+
```
100+
101+
[!INCLUDE [subscription-login](../../includes/machine-learning-cli-subscription.md)]
272102
273-
To get the URI for the customer managed key, use the following command:
103+
1. To get the object ID of the Azure Machine Learning app, use the following command. The value may be different for each of your Azure subscriptions:
274104
275-
```azurecli-interactive
276-
az keyvault key show --vault-name mykeyvault --name mykey --query "key.kid"
277-
```
105+
```azurecli-interactive
106+
az ad sp list --display-name "Azure Machine Learning" --query '[].[appDisplayName,objectId]' --output tsv
107+
```
108+
109+
This command returns the object ID, which is a GUID.
110+
111+
1. To add the object ID as a contributor to your subscription, use the following command. Replace `<object-ID>` with the GUID from the previous step. Replace `<subscription-ID>` with the name or ID of your Azure subscription:
112+
113+
```azurecli-interactive
114+
az role assignment create --role 'Contributor' --assignee-object-id <object-ID> --subscription <subscription-ID>
115+
```
116+
117+
__To add a key to your Azure Key Vault__, use the information in the [Adding a key, secret, or certificate to the key vault](../key-vault/general/manage-with-cli2.md#adding-a-key-secret-or-certificate-to-the-key-vault) section of the __Manage Key Vault using Azure CLI__ article.
118+
119+
__To add an access policy to the key vault, use the following commands__:
120+
121+
1. To get the object ID of the Azure Cosmos DB app, use the following command. The value may be different for each of your Azure subscriptions:
122+
123+
```azurecli-interactive
124+
az ad sp list --display-name "Azure Cosmos DB" --query '[].[appDisplayName,objectId]' --output tsv
125+
```
126+
127+
This command returns the object ID, which is a GUID.
128+
129+
1. To set the policy, use the following command. Replace `<keyvault-name>` with the name of the existing Azure Key Vault. Replace `<object-ID>` with the GUID from the previous step:
130+
131+
```azurecli-interactive
132+
az keyvault set-policy --name <keyvault-name> --object-id <object-ID> --key-permissions get unwrapKey wrapKey
133+
```
134+
135+
__To enable customer-managed keys for Azure Cosmos DB__, send mail to [email protected] with your Azure subscription ID. For more information, see [Configure customer-managed keys for your Azure Cosmos account](..//cosmos-db/how-to-setup-cmk.md).
136+
137+
__To get the values__ for the `cmk_keyvault` (ID of the Key Vault) and the `resource_cmk_uri` (key URI) parameters needed by this template, use the following steps:
138+
139+
1. To get the Key Vault ID, use the following command:
140+
141+
```azurecli-interactive
142+
az keyvault show --name mykeyvault --resource-group myresourcegroup --query "id"
143+
```
144+
145+
This command returns a value similar to `/subscriptions/{subscription-guid}/resourceGroups/myresourcegroup/providers/Microsoft.KeyVault/vaults/mykeyvault`.
146+
147+
1. To get the value for the URI for the customer managed key, use the following command:
148+
149+
```azurecli-interactive
150+
az keyvault key show --vault-name mykeyvault --name mykey --query "key.kid"
151+
```
152+
153+
This command returns a value similar to `https://mykeyvault.vault.azure.net/keys/mykey/{guid}`.
154+
155+
__Example template__
278156
279-
This command returns a value similar to `"https://mykeyvault.vault.azure.net/keys/mykey/{guid}"`.
157+
:::code language="json" source="~/quickstart-templates/201-machine-learning-encrypted-workspace/azuredeploy.json":::
280158
281159
> [!IMPORTANT]
282160
> Once a workspace has been created, you cannot change the settings for confidential data, encryption, key vault ID, or key identifiers. To change these values, you must create a new workspace using the new values.

0 commit comments

Comments
 (0)