Skip to content

Commit 51af449

Browse files
Merge pull request #111532 from joshharrin/joharrington/managednetworkdocupdates
Update how-to-managed-network.md following bugbash and improvements
2 parents bf32e7d + 67ea1af commit 51af449

File tree

1 file changed

+34
-27
lines changed

1 file changed

+34
-27
lines changed

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

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Azure Machine Learning provides preview support for managed virtual network (VNe
2525

2626
When you enable managed virtual network isolation, a managed VNet is created for the workspace. Managed compute resources (compute clusters and compute instances) for the workspace automatically use this managed VNet. The managed VNet can use private endpoints for Azure resources that are used by your workspace, such as Azure Storage, Azure Key Vault, and Azure Container Registry.
2727

28-
The following diagram shows a managed virtual network uses private endpoints to communicate with the storage, key vault, and container registry used by the workspace.
28+
The following diagram shows how a managed virtual network uses private endpoints to communicate with the storage, key vault, and container registry used by the workspace.
2929

3030
:::image type="content" source="./media/how-to-managed-network/managed-virtual-network-architecture.png" alt-text="Diagram of managed virtual network isolation.":::
3131

@@ -37,7 +37,7 @@ There are two different configuration modes for outbound traffic from the manage
3737
| Outbound mode | Description | Scenarios |
3838
| ----- | ----- | ----- |
3939
| Allow internet outbound | Allow all internet outbound traffic from the managed VNet. | Recommended if you need access to machine learning artifacts on the Internet, such as python packages or pretrained models. |
40-
| Allow only approved outbound | Outbound traffic is allowed by specifying service tags. | Recommended if you want to minimize the risk of data exfiltration but you need to prepare all required machine learning artifacts in your private locations. |
40+
| Allow only approved outbound | Outbound traffic is allowed by specifying service tags. | Recommended if you want to minimize the risk of data exfiltration but you will need to prepare all required machine learning artifacts in your private locations. |
4141

4242
The managed virtual network is preconfigured with [required default rules](#list-of-required-rules). It's also configured for private endpoint connections to your workspace default storage, container registry and key vault if they're configured as private. After choosing the isolation mode, you only need to consider other outbound requirements you may need to add.
4343

@@ -87,14 +87,21 @@ Before following the steps in this article, make sure you have the following pre
8787
8888
```python
8989
from azure.ai.ml import MLClient
90-
from azure.ai.ml.entities import Workspace, ManagedNetwork
91-
from azure.ai.ml.constants._workspace import IsolationMode
90+
from azure.ai.ml.entities import (
91+
Workspace,
92+
ManagedNetwork,
93+
IsolationMode,
94+
ServiceTagDestination,
95+
PrivateEndpointDestination
96+
)
9297
from azure.identity import DefaultAzureCredential
93-
from azure.ai.ml.entities import ServiceTagDestination, PrivateEndpointDestination
9498
9599
# Replace with the values for your Azure subscription and resource group.
96100
subscription_id = "<SUBSCRIPTION_ID>"
97101
resource_group = "<RESOURCE_GROUP>"
102+
103+
# get a handle to the subscription
104+
ml_client = MLClient(DefaultAzureCredential(), subscription_id, resource_group)
98105
```
99106
100107
# [Azure portal](#tab/portal)
@@ -125,7 +132,7 @@ managed_network:
125132
outbound_rules:
126133
- name: added-perule
127134
destination:
128-
service_resource_id: /subscriptions/{subscription ID}/resourceGroups/{resource group name}/providers/Microsoft.Storage/storageAccounts/{storage account name}
135+
service_resource_id: /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Storage/storageAccounts/<STORAGE_ACCOUNT_NAME>
129136
spark_enabled: true
130137
subresource_target: blob
131138
type: private_endpoint
@@ -185,7 +192,7 @@ You can configure a managed VNet using either the `az ml workspace create` or `a
185192
outbound_rules:
186193
- name: added-perule
187194
destination:
188-
service_resource_id: /subscriptions/{subscription ID}/resourceGroups/{resource group name}/providers/Microsoft.Storage/storageAccounts/{storage account name}
195+
service_resource_id: /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Storage/storageAccounts/<STORAGE_ACCOUNT_NAME>
189196
spark_enabled: true
190197
subresource_target: blob
191198
type: private_endpoint
@@ -203,9 +210,6 @@ To configure a managed VNet that allows internet outbound communications, use th
203210
The following example creates a new workspace named `myworkspace`, with an outbound rule named `myrule` that adds a private endpoint for an Azure Blob store:
204211

205212
```python
206-
# get a handle to the subscription
207-
ml_client = MLClient(DefaultAzureCredential(), subscription_id, resource_group)
208-
209213
# Basic managed network configuration
210214
network = ManagedNetwork(IsolationMode.ALLOW_INTERNET_OUTBOUND)
211215
@@ -218,9 +222,9 @@ To configure a managed VNet that allows internet outbound communications, use th
218222
219223
# Example private endpoint outbound to a blob
220224
rule_name = "myrule"
221-
service_resource_id = "/subscriptions/{subscription ID}/resourceGroups/{resource group name}/providers/Microsoft.Storage/storageAccounts/{storage account name}"
225+
service_resource_id = "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Storage/storageAccounts/<STORAGE_ACCOUNT_NAME>"
222226
subresource_target = "blob"
223-
spark_enabled = true
227+
spark_enabled = True
224228
225229
# Add the outbound
226230
ws.managed_network.outbound_rules = [PrivateEndpointDestination(
@@ -250,9 +254,9 @@ To configure a managed VNet that allows internet outbound communications, use th
250254
251255
# Example private endpoint outbound to a blob
252256
rule_name = "myrule"
253-
service_resource_id = "/subscriptions/{subscription ID}/resourceGroups/{resource group name}/providers/Microsoft.Storage/storageAccounts/{storage account name}"
257+
service_resource_id = "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Storage/storageAccounts/<STORAGE_ACCOUNT_NAME>"
254258
subresource_target = "blob"
255-
spark_enabled = true
259+
spark_enabled = True
256260
257261
# Add the outbound
258262
ws.managed_network.outbound_rules = [PrivateEndpointDestination(
@@ -320,7 +324,7 @@ managed_network:
320324
type: service_tag
321325
- name: added-perule
322326
destination:
323-
service_resource_id: /subscriptions/{subscription ID}/resourceGroups/{resource group name}/providers/Microsoft.Storage/storageAccounts/{storage account name}
327+
service_resource_id: /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Storage/storageAccounts/<STORAGE_ACCOUNT_NAME>
324328
spark_enabled: true
325329
subresource_target: blob
326330
type: private_endpoint
@@ -380,7 +384,7 @@ You can configure a managed VNet using either the `az ml workspace create` or `a
380384
type: service_tag
381385
- name: added-perule
382386
destination:
383-
service_resource_id: /subscriptions/{subscription ID}/resourceGroups/{resource group name}/providers/Microsoft.Storage/storageAccounts/{storage account name}
387+
service_resource_id: /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Storage/storageAccounts/<STORAGE_ACCOUNT_NAME>
384388
spark_enabled: true
385389
subresource_target: blob
386390
type: private_endpoint
@@ -418,9 +422,9 @@ To configure a managed VNet that allows only approved outbound communications, u
418422
ws.managed_network.outbound_rules = []
419423
# Example private endpoint outbound to a blob
420424
rule_name = "myrule"
421-
service_resource_id = "/subscriptions/{subscription ID}/resourceGroups/{resource group name}/providers/Microsoft.Storage/storageAccounts/{storage account name}"
425+
service_resource_id = "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Storage/storageAccounts/<STORAGE_ACCOUNT_NAME>"
422426
subresource_target = "blob"
423-
spark_enabled = true
427+
spark_enabled = True
424428
ws.managed_network.outbound_rules.append(
425429
PrivateEndpointDestination(
426430
name=rule_name,
@@ -473,9 +477,9 @@ To configure a managed VNet that allows only approved outbound communications, u
473477
ws.managed_network.outbound_rules = []
474478
# Example private endpoint outbound to a blob
475479
rule_name = "myrule"
476-
service_resource_id = "/subscriptions/{subscription ID}/resourceGroups/{resource group name}/providers/Microsoft.Storage/storageAccounts/{storage account name}"
480+
service_resource_id = "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Storage/storageAccounts/<STORAGE_ACCOUNT_NAME>"
477481
subresource_target = "blob"
478-
spark_enabled = true
482+
spark_enabled = True
479483
ws.managed_network.outbound_rules.append(
480484
PrivateEndpointDestination(
481485
name=rule_name,
@@ -554,7 +558,7 @@ To enable the [serverless spark jobs](how-to-submit-spark-jobs.md) for the manag
554558
outbound_rules:
555559
- name: added-perule
556560
destination:
557-
service_resource_id: /subscriptions/{subscription ID}/resourceGroups/{resource group name}/providers/Microsoft.Storage/storageAccounts/{storage account name}
561+
service_resource_id: /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Storage/storageAccounts/<STORAGE_ACCOUNT_NAME>
558562
spark_enabled: true
559563
subresource_target: blob
560564
type: private_endpoint
@@ -583,9 +587,9 @@ To enable the [serverless spark jobs](how-to-submit-spark-jobs.md) for the manag
583587
584588
# Example private endpoint outbound to a blob
585589
rule_name = "myrule"
586-
service_resource_id = "/subscriptions/{subscription ID}/resourceGroups/{resource group name}/providers/Microsoft.Storage/storageAccounts/{storage account name}"
590+
service_resource_id = "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Storage/storageAccounts/<STORAGE_ACCOUNT_NAME>"
587591
subresource_target = "blob"
588-
spark_enabled = true
592+
spark_enabled = True
589593
590594
# Add the outbound
591595
ws.managed_network.outbound_rules = [PrivateEndpointDestination(
@@ -678,11 +682,9 @@ rule_name = "<some-rule-name>"
678682
679683
# Get a rule by name
680684
rule = ml_client._workspace_outbound_rules.get(resource_group, ws_name, rule_name)
681-
print(rule._to_dict())
682685
683686
# List rules for a workspace
684687
rule_list = ml_client._workspace_outbound_rules.list(resource_group, ws_name)
685-
print([r._to_dict() for r in rule_list])
686688
687689
# Delete a rule from a workspace
688690
ml_client._workspace_outbound_rules.begin_remove(resource_group, ws_name, rule_name).result()
@@ -702,7 +704,11 @@ ml_client._workspace_outbound_rules.begin_remove(resource_group, ws_name, rule_n
702704
> [!TIP]
703705
> These rules are automatically added to the managed VNet.
704706

705-
__Outbound__ rules:
707+
__Private endpoints__:
708+
* When the isolation mode for the managed network is `Allow internet outbound`, private endpoint outbound rules will be automatically created as required rules from the managed network for the workspace and associated resources __with public network access disabled__ (Key Vault, Storage Account, Container Registry, Azure ML Workspace).
709+
* When the isolation mode for the managed network is `Allow only approved outbound`, private endpoint outbound rules will be automatically created as required rules from the managed network for the workspace and associated resources __regardless of public network access mode for those resources__ (Key Vault, Storage Account, Container Registry, Azure ML Workspace).
710+
711+
__Outbound__ service tag rules:
706712

707713
* `AzureActiveDirectory`
708714
* `AzureMachineLearning`
@@ -712,7 +718,7 @@ __Outbound__ rules:
712718
* `MicrosoftContainerRegistry`
713719
* `AzureMonitor`
714720

715-
__Inbound__ rules:
721+
__Inbound__ service tag rules:
716722
* `AzureMachineLearning`
717723

718724
## List of recommended outbound rules
@@ -723,6 +729,7 @@ Currently we don't have any recommended outbound rules.
723729

724730
* Once you enable managed virtual network isolation of your workspace, you can't disable it.
725731
* Managed virtual network uses private endpoint connection to access your private resources. You can't have a private endpoint and a service endpoint at the same time for your Azure resources, such as a storage account. We recommend using private endpoints in all scenarios.
732+
* The managed network will be deleted and cleaned up when the workspace is deleted.
726733

727734
## Next steps
728735

0 commit comments

Comments
 (0)