Skip to content

Commit 0b70d6e

Browse files
authored
Add feature store provision role assignment location (Azure#34646)
* fix role assignment location * add tests
1 parent cec4fdc commit 0b70d6e

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@
6565
"description": "Specifies the name of the resource group."
6666
}
6767
},
68+
"location": {
69+
"type": "string",
70+
"metadata": {
71+
"description": "Specifies the location for all resources."
72+
}
73+
},
6874
"update_offline_store_role_assignment": {
6975
"type": "string",
7076
"defaultValue": "false",
@@ -144,6 +150,7 @@
144150
"apiVersion": "2022-04-01",
145151
"name": "[guid(parameters('materialization_identity_resource_id'), parameters('offline_store_target'), 'storage blob data contributor')]",
146152
"scope": "[parameters('offline_store_target')]",
153+
"location": "[parameters('location')]",
147154
"properties": {
148155
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')]",
149156
"principalId": "[reference(parameters('materialization_identity_resource_id'), '2023-01-31').principalId]",
@@ -172,6 +179,7 @@
172179
"apiVersion": "2022-04-01",
173180
"name": "[guid(parameters('materialization_identity_resource_id'), parameters('online_store_target'), 'contributor')]",
174181
"scope": "[parameters('online_store_target')]",
182+
"location": "[parameters('location')]",
175183
"properties": {
176184
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c')]",
177185
"principalId": "[reference(parameters('materialization_identity_resource_id'), '2023-01-31').principalId]",

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
"resource_group_name": {
2727
"value": null
2828
},
29+
"location": {
30+
"value": ""
31+
},
2932
"update_offline_store_role_assignment": {
3033
"value": "false"
3134
},

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,7 @@
10531053
"apiVersion": "2022-04-01",
10541054
"name": "[guid(variables('materializationIdentity'), resourceId('Microsoft.MachineLearningServices/workspaces', parameters('workspaceName')), 'azureml ds role')]",
10551055
"scope": "[resourceId(resourceGroup().name, 'Microsoft.MachineLearningServices/workspaces', parameters('workspaceName'))]",
1056+
"location": "[parameters('location')]",
10561057
"properties": {
10571058
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'f6c7c914-8db3-469d-8ca1-694a8f32e121')]",
10581059
"principalId": "[if(not(equals(parameters('materializationIdentityOption'), 'none')), reference(variables('materializationIdentity'), '2018-11-30').principalId, '')]",
@@ -1085,6 +1086,7 @@
10851086
"apiVersion": "2022-04-01",
10861087
"name": "[guid(variables('materializationIdentity'), variables('offlineStore'), 'storage blob data contributor')]",
10871088
"scope": "[variables('offlineStore')]",
1089+
"location": "[parameters('location')]",
10881090
"properties": {
10891091
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')]",
10901092
"principalId": "[if(not(equals(parameters('materializationIdentityOption'), 'none')), reference(variables('materializationIdentity'), '2023-01-31').principalId, '')]",
@@ -1116,6 +1118,7 @@
11161118
"apiVersion": "2022-04-01",
11171119
"name": "[guid(variables('materializationIdentity'), parameters('online_store_resource_id'), 'contributor')]",
11181120
"scope": "[parameters('online_store_resource_id')]",
1121+
"location": "[parameters('location')]",
11191122
"properties": {
11201123
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c')]",
11211124
"principalId": "[if(not(equals(parameters('materializationIdentityOption'), 'none')), reference(variables('materializationIdentity'), '2023-01-31').principalId, '')]",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ def _populate_feature_store_role_assignment_parameters(
783783
_set_val(param["workspace_name"], workspace.name)
784784
resource_group = kwargs.get("resource_group", workspace.resource_group)
785785
_set_val(param["resource_group_name"], resource_group)
786+
_set_val(param["location"], workspace.location)
786787

787788
update_workspace_role_assignment = kwargs.get("update_workspace_role_assignment", None)
788789
if update_workspace_role_assignment:

sdk/ml/azure-ai-ml/tests/workspace/unittests/test_workspace_operations_base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,13 @@ def test_populate_feature_store_arm_parameters(
349349
)
350350

351351
# test create feature store
352-
feature_store = FeatureStore(name="name", resource_group="rg")
352+
feature_store = FeatureStore(name="name", resource_group="rg", location="eastus2euap")
353353
template, param, _ = mock_workspace_operation_base._populate_arm_parameters(
354354
workspace=feature_store, grant_materialization_permissions=True
355355
)
356356

357357
assert param["kind"]["value"] == "featurestore"
358+
assert param["location"]["value"] == "eastus2euap"
358359
assert param["grant_materialization_permissions"]["value"] == "true"
359360
assert param["materializationIdentityOption"]["value"] == "new"
360361
assert param["materialization_identity_name"]["value"].startswith("materialization-uai-")
@@ -499,7 +500,7 @@ def test_populate_feature_store_role_assignments_paramaters(
499500
return_value=("random_id", True),
500501
)
501502
template, param, _ = mock_workspace_operation_base._populate_feature_store_role_assignment_parameters(
502-
workspace=FeatureStore(name="name"),
503+
workspace=FeatureStore(name="name", location="eastus2euap"),
503504
materialization_identity_id="/subscriptions/sub/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity",
504505
offline_store_target="/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Storage/storageAccounts/test_storage/blobServices/default/containers/offlinestore",
505506
online_store_target="/subscriptions/sub1/resourceGroups/mdctest/providers/Microsoft.Cache/Redis/onlinestore",
@@ -509,6 +510,7 @@ def test_populate_feature_store_role_assignments_paramaters(
509510
)
510511

511512
assert template is not None
513+
assert param["location"] == {"value": "eastus2euap"}
512514
assert param["materialization_identity_resource_id"] == {
513515
"value": "/subscriptions/sub/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity"
514516
}

0 commit comments

Comments
 (0)