Lesson 3 of 3 Infrastructure as Code for Azure Machine Learning

Restricting Network Access to Workspaces

This lesson explains how private endpoints restrict inbound access, how the managed virtual network isolates outbound traffic, and how outbound rules allow approved destinations.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish inbound from outbound isolation.
  • Compare the managed network isolation modes.
  • Describe the outbound rule types and their costs.
  • Explain why isolation must be planned before enabling it.

Inbound and outbound isolation

A workspace has two network directions to protect. Inbound traffic reaches the workspace and its resources: people using the studio, SDK calls, clients calling endpoints. Outbound traffic leaves the workspace's compute: jobs downloading packages, reading data or calling services. A data exfiltration risk is outbound, because a compromised job could send data to any internet destination.

Inbound isolation
Protects againstAccess from untrusted networks
Main mechanismPrivate endpoints and disabled public network access
AffectsStudio, SDK, CLI and endpoint callers
Choose when Only trusted networks may reach the workspace
Outbound isolation
Protects againstData leaving to unapproved destinations
Main mechanismManaged virtual network isolation mode and outbound rules
AffectsJobs, compute instances and managed online endpoints
Choose when Workloads may only reach approved destinations

Private endpoints for the workspace

A private endpoint gives the workspace a private IP address in a virtual network. With publicNetworkAccess set to Disabled, the workspace's APIs and studio are reachable only through that address, from the virtual network or networks connected to it by peering, VPN or ExpressRoute. Private DNS zones, privatelink.api.azureml.ms and privatelink.notebooks.azure.net, resolve the workspace's names to the private address.

The dependent resources need their own protection: private endpoints for the storage account (blob and file), the key vault and the container registry, which must be Premium for private endpoints. Without them, the workspace is private while its data and images remain publicly reachable. Engineers then connect through a VPN, a jump box or Azure Bastion, and GitHub workflows run on self-hosted runners in the virtual network if they must reach the private workspace.

Managed virtual network

A managed virtual network is a network that Azure creates and manages for the workspace's compute: compute instances, compute clusters, serverless compute and managed online endpoints. Azure creates private endpoints from it to the workspace's storage, key vault and container registry automatically. The isolation mode decides what else compute can reach.

Isolation modeOutbound behaviourTypical use
Allow internet outboundAny internet destination is allowed; private endpoints can be added for Azure resourcesInbound protection without outbound restriction
Allow only approved outboundOnly destinations allowed by outbound rulesPreventing data exfiltration
DisabledNo managed network; use your own virtual network or nonePublic workspaces, or customer-managed networking

The managed network is provisioned when the first compute is created, which takes around 30 minutes, or ahead of time with az ml workspace provision-network, which Microsoft recommends. Once managed network isolation is enabled, it cannot be disabled, and a workspace that allows internet outbound cannot be changed back to disabled.

Outbound rules

In Allow only approved outbound mode, rules define the approved destinations. Azure adds required rules for Azure Machine Learning itself automatically, and you add the rest with az ml workspace outbound-rule set or in the workspace definition.

  • Private endpoint rules connect privately to Azure resources such as another storage account, an Azure AI Search service or a Foundry resource.
  • Service tag rules allow Azure services identified by service tags, with ports and protocols.
  • FQDN rules allow named internet destinations, such as pypi.org or files.pythonhosted.org for package installation. They are implemented with a managed Azure Firewall, which is created when the first FQDN rule is added and is billed separately.
az ml workspace outbound-rule set --resource-group rg-ml-prod --workspace-name mlw-churn-prod \
  --rule pypi --type fqdn --destination pypi.org
az ml workspace outbound-rule set --resource-group rg-ml-prod --workspace-name mlw-churn-prod \
  --rule curated-lake --type private_endpoint \
  --service-resource-id /subscriptions/SUB/resourceGroups/rg-data/providers/Microsoft.Storage/storageAccounts/stcurated \
  --subresource-target blob

Feature limits under isolation

Some features have restrictions in network-isolated workspaces. For example, Azure Machine Learning model monitoring does not support the Allow only approved outbound isolation mode, and environment image builds need a configured image build compute when the container registry is private.

Worked example

Preventing exfiltration from training jobs

A healthcare company trains models on patient data. Security requires that the workspace be reachable only from the corporate network, that training jobs can reach the company's data lake and the Python package index, and that jobs cannot send data anywhere else. Administrative effort should be minimal.

Use a managed virtual network in Allow only approved outbound mode, with a private endpoint outbound rule to the data lake storage account and FQDN rules for pypi.org and files.pythonhosted.org. Add a private endpoint for the workspace in the corporate-connected virtual network and set public network access to Disabled. Provision the managed network up front.

Allow internet outbound would let jobs reach any destination. Building and operating a customer virtual network with network security groups and a firewall would meet the requirements with much more administrative effort. Disabling public network access alone restricts inbound access but does nothing about outbound traffic.

Check yourself

A workspace uses Allow only approved outbound mode, and a job must download packages from a public package index. What is required?

Show answer

An FQDN outbound rule for the index's host names. FQDN rules are enforced by a managed Azure Firewall, which is billed separately.

Exam Tips

Remember for the exam

  • Private endpoints plus disabled public access restrict inbound access.
  • Allow only approved outbound restricts compute to approved destinations.
  • FQDN outbound rules create a managed Azure Firewall, billed separately.
  • Managed network isolation cannot be disabled once enabled; provision the network up front.