I am trying to add Diagnostic Settings for Machine Learning Online Deployments, which is a child of a given Machine Learning Online Endpoint, but since I have an array for each of these services, I am not being able to reference them.
This is my current working template:
@description('Subscription ID where the resources are located.')
param subscriptionId string
@description('Name of the resource group containing the resources.')
param resourceGroupName string
@description('The name of the existing Operational Insights (Log Analytics) workspace.')
param logWorkspaceName string
@description('The name of the existing Azure Machine Learning workspace.')
param machineLearningWorkspaceName string
@description('The name of the existing Azure Machine Learning Workspace Online Endpoints.')
param onlineEndpoints array
@description('Reference to the existing Operational Insights workspace.')
resource operationalInsightsWorkspace 'Microsoft.OperationalInsights/workspaces@2023-09-01' existing = {
name: logWorkspaceName
scope: resourceGroup(subscriptionId, resourceGroupName)
}
@description('Reference to the existing Azure Machine Learning Workspace resource.')
resource machineLearningWorkspace 'Microsoft.MachineLearningServices/workspaces@2024-10-01' existing = {
name: machineLearningWorkspaceName
}
resource machineLearningWorkspaceOnlineEndpoints 'Microsoft.MachineLearningServices/workspaces/onlineEndpoints@2024-10-01' existing = [
for onlineEndpoint in onlineEndpoints: {
#disable-next-line use-parent-property
name: '${machineLearningWorkspace.name}/${onlineEndpoint}'
}
]
@description('Diagnostic settings for Machine Learning Workspace Online Endpoints')
resource diagnosticsOnlineEndpoints 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = [
for (onlineEndpoint, i) in onlineEndpoints: {
name: '${onlineEndpoint}diag'
scope: machineLearningWorkspaceOnlineEndpoints[i]
properties: {
logAnalyticsDestinationType: 'Dedicated'
workspaceId: operationalInsightsWorkspace.id
logs: [
{
category: null
categoryGroup: 'allLogs'
enabled: true
retentionPolicy: {
days: 0
enabled: false
}
}
]
metrics: [
{
category: 'Traffic'
timeGrain: null
enabled: true
retentionPolicy: {
days: 0
enabled: false
}
}
]
}
}
]
I would like to create a new param called `param onlineDeployments array, but how can I create a resource definition for deployment if depends on online endpoints that is also an array?
If I try this I get an error:
resource machineLearningWorkspaceOnlineDeployments 'Microsoft.MachineLearningServices/workspaces/onlineEndpoints/deployments@2024-10-01' existing = [
for onlineDeployment in onlineDeployments: {
#disable-next-line use-parent-property
name: '${machineLearningWorkspace.name}/${onlineEndpoint}/${onlineDeployment}'
}
]