无法将数据磁盘附加到 Azure VM

Unable to attach Data disk to Azure VM

我在 Create Disk and when i try to attach it to a VM Update VM 之后创建了一个共享磁盘,我正在获取 createOption 无法更改。以下是完整的错误,

Disk attachment failed, request response is - {
  "error": {
    "code": "PropertyChangeNotAllowed",
    "message": "Changing property 'dataDisk.createOption' is not allowed.",
    "target": "dataDisk.createOption"
  }

创建数据盘的请求正文(请注意这是一个共享磁盘),

{
  "location": LOCATION,
  "sku": {
    "name": "Premium_LRS"
  },
  "properties": {
    "creationData": {
      "createOption": "empty"
    },
    "osType": "linux",
    "diskSizeGB": SIZE,
    "maxShares": 5,
    "networkAccessPolicy": "AllowAll"
  }
}

VM 补丁请求的请求正文,

{
  "properties": {
    "storageProfile": {
      "dataDisks": [
      {
        "caching" : "ReadOnly",
        "createOption": "Attach",
        "lun": 0,
        "managedDisk" : {
          "id": disk_id,  //-> this disk_id is id of the created disk above
          "storageAccountType": "Premium_LRS"
        }
      }
      ]
    }
  }
}

谁能指出我哪里做错了。 到API.

,我没有找到太多关于共享磁盘附件的文档

据我所知,您更新虚拟机的请求正文没有问题。我现在就试过了,效果很好。我使用与您相同的请求正文。因此您需要再次检查磁盘,例如 lun 0 是否已被使用。