You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用Azure Machine Learning REST API创建Data container报错及Dataset创建咨询

AML REST API创建Dataset问题解决方案

报错原因

  • 你使用的2021-03-01-preview版本API为早期预览版本,DataContainers_CreateOrUpdate端点未正式开放,同时存在字段校验逻辑缺陷,因此先后触发参数赋值错误、接口不支持的报错。

完整实现步骤

  1. 替换API版本为正式可用的2022-10-01,该版本的数据集相关接口能力已完全对齐UI操作
  2. 先调用接口创建Data container,正确请求示例:
curl --location --request PUT 'https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups/{{resourceGroupName}}/providers/Microsoft.MachineLearningServices/workspaces/{{workspaceName}}/data/abc?api-version=2022-10-01' \
--header 'Authorization: Bearer {{实际Bearer令牌}}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "properties": {
    "description": "自定义数据集描述",
    "tags": {},
    "dataType": "uri_file"
  }
}'
  1. 将本地文件上传到AML工作空间关联的任意datastore对应的存储路径中,可直接使用Azure存储服务的REST接口完成上传,无需UI操作
  2. 调用Data version创建接口,关联存储路径完成Dataset创建:
curl --location --request PUT 'https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups/{{resourceGroupName}}/providers/Microsoft.MachineLearningServices/workspaces/{{workspaceName}}/data/abc/versions/1?api-version=2022-10-01' \
--header 'Authorization: Bearer {{实际Bearer令牌}}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "properties": {
    "dataUri": "azureml://datastores/{{目标datastore名称}}/paths/{{文件上传后的存储路径}}",
    "dataType": "uri_file"
  }
}'

补充说明:如果需要创建包含多个文件的数据集,只需将dataType参数值改为uri_folder,dataUri对应填写存储的文件夹路径即可。

内容的提问来源于stack exchange,提问作者Pribina

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.24 16:36:04