Skip to content

Commit 2498fdb

Browse files
authored
Merge pull request #66101 from Blackmist/amltemplate
How to use a template with Azure Machine Learning service
2 parents c48eca1 + 0ade2bf commit 2498fdb

File tree

4 files changed

+237
-0
lines changed

4 files changed

+237
-0
lines changed

articles/machine-learning/service/concept-azure-machine-learning-architecture.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,4 @@ To get started with Azure Machine Learning service, see:
226226
* [What is Azure Machine Learning service?](overview-what-is-azure-ml.md)
227227
* [Quickstart: Create a workspace with Python](quickstart-get-started.md)
228228
* [Tutorial: Train a model](tutorial-train-models-with-aml.md)
229+
* [Create a workspace with a resource manager template](how-to-create-workspace-template.md)
Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
---
2+
title: Use a template to create a workspace
3+
titleSuffix: Azure Machine Learning service
4+
description: Learn how to use an Azure resource manager template to create a new Azure Machine Learning service workspace.
5+
services: machine-learning
6+
ms.service: machine-learning
7+
ms.component: core
8+
ms.topic: conceptual
9+
10+
ms.reviewer: larryfr
11+
ms.author: haining
12+
author: hning86
13+
ms.date: 02/11/2019
14+
15+
# Customer intent: As a DevOps person, I need to automate or customize the creation of Azure Machine Learning service by using templates.
16+
---
17+
18+
# Create an Azure Machine Learning service workspace by using a template
19+
20+
In this article, you learn several ways to create an Azure Machine Learning service workspace using Azure Resource Manager templates.
21+
22+
For more information, see [Deploy an application with Azure Resource Manager template](../../azure-resource-manager/resource-group-template-deploy.md).
23+
24+
## Prerequisites
25+
26+
* An **Azure subscription**. If you do not have one, try the [free or paid version of Azure Machine Learning service](http://aka.ms/AMLFree).
27+
28+
* To use a template from a CLI, you need either [Azure PowerShell](https://docs.microsoft.com/powershell/azure/overview?view=azps-1.2.0) or the [Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest).
29+
30+
## Resource Manager template
31+
32+
A Resource Manager template makes it easy to create resources as a single, coordinated operation. A template is a JSON document that defines the resources that are needed for a deployment. It may also specify deployment parameters. Parameters are used to provide input values when using the template.
33+
34+
The following template can be used to create an Azure Machine Learning service workspace and associated Azure resources:
35+
36+
```json
37+
{
38+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
39+
"contentVersion": "1.0.0.0",
40+
"parameters": {
41+
"workspaceName": {
42+
"type": "string",
43+
"metadata": {
44+
"description": "The name of the Azure Machine Learning service workspace."
45+
}
46+
},
47+
"location": {
48+
"type": "string",
49+
"allowedValues": [
50+
"eastus",
51+
"eastus2",
52+
"southcentralus",
53+
"southeastasia",
54+
"westcentralus",
55+
"westeurope",
56+
"westus2"
57+
],
58+
"metadata": {
59+
"description": "The location where the workspace will be created."
60+
}
61+
}
62+
},
63+
"variables": {
64+
"storageAccount": {
65+
"name": "[concat('sa',uniqueString(resourceGroup().id))]",
66+
"type": "Standard_LRS"
67+
},
68+
"keyVault": {
69+
"name": "[concat('kv',uniqueString(resourceGroup().id))]",
70+
"tenantId": "[subscription().tenantId]"
71+
},
72+
"applicationInsightsName": "[concat('ai',uniqueString(resourceGroup().id))]",
73+
"containerRegistryName": "[concat('cr',uniqueString(resourceGroup().id))]"
74+
},
75+
"resources": [
76+
{
77+
"name": "[variables('storageAccount').name]",
78+
"type": "Microsoft.Storage/storageAccounts",
79+
"location": "[parameters('location')]",
80+
"apiVersion": "2018-07-01",
81+
"sku": {
82+
"name": "[variables('storageAccount').type]"
83+
},
84+
"kind": "StorageV2",
85+
"properties": {
86+
"encryption": {
87+
"services": {
88+
"blob": {
89+
"enabled": true
90+
},
91+
"file": {
92+
"enabled": true
93+
}
94+
},
95+
"keySource": "Microsoft.Storage"
96+
},
97+
"supportHttpsTrafficOnly": true
98+
}
99+
},
100+
{
101+
"name": "[variables('keyVault').name]",
102+
"type": "Microsoft.KeyVault/vaults",
103+
"apiVersion": "2018-02-14",
104+
"location": "[parameters('location')]",
105+
"properties": {
106+
"tenantId": "[variables('keyVault').tenantId]",
107+
"sku": {
108+
"name": "standard",
109+
"family": "A"
110+
},
111+
"accessPolicies": []
112+
}
113+
},
114+
{
115+
"name": "[variables('applicationInsightsName')]",
116+
"type": "Microsoft.Insights/components",
117+
"apiVersion": "2015-05-01",
118+
"location": "[if(or(equals(parameters('location'),'eastus2'),equals(parameters('location'),'westcentralus')),'southcentralus',parameters('location'))]",
119+
"kind": "web",
120+
"properties": {
121+
"Application_Type": "web"
122+
}
123+
},
124+
{
125+
"name": "[variables('containerRegistryName')]",
126+
"type": "Microsoft.ContainerRegistry/registries",
127+
"apiVersion": "2017-10-01",
128+
"location": "[parameters('location')]",
129+
"sku": {
130+
"name": "Standard"
131+
},
132+
"properties": {
133+
"adminUserEnabled": true
134+
}
135+
},
136+
{
137+
"name": "[parameters('workspaceName')]",
138+
"type": "Microsoft.MachineLearningServices/workspaces",
139+
"apiVersion": "2018-11-19",
140+
"location": "[parameters('location')]",
141+
"dependsOn": [
142+
"[variables('storageAccount').name]",
143+
"[variables('keyVault').name]",
144+
"[variables('applicationInsightsName')]",
145+
"[variables('containerRegistryName')]"
146+
],
147+
"identity": {
148+
"type": "systemAssigned"
149+
},
150+
"properties": {
151+
"friendlyName": "[parameters('workspaceName')]",
152+
"keyVault": "[resourceId('Microsoft.KeyVault/vaults',variables('keyVault').name)]",
153+
"applicationInsights": "[resourceId('Microsoft.Insights/components',variables('applicationInsightsName'))]",
154+
"containerRegistry": "[resourceId('Microsoft.ContainerRegistry/registries',variables('containerRegistryName'))]",
155+
"storageAccount": "[resourceId('Microsoft.Storage/storageAccounts/',variables('storageAccount').name)]"
156+
}
157+
}
158+
]
159+
}
160+
```
161+
162+
This template creates the following Azure services:
163+
164+
* Azure Resource Group
165+
* Azure Storage Account
166+
* Azure Key Vault
167+
* Azure Application Insights
168+
* Azure Container Registry
169+
* Azure Machine Learning workspace
170+
171+
The resource group is the container that holds the services. The various services are required by the Azure Machine Learning workspace.
172+
173+
The example template has two parameters:
174+
175+
* The **location** where the resource group and services will be created.
176+
177+
The template will use the location you select for most resources. The exception is the Application Insights service, which is not available in all of the locations that the other services are. If you select a location where it is not available, the service will be created in the South Central US location.
178+
179+
* The **workspace name**, which is the friendly name of the Azure Machine Learning workspace.
180+
181+
The names of the other services are generated randomly.
182+
183+
For more information on templates, see the following articles:
184+
185+
* [Author Azure Resource Manager templates](../../azure-resource-manager/resource-group-authoring-templates.md)
186+
* [Deploy an application with Azure Resource Manager templates](../../azure-resource-manager/resource-group-template-deploy.md)
187+
* [Microsoft.MachineLearningServices resource types](https://docs.microsoft.com/azure/templates/microsoft.machinelearningservices/allversions)
188+
189+
## Use the Azure portal
190+
191+
1. Follow the steps in [Deploy resources from custom template](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-template-deploy-portal#deploy-resources-from-custom-template). When you arrive at the __Edit template__ screen, paste in the template from this document.
192+
1. Select __Save__ to use the template. Provide the following information and agree to the listed terms and conditions:
193+
194+
* Subscription: Select the Azure subscription to use for these resources.
195+
* Resource group: Select or create a resource group to contain the services.
196+
* Workspace name: The name to use for the Azure Machine Learning workspace that will be created. The workspace name must be between 3 and 33 characters. It may only contain alphanumeric characters and '-'.
197+
* Location: Select the location where the resources will be created.
198+
199+
![The template parameters in the Azure portal](media/how-to-create-workspace-template/template-parameters.png)
200+
201+
For more information, see [Deploy resources from custom template](../../azure-resource-manager/resource-group-template-deploy-portal.md#deploy-resources-from-custom-template).
202+
203+
## Use Azure PowerShell
204+
205+
This example assumes that you have saved the template to a file named `azuredeploy.json` in the current directory:
206+
207+
```powershell
208+
New-AzResourceGroup -Name examplegroup -Location "East US"
209+
new-azresourcegroupdeployment -name exampledeployment `
210+
-resourcegroupname examplegroup -location "East US" `
211+
-templatefile .\azuredeploy.json -workspaceName "exampleworkspace"
212+
```
213+
214+
For more information, see [Deploy resources with Resource Manager templates and Azure PowerShell](../../azure-resource-manager/resource-group-template-deploy.md) and [Deploy private Resource Manager template with SAS token and Azure PowerShell](../../azure-resource-manager/resource-manager-powershell-sas-token.md).
215+
216+
## Use Azure CLI
217+
218+
This example assumes that you have saved the template to a file named `azuredeploy.json` in the current directory:
219+
220+
```azurecli-interactive
221+
az group create --name examplegroup --location "East US"
222+
az group deployment create \
223+
--name exampledeployment \
224+
--resource-group examplegroup \
225+
--template-file azuredeploy.json \
226+
--parameters workspaceName=exampleworkspace
227+
```
228+
229+
For more information, see [Deploy resources with Resource Manager templates and Azure CLI](../../azure-resource-manager/resource-group-template-deploy-cli.md) and [Deploy private Resource Manager template with SAS token and Azure CLI](../../azure-resource-manager/resource-manager-cli-sas-token.md).
230+
231+
## Next steps
232+
233+
* [Deploy resources with Resource Manager templates and Resource Manager REST API](../../azure-resource-manager/resource-group-template-deploy-rest.md).
234+
* [Creating and deploying Azure resource groups through Visual Studio](../../azure-resource-manager/vs-azure-tools-resource-groups-deployment-projects-create-deploy.md).

articles/machine-learning/service/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@
148148
- name: Export and delete data
149149
displayName: gdpr
150150
href: how-to-export-delete-data.md
151+
- name: Use a resource manager template
152+
href: how-to-create-workspace-template.md
151153
- name: Enable logging
152154
displayName: logging
153155
href: how-to-enable-logging.md

0 commit comments

Comments
 (0)