Skip to content

Commit

Permalink
re-add workspace default app insights, fix project ARM template (#36325
Browse files Browse the repository at this point in the history
…) (#36353)

* re-add workspace default app insights, fix project ARM template

* move cl lines to right place

* cl wording

Co-authored-by: MilesHolland <[email protected]>
  • Loading branch information
kshitij-microsoft and MilesHolland authored Jul 4, 2024
1 parent 5d17931 commit fccf123
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 9 deletions.
7 changes: 7 additions & 0 deletions sdk/ml/azure-ai-ml/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release History


## 1.17.1 (2024-07-09)

### Bugs Fixed
- Workspace Create operation works without an application insights being provided, and creates a default appIn resource for normal workspaces in that case.
- Project create operations works in general.

## 1.17.0 (2024-06-18)

### Bugs Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@
},
"applicationInsightsOption": {
"type": "string",
"defaultValue": "none",
"defaultValue": "new",
"allowedValues": [
"none",
"existing"
"new",
"existing",
"none"
],
"metadata": {
"description": "Determines whether or not new ApplicationInsights should be provisioned."
Expand Down Expand Up @@ -795,6 +796,34 @@
"networkAcls": "[if(equals(parameters('keyVaultBehindVNet'), 'true'), variables('networkRuleSetBehindVNet'), json('null'))]"
}
},
{
"condition": "[and(variables('enablePE'), equals(parameters('applicationInsightsOption'), 'new'))]",
"type": "Microsoft.OperationalInsights/workspaces",
"tags": "[parameters('tagValues')]",
"apiVersion": "2020-08-01",
"name": "[parameters('logAnalyticsName')]",
"location": "[if(or(equals(toLower(parameters('applicationInsightsLocation')),'westcentralus'), equals(toLower(parameters('applicationInsightsLocation')),'eastus2euap'), equals(toLower(parameters('applicationInsightsLocation')),'centraluseuap')),'southcentralus', parameters('applicationInsightsLocation'))]",
"kind": "web",
"properties": {
"Application_Type": "web"
}
},
{
"condition": "[and(variables('enablePE'), equals(parameters('applicationInsightsOption'), 'new'))]",
"type": "Microsoft.Insights/components",
"tags": "[parameters('tagValues')]",
"apiVersion": "2020-02-02-preview",
"name": "[parameters('applicationInsightsName')]",
"location": "[if(or(equals(toLower(parameters('applicationInsightsLocation')),'westcentralus'), equals(toLower(parameters('applicationInsightsLocation')),'eastus2euap'), equals(toLower(parameters('applicationInsightsLocation')),'centraluseuap')),'southcentralus', parameters('applicationInsightsLocation'))]",
"kind": "web",
"dependsOn": [
"[resourceId('Microsoft.OperationalInsights/workspaces', parameters('logAnalyticsName'))]"
],
"properties": {
"Application_Type": "web",
"WorkspaceResourceId": "[parameters('logAnalyticsArmId')]"
}
},
{
"condition": "[variables('enablePE')]",
"type": "Microsoft.MachineLearningServices/workspaces",
Expand All @@ -805,7 +834,8 @@
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]",
"[resourceId('Microsoft.KeyVault/vaults', parameters('keyVaultName'))]"
"[resourceId('Microsoft.KeyVault/vaults', parameters('keyVaultName'))]",
"[resourceId('Microsoft.Insights/components', parameters('applicationInsightsName'))]"
],
"identity": "[parameters('identity')]",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"value": ""
},
"applicationInsightsOption": {
"value": "none"
"value": "new"
},
"applicationInsightsName": {
"value": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@
},
"applicationInsightsOption": {
"type": "string",
"defaultValue": "none",
"defaultValue": "new",
"allowedValues": [
"none",
"existing"
"new",
"existing",
"none"
],
"metadata": {
"description": "Determines whether or not new ApplicationInsights should be provisioned."
Expand Down Expand Up @@ -161,7 +162,7 @@
"type": "string",
"defaultValue": "none",
"allowedValues": [
"existing",
"new",
"none"
],
"metadata": {
Expand Down Expand Up @@ -622,6 +623,25 @@
"metadata": {
"description": "Whether to grant materialization identity permissions"
}
},
"allowRoleAssignmentOnRG": {
"type": "string",
"defaultValue": "true",
"allowedValues": [
"true",
"false"
],
"metadata": {
"description": "Unused for projects, but required due to interdependency of normal and project ARM templates."
}
},

"systemDatastoresAuthMode": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Unused for projects, but required due to interdependency of normal and project ARM templates"
}
}
},
"variables": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,14 @@ def _populate_arm_parameters(self, workspace: Workspace, **kwargs: Any) -> Tuple
param["applicationInsightsResourceGroupName"],
group_name,
)
elif workspace._kind and workspace._kind.lower() in {WorkspaceKind.HUB, WorkspaceKind.PROJECT}:
_set_val(param["applicationInsightsOption"], "none")
# Set empty values because arm templates whine over unset values.
_set_val(param["applicationInsightsName"], "ignoredButCantBeEmpty")
_set_val(
param["applicationInsightsResourceGroupName"],
"ignoredButCantBeEmpty",
)
else:
log_analytics = _generate_log_analytics(workspace.name, resources_being_deployed)
_set_val(param["logAnalyticsName"], log_analytics)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def test_ai_workspace_operations(self, client: MLClient, randstr: Callable[[], s
)
created_hub = client.workspaces.begin_create(workspace=local_hub).result()
assert created_hub.associated_workspaces == []
assert created_hub.application_insights is None

local_project1 = Project(
name=f"test_proj_1_{randstr('project_1_name')}",
Expand All @@ -73,6 +74,7 @@ def test_ai_workspace_operations(self, client: MLClient, randstr: Callable[[], s
# don't set project location, make sure it gets copied via value injection
)
created_project1 = client.workspaces.begin_create(workspace=local_project1).result()
assert created_project1.application_insights is None

local_project2 = Project(
name=f"test_proj_2_{randstr('project_2_name')}",
Expand All @@ -81,6 +83,7 @@ def test_ai_workspace_operations(self, client: MLClient, randstr: Callable[[], s
display_name="project2 display name",
)
created_project2 = client.workspaces.begin_create(workspace=local_project2).result()
assert created_project2.application_insights is None

project_ids = [created_project1.id, created_project2.id]

Expand Down Expand Up @@ -144,6 +147,14 @@ def test_ai_workspace_operations(self, client: MLClient, randstr: Callable[[], s
poller.wait() # Need to wait for projects to be cleaned before deleting parent hub.

if created_hub is not None:
if is_live():
from time import sleep

sleep(60)
poller = client.workspaces.begin_delete(created_hub.name, delete_dependent_resources=True)
assert poller
assert isinstance(poller, LROPoller)
# Double check that we didn't fail out of main code block before creating resources.
assert created_hub is not None
assert created_project1 is not None
assert created_project2 is not None
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def workspace_validation(wps):
workspace = client.workspaces.get(wps_name)
assert isinstance(workspace, Workspace)
assert workspace.name == wps_name
assert workspace.application_insights is not None

param_image_build_compute = "compute"
param_display_name = "Test display name"
Expand Down

0 comments on commit fccf123

Please sign in to comment.