You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/machine-learning/how-to-enable-virtual-network.md
+98-29Lines changed: 98 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ ms.topic: conceptual
10
10
ms.reviewer: larryfr
11
11
ms.author: aashishb
12
12
author: aashishb
13
-
ms.date: 11/13/2019
13
+
ms.date: 01/03/2020
14
14
---
15
15
16
16
# Secure Azure ML experimentation and inference jobs within an Azure Virtual Network
@@ -40,9 +40,9 @@ This article also provides detailed information about *advanced security setting
40
40
41
41
## Use a storage account for your workspace
42
42
43
-
To use an Azure storage account for the workspace in a virtual network, do the following:
43
+
To use an Azure storage account for the workspace in a virtual network, use the following steps:
44
44
45
-
1. Create a compute resource (for example, a Machine Learning compute instance or cluster) behind a virtual network, or attach a compute resource to the workspace (for example, an HDInsight cluster, virtual machine, or Azure Kubernetes Service cluster). The compute resource can be for experimentation or model deployment.
45
+
1. Create a compute resource (for example, a Machine Learning cluster) behind a virtual network, or attach a compute resource to the workspace (for example, an HDInsight cluster, virtual machine, or Azure Kubernetes Service cluster). The compute resource can be for experimentation or model deployment.
46
46
47
47
For more information, see the [Use a Machine Learning compute](#amlcompute), [Use a virtual machine or HDInsight cluster](#vmorhdi), and [Use Azure Kubernetes Service](#aksvnet) sections in this article.
48
48
@@ -54,12 +54,12 @@ To use an Azure storage account for the workspace in a virtual network, do the f
54
54
55
55

56
56
57
-
1. On the __Firewalls and virtual networks__ page, do the following:
57
+
1. On the __Firewalls and virtual networks__ page, do the following actions:
58
58
- Select __Selected networks__.
59
59
- Under __Virtual networks__, select the __Add existing virtual network__ link. This action adds the virtual network where your compute resides (see step 1).
60
60
61
61
> [!IMPORTANT]
62
-
> The storage account must be in the same virtual network as the compute instances or clusters used for training or inference.
62
+
> The storage account must be in the same virtual network as the clusters used for training or inference.
63
63
64
64
- Select the __Allow trusted Microsoft services to access this storage account__ check box.
65
65
@@ -85,7 +85,7 @@ The key vault instance that's associated with the workspace is used by Azure Mac
85
85
* Passwords to Azure Container Repository instances
86
86
* Connection strings to data stores
87
87
88
-
To use Azure Machine Learning experimentation capabilities with Azure Key Vault behind a virtual network, do the following:
88
+
To use Azure Machine Learning experimentation capabilities with Azure Key Vault behind a virtual network, use the following steps:
89
89
1. Go to the key vault that's associated with the workspace.
90
90
91
91
[](./media/how-to-enable-virtual-network/workspace-key-vault.png#lightbox)
@@ -94,7 +94,7 @@ To use Azure Machine Learning experimentation capabilities with Azure Key Vault
94
94
95
95

96
96
97
-
1. On the __Firewalls and virtual networks__ page, do the following:
97
+
1. On the __Firewalls and virtual networks__ page, do the following actions:
98
98
- Under __Allow access from__, select __Selected networks__.
99
99
- Under __Virtual networks__, select __Add existing virtual networks__ to add the virtual network where your experimentation compute resides.
100
100
- Under __Allow trusted Microsoft services to bypass this firewall__, select __Yes__.
@@ -103,22 +103,18 @@ To use Azure Machine Learning experimentation capabilities with Azure Key Vault
103
103
104
104
<aid="amlcompute"></a>
105
105
106
-
## <aname="compute-instance"></a>Use a Machine Learning Compute
106
+
## Use a Machine Learning Compute
107
107
108
-
> [!NOTE]
109
-
> Compute instances (preview) are currently available only for workspaces with a region of **North Central US** or **UK South**, with support for other regions coming soon.
110
-
> Use one of these regions to create a compute instance that can be added to virtual network.
111
-
112
-
To use an Azure Machine Learning compute instance or compute cluster in a virtual network, the following network requirements must be met:
108
+
To use an Azure Machine Learning compute cluster in a virtual network, the following network requirements must be met:
113
109
114
110
> [!div class="checklist"]
115
111
> * The virtual network must be in the same subscription and region as the Azure Machine Learning workspace.
116
-
> * The subnet that's specified for the compute instance or cluster must have enough unassigned IP addresses to accommodate the number of VMs that are targeted. If the subnet doesn't have enough unassigned IP addresses, a compute cluster will be partially allocated.
112
+
> * The subnet that's specified for the compute cluster must have enough unassigned IP addresses to accommodate the number of VMs that are targeted. If the subnet doesn't have enough unassigned IP addresses, a compute cluster will be partially allocated.
117
113
> * Check to see whether your security policies or locks on the virtual network's subscription or resource group restrict permissions to manage the virtual network. If you plan to secure the virtual network by restricting traffic, leave some ports open for the compute service. For more information, see the [Required ports](#mlcports) section.
118
-
> * If you're going to put multiple compute instances or clusters in one virtual network, you might need to request a quota increase for one or more of your resources.
119
-
> * If the Azure Storage Account(s) for the workspace are also secured in a virtual network, they must be in the same virtual network as the Azure Machine Learning compute instance or cluster. If you are creating a compute instance in the same virtual network, you would need to detach the storage account(s) from the virtual network, create the compute instance in the virtual network, and then attach the storage account(s) back to the virtual network.
114
+
> * If you're going to put multiple compute clusters in one virtual network, you might need to request a quota increase for one or more of your resources.
115
+
> * If the Azure Storage Account(s) for the workspace are also secured in a virtual network, they must be in the same virtual network as the Azure Machine Learning compute cluster.
120
116
121
-
The Machine Learning compute instance or cluster automatically allocates additional networking resources in the resource group that contains the virtual network. For each compute instance or cluster, the service allocates the following resources:
117
+
The Machine Learning compute cluster automatically allocates additional networking resources in the resource group that contains the virtual network. For each compute cluster, the service allocates the following resources:
122
118
123
119
* One network security group
124
120
* One public IP address
@@ -141,8 +137,6 @@ Machine Learning Compute currently uses the Azure Batch service to provision VMs
141
137
142
138
- Outbound traffic on any port to the internet.
143
139
144
-
- For compute instance inbound TCP traffic on port 44224 from a __Service Tag__ of __AzureMachineLearning__.
145
-
146
140
Exercise caution if you modify or add inbound or outbound rules in Batch-configured NSGs. If an NSG blocks communication to the compute nodes, the compute service sets the state of the compute nodes to unusable.
147
141
148
142
You don't need to specify NSGs at the subnet level, because the Azure Batch service configures its own NSGs. However, if the specified subnet has associated NSGs or a firewall, configure the inbound and outbound security rules as mentioned earlier.
@@ -155,23 +149,22 @@ The NSG rule configuration in the Azure portal is shown in the following images:
155
149
156
150
### <aid="limiting-outbound-from-vnet"></a> Limit outbound connectivity from the virtual network
157
151
158
-
If you don't want to use the default outbound rules and you do want to limit the outbound access of your virtual network, do the following:
152
+
If you don't want to use the default outbound rules and you do want to limit the outbound access of your virtual network, do the following actions:
159
153
160
154
- Deny outbound internet connection by using the NSG rules.
161
155
162
-
- Limit outbound traffic to the following:
156
+
- Limit outbound traffic to the following resources:
163
157
- Azure Storage, by using __Service Tag__ of __Storage.Region_Name__ (for example, Storage.EastUS)
164
158
- Azure Container Registry, by using __Service Tag__ of __AzureContainerRegistry.Region_Name__ (for example, AzureContainerRegistry.EastUS)
165
159
- Azure Machine Learning, by using __Service Tag__ of __AzureMachineLearning__
166
-
- In case of compute instance, Azure Cloud, by using __Service Tag__ of __AzureCloud.Region_Name__ (for example, AzureCloud.NorthCentralUS)
167
160
168
161
The NSG rule configuration in the Azure portal is shown in the following image:
169
162
170
163
[](./media/how-to-enable-virtual-network/limited-outbound-nsg-exp.png#lightbox)
171
164
172
165
### User-defined routes for forced tunneling
173
166
174
-
If you're using forced tunneling with the Machine Learning Compute, add [user-defined routes (UDRs)](https://docs.microsoft.com/azure/virtual-network/virtual-networks-udr-overview) to the subnet that contains the compute resource.
167
+
If you're using forced tunneling with Machine Learning Compute, add [user-defined routes (UDRs)](https://docs.microsoft.com/azure/virtual-network/virtual-networks-udr-overview) to the subnet that contains the compute resource.
175
168
176
169
* Establish a UDR for each IP address that's used by the Azure Batch service in the region where your resources exist. These UDRs enable the Batch service to communicate with compute nodes for task scheduling. To get a list of IP addresses of the Batch service, use one of the following methods:
177
170
@@ -193,13 +186,13 @@ For more information, see [Create an Azure Batch pool in a virtual network](../b
193
186
194
187
### Create a compute cluster in a virtual network
195
188
196
-
To create a Machine Learning Compute cluster, do the following:
189
+
To create a Machine Learning Compute cluster, use the following steps:
197
190
198
191
1. In the [Azure portal](https://portal.azure.com), select your Azure Machine Learning workspace.
199
192
200
193
1. In the __Application__ section, select __Compute__, and then select __Add compute__.
201
194
202
-
1. To configure this compute resource to use a virtual network, do the following:
195
+
1. To configure this compute resource to use a virtual network, do the following actions:
203
196
204
197
a. For __Network configuration__, select __Advanced__.
205
198
@@ -267,14 +260,14 @@ For specific information on using Azure Databricks with a virtual network, see [
267
260
> [!IMPORTANT]
268
261
> Azure Machine Learning supports only virtual machines that are running Ubuntu.
269
262
270
-
To use a virtual machine or Azure HDInsight cluster in a virtual network with your workspace, do the following:
263
+
To use a virtual machine or Azure HDInsight cluster in a virtual network with your workspace, use the following steps:
271
264
272
265
1. Create a VM or HDInsight cluster by using the Azure portal or the Azure CLI, and put the cluster in an Azure virtual network. For more information, see the following articles:
273
266
*[Create and manage Azure virtual networks for Linux VMs](https://docs.microsoft.com/azure/virtual-machines/linux/tutorial-virtual-network)
274
267
275
268
*[Extend HDInsight using an Azure virtual network](https://docs.microsoft.com/azure/hdinsight/hdinsight-extend-hadoop-virtual-network)
276
269
277
-
1. To allow Azure Machine Learning to communicate with the SSH port on the VM or cluster, configure a source entry for the network security group. The SSH port is usually port 22. To allow traffic from this source, do the following:
270
+
1. To allow Azure Machine Learning to communicate with the SSH port on the VM or cluster, configure a source entry for the network security group. The SSH port is usually port 22. To allow traffic from this source, do the following actions:
278
271
279
272
* In the __Source__ drop-down list, select __Service Tag__.
280
273
@@ -302,7 +295,7 @@ To use a virtual machine or Azure HDInsight cluster in a virtual network with yo
302
295
303
296
## Use Azure Kubernetes Service (AKS)
304
297
305
-
To add AKS in a virtual network to your workspace, do the following:
298
+
To add AKS in a virtual network to your workspace, use the following steps:
306
299
307
300
> [!IMPORTANT]
308
301
> Before you begin the following procedure, follow the prerequisites in the [Configure advanced networking in Azure Kubernetes Service (AKS)](https://docs.microsoft.com/azure/aks/configure-advanced-networking#prerequisites) how-to and plan the IP addressing for your cluster.
@@ -317,7 +310,7 @@ To add AKS in a virtual network to your workspace, do the following:
317
310
318
311
1. In the __Application__ section, select __Compute__, and then select __Add compute__.
319
312
320
-
1. To configure this compute resource to use a virtual network, do the following:
313
+
1. To configure this compute resource to use a virtual network, do the following actions:
321
314
322
315
- For __Network configuration__, select __Advanced__.
When the creation process is completed, you can run inference, or model scoring, on an AKS cluster behind a virtual network. For more information, see [How to deploy to AKS](how-to-deploy-and-where.md).
365
358
359
+
### Use private IPs with Azure Kubernetes Service
360
+
361
+
By default, a public IP address is assigned to AKS deployments. When using AKS inside a virtual network, you can use a private IP address instead. Private IP addresses are only accessible from inside the virtual network or joined networks.
362
+
363
+
A private IP address is enabled by configuring AKS to use an _internal load balancer_.
364
+
365
+
> [!IMPORTANT]
366
+
> You cannot enable private IP when creating the Azure Kubernetes Service cluster. It must be enabled as an update to an existing cluster.
367
+
368
+
The following code snippet demonstrates how to **create a new AKS cluster**, and then update it to use a private IP/internal load balancer
369
+
370
+
```python
371
+
import azureml.core
372
+
from azureml.core.compute import AksCompute, ComputeTarget
az rest --method put --uri https://management.azure.com"/subscriptions/<subscription-id>/resourcegroups/<resource-group>/providers/Microsoft.ContainerService/managedClusters/<aks-resource-id>?api-version=2018-11-19 --body @body.json
409
+
```
410
+
411
+
The contents of the `body.json` file referenced by the command are similar to the following JSON document:
> Currently, you cannot configure the load balancer when performing an __attach__ operation on an existing cluster. You must first attach the cluster, and then perform an update operation to change the load balancer.
432
+
433
+
For more information on using the internal load balancer with AKS, see [Use internal load balancer with Azure Kubernetes Service](/azure/aks/internal-lb).
434
+
366
435
## Use Azure Firewall
367
436
368
437
When using Azure Firewall, you must configure a network rule to allow traffic to and from the following addresses:
0 commit comments