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-secure-workspace-vnet.md
+55-16Lines changed: 55 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,7 +75,7 @@ In this article you learn how to enable the following workspaces resources in a
75
75
76
76
### Azure Container Registry
77
77
78
-
When ACR is behind a virtual network, Azure Machine Learning cannot use it to directly build Docker images. Instead, the compute cluster is used to build the images.
78
+
When ACR is behind a virtual network, Azure Machine Learning can’t use it to directly build Docker images. Instead, the compute cluster is used to build the images.
79
79
80
80
> [!IMPORTANT]
81
81
> The compute cluster used to build Docker images needs to be able to access the package repositories that are used to train and deploy your models. You may need to add network security rules that allow access to public repos, [use private Python packages](how-to-use-private-python-packages.md), or use [custom Docker images](how-to-train-with-custom-image.md) that already include the packages.
@@ -110,7 +110,7 @@ Azure Machine Learning supports storage accounts configured to use either a priv
110
110
# [Private endpoint](#tab/pe)
111
111
112
112
1. In the Azure portal, select the Azure Storage Account.
113
-
1. Use the information in [Use private endpoints for Azure Storage](../storage/common/storage-private-endpoints.md#creating-a-private-endpoint) to add private endpoints for the following storage sub-resources:
113
+
1. Use the information in [Use private endpoints for Azure Storage](../storage/common/storage-private-endpoints.md#creating-a-private-endpoint) to add private endpoints for the following storage resources:
114
114
115
115
***Blob**
116
116
***File**
@@ -122,7 +122,7 @@ Azure Machine Learning supports storage accounts configured to use either a priv
122
122
> [!TIP]
123
123
> When configuring a storage account that is **not** the default storage, select the **Target subresource** type that corresponds to the storage account you want to add.
124
124
125
-
1. After creating the private endpoints for thee sub-resources, select the __Firewalls and virtual networks__ tab under __Networking__ for the storage account.
125
+
1. After creating the private endpoints for the storage resources, select the __Firewalls and virtual networks__ tab under __Networking__ for the storage account.
126
126
1. Select __Selected networks__, and then under __Resource instances__, select `Microsoft.MachineLearningServices/Workspace` as the __Resource type__. Select your workspace using __Instance name__. For more information, see [Trusted access based on system-assigned managed identity](../storage/common/storage-network-security.md#trusted-access-based-on-system-assigned-managed-identity).
127
127
128
128
> [!TIP]
@@ -203,29 +203,65 @@ Azure Container Registry can be configured to use a private endpoint. Use the fo
203
203
204
204
1. Find the name of the Azure Container Registry for your workspace, using one of the following methods:
205
205
206
-
__Azure portal__
206
+
# [Azure CLI](#tab/cli)
207
207
208
-
From the overview section of your workspace, the __Registry__ value links to the Azure Container Registry.
208
+
If you've [installed the Machine Learning extension v2 for Azure CLI](how-to-configure-cli.md), you can use the `az ml workspace show` command to show the workspace information.
209
209
210
-
:::image type="content" source="./media/how-to-enable-virtual-network/azure-machine-learning-container-registry.png" alt-text="Azure Container Registry for the workspace" border="true":::
210
+
```azurecli-interactive
211
+
az ml workspace show -w yourworkspacename -g resourcegroupname --query 'container_registry'
212
+
```
211
213
212
-
__Azure CLI__
214
+
This command returns a value similar to `"/subscriptions/{GUID}/resourceGroups/{resourcegroupname}/providers/Microsoft.ContainerRegistry/registries/{ACRname}"`. The last part of the string is the name of the Azure Container Registry for the workspace.
213
215
214
-
If you have [installed the Machine Learning extension for Azure CLI](reference-azure-machine-learning-cli.md), you can use the `az ml workspace show` command to show the workspace information.
216
+
# [Python SDK](#tab/python)
215
217
216
-
```azurecli-interactive
217
-
az ml workspace show -w yourworkspacename -g resourcegroupname --query 'containerRegistry'
218
+
The following code snippet demonstrates how to get the container registry information using the [Azure Machine Learning SDK](/python/api/overview/azure/ml/):
219
+
220
+
```python
221
+
from azureml.core import Workspace
222
+
# Load workspace from an existing config file
223
+
ws = Workspace.from_config()
224
+
# Get details on the workspace
225
+
details = ws.get_details()
226
+
# Print container registry information
227
+
print(details['containerRegistry'])
218
228
```
219
229
220
-
This command returns a value similar to `"/subscriptions/{GUID}/resourceGroups/{resourcegroupname}/providers/Microsoft.ContainerRegistry/registries/{ACRname}"`. The last part of the string is the name of the Azure Container Registry for the workspace.
230
+
This code returns a value similar to `"/subscriptions/{GUID}/resourceGroups/{resourcegroupname}/providers/Microsoft.ContainerRegistry/registries/{ACRname}"`. The last part of the string is the name of the Azure Container Registry for the workspace.
231
+
232
+
# [Azure portal](#tab/portal)
233
+
234
+
From the overview section of your workspace, the __Registry__ value links to the Azure Container Registry.
235
+
236
+
:::image type="content" source="./media/how-to-enable-virtual-network/azure-machine-learning-container-registry.png" alt-text="Azure Container Registry for the workspace" border="true":::
237
+
238
+
---
221
239
222
240
1. Limit access to your virtual network using the steps in [Connect privately to an Azure Container Registry](../container-registry/container-registry-private-link.md). When adding the virtual network, select the virtual network and subnet for your Azure Machine Learning resources.
223
241
224
242
1. Configure the ACR for the workspace to [Allow access by trusted services](../container-registry/allow-access-trusted-services.md).
225
243
226
-
1. Create an Azure Machine Learning compute cluster. This is used to build Docker images when ACR is behind a VNet. For more information, see [Create a compute cluster](how-to-create-attach-compute-cluster.md).
244
+
1. Create an Azure Machine Learning compute cluster. This cluster is used to build Docker images when ACR is behind a VNet. For more information, see [Create a compute cluster](how-to-create-attach-compute-cluster.md).
245
+
246
+
1. Use one of the following methods to configure the workspace to build Docker images using the compute cluster.
247
+
248
+
> [!IMPORTANT]
249
+
> When using a compute cluster for image builds, only a CPU SKU is supported.
250
+
251
+
# [Azure CLI](#tab/cli)
227
252
228
-
1. Use the Azure Machine Learning Python SDK to configure the workspace to build Docker images using the compute cluster. The following code snippet demonstrates how to update the workspace to set a build compute. Replace `mycomputecluster` with the name of the cluster to use:
253
+
If you've [installed the Machine Learning extension v2 for Azure CLI](how-to-configure-cli.md), you can use the `az ml workspace update` command to set a build compute. In the following command, replace `myworkspace` with your workspace name, `myresourcegroup` with the resource group that contains the workspace, and `mycomputecluster` with the compute cluster name:
254
+
255
+
```azurecli
256
+
az ml workspace update \
257
+
-n myworkspace \
258
+
-g myresourcegroup \
259
+
-i mycomputecluster
260
+
```
261
+
262
+
# [Python SDK](#tab/python)
263
+
264
+
The following code snippet demonstrates how to update the workspace to set a build compute using the [Azure Machine Learning SDK](/python/api/overview/azure/ml/). Replace `mycomputecluster` with the name of the cluster to use:
229
265
230
266
```python
231
267
from azureml.core import Workspace
@@ -236,12 +272,15 @@ Azure Container Registry can be configured to use a private endpoint. Use the fo
236
272
# To switch back to using ACR to build (if ACR is not in the VNet):
237
273
# ws.update(image_build_compute = '')
238
274
```
239
-
240
-
> [!IMPORTANT]
241
-
> Only AzureML Compute cluster of CPU SKU is supported for the image build on compute.
242
275
243
276
For more information, see the [update()](/python/api/azureml-core/azureml.core.workspace.workspace#update-friendly-name-none--description-none--tags-none--image-build-compute-none--enable-data-actions-none-) method reference.
244
277
278
+
# [Azure portal](#tab/portal)
279
+
280
+
Currently there isn't a way to set the image build compute from the Azure portal.
281
+
282
+
---
283
+
245
284
> [!TIP]
246
285
> When ACR is behind a VNet, you can also [disable public access](../container-registry/container-registry-access-selected-networks.md#disable-public-network-access) to it.
0 commit comments