使用 Bicep 创建数据资产版本的问题
在最初的尝试中,创作过程进展顺利。但是,后续尝试会导致以下错误: YAML
A data version with this name and version already exists. If you are aiming to establish a new data version, please utilize a distinct name or version. For updates to an existing data version, it is worth noting that the asset's data URI cannot be altered. Only attributes such as tags, description, and isArchived can be updated. (Code: UserError)
需要强调的是,我没有对相关版本进行任何修改。这是当前的代码片段供参考:
resource dataAssetVersion 'Microsoft.MachineLearningServices/workspaces/data/versions@2023-04-01' = {
parent: data
name: dataAssetversion
properties: {
dataType: 'uri_folder'
isAnonymous: false
dataUri: 'azureml://datastores/${datastore.name}/paths/csv'
description: 'random description'
isArchived: false
}
}
根据评论部分,我创建了一个新的 blob 存储,它给了我同样的错误:
param workspaceName string
param dataStoreName string
param dataAssetName string
param dataAssetVersionName string
param dataType string = 'uri_folder'
param dataDescription string = 'Sample data asset'
param isArchived bool = false
resource mlWorkspace 'Microsoft.MachineLearningServices/workspaces@2023-06-01-preview' existing = {
name: workspaceName
}
resource blobStore 'Microsoft.MachineLearningServices/workspaces/datastores@2023-06-01-preview' existing = {
name: dataStoreName
parent: mlWorkspace
}
resource dataAsset 'Microsoft.MachineLearningServices/workspaces/data@2023-06-01-preview' existing = {
name: dataAssetName
parent: mlWorkspace
}
resource dataAssetVersion 'Microsoft.MachineLearningServices/workspaces/data/versions@2023-06-01-preview' = {
name: dataAssetVersionName
parent: dataAsset
properties: {
dataType: dataType
dataUri: 'azureml://datastores/${blobStore.name}/paths/csv'
isArchived: isArchived
description: dataDescription
}
}
我检查了使用 ARM API 创建的数据资产,可以看到 dataUri 不同:
az rest --method get `
--uri /subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.MachineLearningServices/workspaces/<ml-workspace-name>/data/<data-assest-name>/versions/<version-name>?api-version=2023-06-01-preview
命令结果:
{
...
"properties": {
...
"dataUri": "azureml://subscriptions/<subscription-id>/resourcegroups/<rg-name>/workspaces/<ml-workspace-name>/datastores/<data-store-name>/paths/csv/",
...
},
...
}
我已经像这样更新了我的二头肌模板,它按预期工作了
resource dataAssetVersion 'Microsoft.MachineLearningServices/workspaces/data/versions@2023-06-01-preview' = {
name: dataAssetVersionName
parent: dataAsset
properties: {
dataType: dataType
dataUri: 'azureml://subscriptions/${subscription().subscriptionId}/resourcegroups/${resourceGroup().name}/workspaces/${mlWorkspace.name}/datastores/${blobStore.name}/paths/csv/'
isArchived: isArchived
description: dataDescription
}
}