Skip to content

Commit b39b6f3

Browse files
committed
Pivots
1 parent 85dc857 commit b39b6f3

File tree

2 files changed

+68
-37
lines changed

2 files changed

+68
-37
lines changed

articles/machine-learning/how-to-managed-network.md

Lines changed: 56 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ms.author: larryfr
1010
author: Blackmist
1111
ms.date: 02/27/2025
1212
ms.topic: how-to
13+
zone_pivot_groups: azureml-portal-cli-python
1314
ms.custom:
1415
- build-2023
1516
- devx-track-azurecli
@@ -88,7 +89,7 @@ If you add the following services to the virtual network by using either a servi
8889

8990
Before following the steps in this article, make sure you have the following prerequisites:
9091

91-
# [Azure CLI](#tab/azure-cli)
92+
::: zone pivot="cli"
9293

9394
* An Azure subscription. If you don't have an Azure subscription, create a free account before you begin. Try the [free or paid version of Azure Machine Learning](https://azure.microsoft.com/free/).
9495

@@ -114,7 +115,8 @@ Before following the steps in this article, make sure you have the following pre
114115
115116
* The Azure CLI examples in this article use `ws` to represent the name of the workspace, and `rg` to represent the name of the resource group. Change these values as needed when using the commands with your Azure subscription.
116117
117-
# [Python SDK](#tab/python)
118+
::: zone-end
119+
::: zone pivot="python-sdk"
118120
119121
* An Azure subscription. If you don't have an Azure subscription, create a free account before you begin. Try the [free or paid version of Azure Machine Learning](https://azure.microsoft.com/free/).
120122
@@ -158,7 +160,8 @@ Before following the steps in this article, make sure you have the following pre
158160
ml_client = MLClient(DefaultAzureCredential(), subscription_id=subscription_id, resource_group_name=resource_group)
159161
```
160162
161-
# [Azure portal](#tab/portal)
163+
::: zone-end
164+
::: zone pivot="azure-portal"
162165
163166
* An Azure subscription. If you don't have an Azure subscription, create a free account before you begin. Try the [free or paid version of Azure Machine Learning](https://azure.microsoft.com/free/).
164167
@@ -171,7 +174,7 @@ Before following the steps in this article, make sure you have the following pre
171174
* `Microsoft.MachineLearningServices/workspaces/privateEndpointConnections/read`
172175
* `Microsoft.MachineLearningServices/workspaces/privateEndpointConnections/write`
173176
174-
---
177+
::: zone-end
175178
176179
To establish private endpoint connections in managed virtual networks using Azure Machine Learning, the workspace managed identity, whether system-assigned or user-assigned, must have permissions to approve the Private Endpoint connections on the target resources. After April 30th, 2025, permissions aren't automatically granted to the managed identity and must be assigned manually.
177180
@@ -209,7 +212,7 @@ For creating Private Endpoint outbound rules to default workspace resources, the
209212
> [!IMPORTANT]
210213
> __If you plan to submit serverless Spark jobs__, you must manually start provisioning. For more information, see the [configure for serverless Spark jobs](#configure-for-serverless-spark-jobs) section.
211214
212-
# [Azure CLI](#tab/azure-cli)
215+
::: zone pivot="cli"
213216
214217
To configure a managed virtual network that allows internet outbound communications, you can use either the `--managed-network allow_internet_outbound` parameter or a YAML configuration file that contains the following entries:
215218
@@ -288,7 +291,8 @@ You can configure a managed virtual network using either the `az ml workspace cr
288291
type: private_endpoint
289292
```
290293

291-
# [Python SDK](#tab/python)
294+
::: zone-end
295+
::: zone pivot="python-sdk"
292296

293297
To configure a managed virtual network that allows internet outbound communications, use the `ManagedNetwork` class to define a network with `IsolationMode.ALLOW_INTERNET_OUTBOUND`. You can then use the `ManagedNetwork` object to create a new workspace or update an existing one. To define _outbound rules_ to Azure services that the workspace relies on, use the `PrivateEndpointDestination` class to define a new private endpoint to the service.
294298

@@ -355,7 +359,8 @@ To configure a managed virtual network that allows internet outbound communicati
355359
ml_client.workspaces.begin_update(ws)
356360
```
357361

358-
# [Azure portal](#tab/portal)
362+
::: zone-end
363+
::: zone pivot="azure-portal"
359364

360365
* __Create a new workspace__:
361366

@@ -401,7 +406,7 @@ To configure a managed virtual network that allows internet outbound communicati
401406

402407
1. Select __Save__ at the top of the page to save the changes to the managed virtual network.
403408

404-
---
409+
::: zone-end
405410

406411
## Configure a managed virtual network to allow only approved outbound
407412

@@ -411,7 +416,7 @@ To configure a managed virtual network that allows internet outbound communicati
411416
> [!IMPORTANT]
412417
> __If you plan to submit serverless Spark jobs__, you must manually start provisioning. For more information, see the [configure for serverless Spark jobs](#configure-for-serverless-spark-jobs) section.
413418

414-
# [Azure CLI](#tab/azure-cli)
419+
::: zone pivot="cli"
415420

416421
To configure a managed virtual network that allows only approved outbound communications, you can use either the `--managed-network allow_only_approved_outbound` parameter or a YAML configuration file that contains the following entries:
417422

@@ -512,7 +517,8 @@ You can configure a managed virtual network using either the `az ml workspace cr
512517
type: private_endpoint
513518
```
514519

515-
# [Python SDK](#tab/python)
520+
::: zone-end
521+
::: zone pivot="python-sdk"
516522

517523
To configure a managed virtual network that allows only approved outbound communications, use the `ManagedNetwork` class to define a network with `IsolationMode.ALLOw_ONLY_APPROVED_OUTBOUND`. You can then use the `ManagedNetwork` object to create a new workspace or update an existing one. To define _outbound rules_, use the following classes:
518524

@@ -654,7 +660,8 @@ To configure a managed virtual network that allows only approved outbound commun
654660
ml_client.workspaces.begin_update(ws)
655661
```
656662

657-
# [Azure portal](#tab/portal)
663+
::: zone-end
664+
::: zone pivot="azure-portal"
658665

659666
* __Create a new workspace__:
660667

@@ -721,7 +728,7 @@ To configure a managed virtual network that allows only approved outbound commun
721728

722729
1. Select __Save__ at the top of the page to save the changes to the managed virtual network.
723730

724-
---
731+
::: zone-end
725732

726733

727734
## Configure for serverless Spark jobs
@@ -736,7 +743,7 @@ To enable the [serverless Spark jobs](how-to-submit-spark-jobs.md) for the manag
736743

737744
1. Configure an outbound private endpoint.
738745

739-
# [Azure CLI](#tab/azure-cli)
746+
::: zone pivot="cli"
740747

741748
Use a YAML file to define the managed virtual network configuration and add a private endpoint for the Azure Storage Account. Also set `spark_enabled: true`:
742749

@@ -765,7 +772,8 @@ To enable the [serverless Spark jobs](how-to-submit-spark-jobs.md) for the manag
765772
> [!NOTE]
766773
> When **Allow Only Approved Outbound** is enabled (`isolation_mode: allow_only_approved_outbound`), conda package dependencies defined in Spark session configuration fails to install. To resolve this problem, upload a self-contained Python package wheel with no external dependencies to an Azure storage account and create private endpoint to this storage account. Use the path to Python package wheel as `py_files` parameter in your Spark job. Setting an FQDN outbound rule won't bypass this issue as FQDN rule propagation isn't supported by Spark.
767774

768-
# [Python SDK](#tab/python)
775+
::: zone-end
776+
::: zone pivot="python-sdk"
769777

770778
The following example demonstrates how to create a managed virtual network for an existing Azure Machine Learning workspace named `myworkspace`. It also adds a private endpoint for the Azure Storage Account and sets `spark_enabled=true`:
771779

@@ -801,7 +809,8 @@ To enable the [serverless Spark jobs](how-to-submit-spark-jobs.md) for the manag
801809
> - If the workspace was created with `IsolationMode.ALLOW_INTERNET_OUTBOUND`, it can’t be updated later to use `IsolationMode.ALLOW_ONLY_APPROVED_OUTBOUND`.
802810

803811

804-
# [Azure portal](#tab/portal)
812+
::: zone-end
813+
::: zone pivot="azure-portal"
805814

806815
1. Sign in to the [Azure portal](https://portal.azure.com), and select the Azure Machine Learning workspace.
807816
2. Select __Networking__, then select __Add user-defined outbound rules__. Add a rule for the Azure Storage Account, and make sure that __Spark enabled__ is selected.
@@ -810,22 +819,23 @@ To enable the [serverless Spark jobs](how-to-submit-spark-jobs.md) for the manag
810819

811820
3. Select __Save__ to save the rule, then select __Save__ from the top of __Networking__ to save the changes to the manged virtual network.
812821

813-
---
822+
::: zone-end
814823

815824
2. Provision the managed virtual network.
816825

817826
> [!NOTE]
818827
> If your workspace has [public network access enabled](/azure/machine-learning/how-to-configure-private-link#enable-public-access), you must disable it before provisioning the managed VNet. If you don't disable public network access when provisioning the managed VNet, the private endpoints for the workspace might not be created automatically in the managed VNet. Otherwise, you would have to manually configure the private endpoint outbound rule for the workspace after the provisioning.
819828

820-
# [Azure CLI](#tab/azure-cli)
829+
::: zone pivot="cli"
821830

822831
The following example shows how to provision a managed virtual network for serverless Spark jobs by using the `--include-spark` parameter.
823832

824833
```azurecli
825834
az ml workspace provision-network -g my_resource_group -n my_workspace_name --include-spark
826835
```
827836

828-
# [Python SDK](#tab/python)
837+
::: zone-end
838+
::: zone pivot="python-sdk"
829839

830840
The following example shows how to provision a managed virtual network for serverless Spark jobs:
831841

@@ -839,11 +849,12 @@ To enable the [serverless Spark jobs](how-to-submit-spark-jobs.md) for the manag
839849
provision_network_result = ml_client.workspaces.begin_provision_network(workspace_name=ws_name, include_spark=include_spark).result()
840850
```
841851

842-
# [Azure portal](#tab/portal)
852+
::: zone-end
853+
::: zone pivot="azure-portal"
843854

844855
Use the __Azure CLI__ or __Python SDK__ tabs to learn how to manually provision the managed virtual network with serverless Spark support.
845856

846-
---
857+
::: zone-end
847858

848859
## Manually provision a managed VNet
849860

@@ -856,7 +867,7 @@ Alternatively, you can use the `provision_network_now` flag to provision the man
856867
> [!NOTE]
857868
> To create an online deployment, you must manually provision the managed network, or create a compute instance first which will automatically provision it.
858869

859-
# [Azure CLI](#tab/azure-cli)
870+
::: zone pivot="cli"
860871

861872
The following example shows how to provision a managed virtual network during workspace creation.
862873

@@ -879,7 +890,8 @@ To verify that the provisioning completed, use the following command:
879890
az ml workspace show -n my_workspace_name -g my_resource_group --query managed_network
880891
```
881892

882-
# [Python SDK](#tab/python)
893+
::: zone-end
894+
::: zone pivot="python-sdk"
883895

884896
To provision the managed network during workspace creation, set the `provision_network_now` flag to `True`.
885897

@@ -906,11 +918,12 @@ ws = ml_client.workspaces.get()
906918
print(ws.managed_network.status)
907919
```
908920

909-
# [Azure portal](#tab/portal)
921+
::: zone-end
922+
::: zone pivot="azure-portal"
910923

911924
During workspace creation, select __Provision managed network proactively at creation__ to provision the managed network. Charges are incurred from network resources, such as private endpoints, once the virtual network is provisioned. This configuration option is only available during workspace creation.
912925

913-
---
926+
::: zone-end
914927

915928
## Configure image builds
916929

@@ -919,15 +932,16 @@ When the Azure Container Registry for your workspace is behind a virtual network
919932
> [!IMPORTANT]
920933
> The compute resource used to build Docker images needs to be able to access the package repositories that are used to train and deploy your models. If you're using a network configured to allow only approved outbound, you might need to add [rules that allow access to public repos](#scenario-access-public-machine-learning-packages) or [use private Python packages](concept-vulnerability-management.md#using-a-private-package-repository).
921934

922-
# [Azure CLI](#tab/azure-cli)
935+
::: zone pivot="cli"
923936

924937
To update a workspace to use a compute cluster or compute instance to build Docker images, use the `az ml workspace update` command with the `--image-build-compute` parameter:
925938

926939
```azurecli
927940
az ml workspace update --name ws --resource-group rg --image-build-compute mycompute
928941
```
929942

930-
# [Python SDK](#tab/python)
943+
::: zone-end
944+
::: zone pivot="python-sdk"
931945

932946
The following example demonstrates how to update a workspace to use a compute cluster to build images:
933947

@@ -954,15 +968,16 @@ ml_client.workspaces.begin_update(ws)
954968
# ml_client.workspaces.begin_update(ws)
955969
```
956970

957-
# [Azure portal](#tab/portal)
971+
::: zone-end
972+
::: zone pivot="azure-portal"
958973

959974
Currently there isn't a way to set the image build compute from the Azure portal. Use the __Azure CLI__ or __Python SDK__ tabs to learn how to manually configure image builds.
960975

961-
---
976+
::: zone-end
962977

963978
## Manage outbound rules
964979

965-
# [Azure CLI](#tab/azure-cli)
980+
::: zone pivot="cli"
966981

967982
To list the managed virtual network outbound rules for a workspace, use the following command:
968983

@@ -982,7 +997,8 @@ To remove an outbound rule from the managed virtual network, use the following c
982997
az ml workspace outbound-rule remove --rule rule-name --workspace-name ws --resource-group rg
983998
```
984999

985-
# [Python SDK](#tab/python)
1000+
::: zone-end
1001+
::: zone pivot="python-sdk"
9861002

9871003
The following example demonstrates how to manage outbound rules for a workspace named `myworkspace`:
9881004

@@ -1003,7 +1019,8 @@ rule_list = ml_client._workspace_outbound_rules.list(resource_group, ws_name)
10031019
ml_client._workspace_outbound_rules.begin_remove(resource_group, ws_name, rule_name).result()
10041020
```
10051021

1006-
# [Azure portal](#tab/portal)
1022+
:::: zone-end
1023+
::: zone pivot="azure-portal"
10071024

10081025
1. Sign in to the [Azure portal](https://portal.azure.com), and select the Azure Machine Learning workspace that you want to enable managed virtual network isolation for.
10091026
1. Select __Networking__. The __Workspace Outbound access__ section allows you to manage outbound rules.
@@ -1016,7 +1033,7 @@ ml_client._workspace_outbound_rules.begin_remove(resource_group, ws_name, rule_n
10161033

10171034
* To __delete__ an outbound rule, select __delete__ for the rule.
10181035

1019-
---
1036+
::: zone-end
10201037

10211038
## List of required rules
10221039

@@ -1177,11 +1194,12 @@ An Azure Firewall is deployed if an FQDN outbound rule is created while in the _
11771194

11781195
Use the following tabs to learn how to select the firewall version for your managed virtual network.
11791196

1180-
# [Azure portal](#tab/portal)
1197+
::: zone pivot="azure-portal"
11811198

11821199
After selecting the allow only approved outbound mode, an option to select the Azure Firewall version (SKU) appears. Select __Standard__ to use the standard version or __Basic__ to use the basic version. Select __Save__ to save your configuration.
11831200

1184-
# [Azure CLI](#tab/azure-cli)
1201+
::: zone-end
1202+
::: zone pivot="cli"
11851203

11861204
To configure the firewall version from the CLI, use a YAML file and specify the `firewall_sku`. The following example demonstrates a YAML file that sets the firewall SKU to `basic`:
11871205

@@ -1200,15 +1218,17 @@ managed_network:
12001218
tags: {}
12011219
```
12021220

1203-
# [Python SDK](#tab/python)
1221+
::: zone-end
1222+
::: zone pivot="python-sdk"
12041223

12051224
To configure the firewall version from the Python SDK, set the `firewall_sku` property of the `ManagedNetwork` object. The following example demonstrates how to set the firewall SKU to `basic`:
12061225

12071226
```python
12081227
network = ManagedNetwork(isolation_mode=IsolationMode.ALLOW_INTERNET_OUTBOUND,
12091228
firewall_sku='basic')
12101229
```
1211-
---
1230+
1231+
::: zone-end
12121232

12131233
## Pricing
12141234

zone-pivots/zone-pivot-groups.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,4 +1159,15 @@ groups:
11591159
- id: azure-portal
11601160
title: Azure portal
11611161
- id: cli
1162-
title: Azure CLI
1162+
title: Azure CLI
1163+
- id: azureml-portal-cli-python
1164+
# Owner: Larryfr
1165+
title: Azure Portal, CLI, and python
1166+
prompt: Choose a usage method
1167+
pivots:
1168+
- id: cli
1169+
title: Azure CLI
1170+
- id: python-sdk
1171+
title: Python SDK
1172+
- id: azure-portal
1173+
title: Azure portal

0 commit comments

Comments
 (0)