NetworkAcls Class
Network Access Setting for Workspace
- Inheritance
-
azure.ai.ml.entities._mixins.RestTranslatableMixinNetworkAcls
Constructor
NetworkAcls(*, default_action: str = 'Allow', ip_rules: List[IPRule] | None = None)
Parameters
Name | Description |
---|---|
default_action
Required
|
Specifies the default action when no IP rules are matched. |
ip_rules
Required
|
Rules governing the accessibility of a resource from a specific IP address or IP range. |
Keyword-Only Parameters
Name | Description |
---|---|
default_action
|
Default value: Allow
|
ip_rules
Required
|
|
Examples
Configuring one of the three public network access settings.
from azure.ai.ml.entities import DefaultActionType, IPRule, NetworkAcls
# Get existing workspace
ws = ml_client.workspaces.get("test-ws1")
# 1. Enabled from all networks
# Note: default_action should be set to 'Allow', allowing all access.
ws.public_network_access = "Enabled"
ws.network_acls = NetworkAcls(default_action=DefaultActionType.ALLOW, ip_rules=[])
updated_ws = ml_client.workspaces.begin_update(workspace=ws).result()
# 2. Enabled from selected IP addresses
# Note: default_action should be set to 'Deny', allowing only specified IPs/ranges
ws.public_network_access = "Enabled"
ws.network_acls = NetworkAcls(
default_action=DefaultActionType.DENY,
ip_rules=[IPRule(value="103.248.19.87/32"), IPRule(value="103.248.19.86/32")],
)
updated_ws = ml_client.workspaces.begin_update(workspace=ws).result()
# 3. Disabled
# NetworkAcls IP Rules will reset
ws.public_network_access = "Disabled"
updated_ws = ml_client.workspaces.begin_update(workspace=ws).result()
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
Azure SDK for Python