Skip to content

Commit ff469c0

Browse files
mingweiheMingwei He
andauthored
User/mingweihe/add enable data isolation support for workspace creation (Azure#30043)
* add enableDataIsolation support for workspace creation * fix * updated changelog --------- Co-authored-by: Mingwei He <mingweihe@microsoft.com>
1 parent 7c21ffa commit ff469c0

12 files changed

+5527
-3113
lines changed

sdk/ml/azure-ai-ml/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- Added Feature Store, its dedicated classes and updated the docstrings, now available in public interface. The classes added are `FeatureStoreOperations, FeatureSetOperations, FeatureStoreEntityOperations` with properties classes specific to the new features.
2222
- Support additional_includes in command component
2323
- Added experimental `distribution: ray` support in command job.
24+
- Added support to enable data isolation feature at workspace creation stage.
2425

2526
### Bugs Fixed
2627

sdk/ml/azure-ai-ml/azure/ai/ml/_arm_deployments/arm_templates/workspace_base.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,17 @@
475475
"metadata": {
476476
"description": "Whether to set up materialization store"
477477
}
478+
},
479+
"enable_data_isolation": {
480+
"type": "string",
481+
"defaultValue": "false",
482+
"allowedValues": [
483+
"false",
484+
"true"
485+
],
486+
"metadata": {
487+
"description": "A flag to determine if workspace has data isolation enabled. The flag can only be set at the creation phase, it can't be updated."
488+
}
478489
}
479490
},
480491
"variables": {
@@ -650,7 +661,7 @@
650661
{
651662
"condition": "[variables('enablePE')]",
652663
"type": "Microsoft.MachineLearningServices/workspaces",
653-
"apiVersion": "2022-12-01-preview",
664+
"apiVersion": "2023-04-01-preview",
654665
"tags": "[parameters('tagValues')]",
655666
"name": "[parameters('workspaceName')]",
656667
"kind": "[parameters('kind')]",
@@ -692,7 +703,8 @@
692703
},
693704
"offlinestoreconnectionname": "[parameters('offline_store_connection_name')]",
694705
"onlinestoreconnectionname": "[parameters('online_store_connection_name')]"
695-
}
706+
},
707+
"enableDataIsolation": "[parameters('enable_data_isolation')]"
696708
}
697709
},
698710
{

sdk/ml/azure-ai-ml/azure/ai/ml/_arm_deployments/arm_templates/workspace_param.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,5 +151,8 @@
151151
},
152152
"online_store_connection_target" : {
153153
"value": ""
154+
},
155+
"enable_data_isolation": {
156+
"value": "false"
154157
}
155158
}

sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/workspace.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ class WorkspaceSchema(PathAwareSchema):
4040
identity = NestedField(IdentitySchema)
4141
primary_user_assigned_identity = fields.Str()
4242
managed_network = ExperimentalField(NestedField(ManagedNetworkSchema, unknown=EXCLUDE))
43+
enable_data_isolation = fields.Bool()

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/workspace.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def __init__(
4545
identity: Optional[IdentityConfiguration] = None,
4646
primary_user_assigned_identity: Optional[str] = None,
4747
managed_network: Optional[ManagedNetwork] = None,
48+
enable_data_isolation: bool = False,
4849
**kwargs,
4950
):
5051
"""Azure ML workspace.
@@ -92,6 +93,9 @@ def __init__(
9293
:type primary_user_assigned_identity: str
9394
:param managed_network: workspace's Managed Network configuration
9495
:type managed_network: ManagedNetwork
96+
:param enable_data_isolation: A flag to determine if workspace has data isolation enabled.
97+
The flag can only be set at the creation phase, it can't be updated.
98+
:type enable_data_isolation: bool
9599
:param kwargs: A dictionary of additional configuration parameters.
96100
:type kwargs: dict
97101
"""
@@ -115,6 +119,7 @@ def __init__(
115119
self.identity = identity
116120
self.primary_user_assigned_identity = primary_user_assigned_identity
117121
self.managed_network = managed_network
122+
self.enable_data_isolation = enable_data_isolation
118123

119124
@property
120125
def discovery_url(self) -> str:
@@ -236,6 +241,7 @@ def _from_rest_object(cls, rest_obj: RestWorkspace) -> "Workspace":
236241
primary_user_assigned_identity=rest_obj.primary_user_assigned_identity,
237242
managed_network=managed_network,
238243
feature_store_settings=feature_store_settings,
244+
enable_data_isolation=rest_obj.enable_data_isolation,
239245
)
240246

241247
def _to_rest_object(self) -> RestWorkspace:
@@ -265,4 +271,5 @@ def _to_rest_object(self) -> RestWorkspace:
265271
if self.managed_network
266272
else None, # pylint: disable=protected-access
267273
feature_store_Settings=feature_store_Settings,
274+
enable_data_isolation=self.enable_data_isolation,
268275
)

sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_operations_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,8 @@ def _populate_arm_paramaters(self, workspace: Workspace, **kwargs: Dict) -> Tupl
463463
else:
464464
managed_network = ManagedNetwork(IsolationMode.DISABLED)._to_rest_object()
465465
_set_val(param["managedNetwork"], managed_network)
466+
if workspace.enable_data_isolation:
467+
_set_val(param["enable_data_isolation"], "true")
466468

467469
resources_being_deployed[workspace.name] = (ArmConstants.WORKSPACE, None)
468470
return template, param, resources_being_deployed

0 commit comments

Comments
 (0)