Unable to deploy Azure Machine Learning Dataset - bicep validates but built ARM does not
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Bicep version**
Bicep CLI version 0.4.1272 (a69022dd2c)
**Describe the bug**
I am trying to deploy a machine learning studio resource, along with a file dataset. Despite the template validating as bicep it seems to have problems after being built.
**To Reproduce**
Here is a reasonably minimal example with just what is required for the Azure ML workspace, extra storage container, datastore and dataset.
```
// minimal.bicep
param location string = resourceGroup().location
var unique = uniqueString(resourceGroup().id)
var storageAccountName = 'st${unique}'
var keyVaultName = 'kv-${unique}'
var appInsightsName = 'appi-${unique}'
var amlWorkspaceName = 'aml-${unique}'
var storageContainerName = 'train'
var trainDatastoreName = 'trainblobstore'
var trainDatasetName = 'training-images'
// Storage Account
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-08-01' = {
name: storageAccountName
location: location
kind: 'StorageV2'
sku: {
name: 'Standard_LRS'
}
}
resource storageContainer 'Microsoft.Storage/storageAccounts/blobServices/containers@2021-08-01' = {
name: '${storageAccountName}/default/${storageContainerName}'
properties: {
publicAccess: 'None'
}
dependsOn: [
storageAccount
]
}
// Key Vault
resource keyVault 'Microsoft.KeyVault/vaults@2021-04-01-preview' = {
name: keyVaultName
location: location
properties: {
sku: {
family: 'A'
name: 'standard'
}
tenantId: tenant().tenantId
accessPolicies: []
}
}
// App Insights
resource appInsights 'Microsoft.Insights/components@2020-02-02-preview' = {
name: appInsightsName
location: location
kind: 'web'
properties: {
Application_Type: 'web'
}
}
// AML resources
resource amlWorkspace 'Microsoft.MachineLearningServices/workspaces@2022-01-01-preview' = {
name: amlWorkspaceName
location: location
properties: {
friendlyName: amlWorkspaceName
applicationInsights: appInsights.id
keyVault: keyVault.id
storageAccount: storageAccount.id
}
identity: {
type: 'SystemAssigned'
}
}
resource trainDatastore 'Microsoft.MachineLearningServices/workspaces/datastores@2021-03-01-preview' = {
name: trainDatastoreName
parent: amlWorkspace
properties: {
contents: {
contentsType: 'AzureBlob'
accountName: storageAccountName
containerName: storageContainerName
credentials: {
credentialsType: 'None'
}
endpoint: storageAccountName
protocol: 'https'
}
isDefault: true
}
}
resource trainDataset 'Microsoft.MachineLearningServices/workspaces/datasets@2020-05-01-preview' = {
name: trainDatasetName
parent: amlWorkspace
datasetType: 'file'
parameters: {
path: {
dataPath: {
datastoreName: trainDatastoreName
relativePath: 'train'
}
}
}
registration: {
description: 'Training images'
name: trainDatasetName
}
dependsOn: [
trainDatastore
]
}
```
When using the command: `az deployment group create --resource-group resourcegroupname --template-file aware-machine-learning/minimal.bicep`, this fails to deploy with the error:
```
{"error":{"code":"InvalidRequestContent","message":"The request content was invalid and could not be deserialized: 'Could not find member 'datasetType' on object of type 'TemplateResource'. Path 'properties.template.resources[6].datasetType', line 118, position 20.'."}}
```
If I remove the dataset resource, everything deploys without issue.
**Additional context**
This is very strange, as I do include datasetType as a member of the trainDataset resource. If I comment that line, I get a different error, which is expected:
`/home/[path]/minimal.bicep(91,10) : Error BCP035: The specified "resource" declaration is missing the following required properties: "datasetType".`
Now, if I use `az bicep build` to look at the ARM template output, this error message is displayed by the Azure Resource Manager VSCode extension.

Contributor guide
Assessment
This issue has not been assessed yet.