Skip to content

Commit 5d13db2

Browse files
authored
Merge pull request #188479 from Blackmist/1917584-cli-network
adding cli v2 info
2 parents 845a326 + 6593fa3 commit 5d13db2

File tree

1 file changed

+55
-16
lines changed

1 file changed

+55
-16
lines changed

articles/machine-learning/how-to-secure-workspace-vnet.md

Lines changed: 55 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ In this article you learn how to enable the following workspaces resources in a
7575

7676
### Azure Container Registry
7777

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.
7979

8080
> [!IMPORTANT]
8181
> 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
110110
# [Private endpoint](#tab/pe)
111111

112112
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:
114114

115115
* **Blob**
116116
* **File**
@@ -122,7 +122,7 @@ Azure Machine Learning supports storage accounts configured to use either a priv
122122
> [!TIP]
123123
> 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.
124124
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.
126126
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).
127127

128128
> [!TIP]
@@ -203,29 +203,65 @@ Azure Container Registry can be configured to use a private endpoint. Use the fo
203203

204204
1. Find the name of the Azure Container Registry for your workspace, using one of the following methods:
205205

206-
__Azure portal__
206+
# [Azure CLI](#tab/cli)
207207

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.
209209

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+
```
211213
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.
213215
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)
215217
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'])
218228
```
219229
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+
---
221239
222240
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.
223241
224242
1. Configure the ACR for the workspace to [Allow access by trusted services](../container-registry/allow-access-trusted-services.md).
225243
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)
227252
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:
229265
230266
```python
231267
from azureml.core import Workspace
@@ -236,12 +272,15 @@ Azure Container Registry can be configured to use a private endpoint. Use the fo
236272
# To switch back to using ACR to build (if ACR is not in the VNet):
237273
# ws.update(image_build_compute = '')
238274
```
239-
240-
> [!IMPORTANT]
241-
> Only AzureML Compute cluster of CPU SKU is supported for the image build on compute.
242275
243276
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.
244277
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+
245284
> [!TIP]
246285
> 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.
247286

0 commit comments

Comments
 (0)