How can I refer to a data disk at first boot on a linux VM?

Jon Woodlief 1 Reputation point
2020-11-06T18:39:02.017+00:00

I've got a requirement to mount a data disk into my filesystem immediately at first boot, with no human intervention. Since device names are unreliable- I figured I would try and create a .vhd file with a labeled empty disk as my data disk's image- so that I can refer to the disk by it's label.

I'm attempting to mount this disk like so-

    "storageProfile": {
      "imageReference": {
        "id": "[resourceId('Microsoft.Compute/images', variables('imageName'))]"
      },
      "osDisk": {
        "name": "[concat(variables('vmName'),'_OSDisk')]",
        "osType": "Linux",
        "createOption": "FromImage",
        "managedDisk": {
          "storageAccountType": "Premium_LRS"
        },
        "diskSizeGB": 32
      },
      "dataDisks" : [
          {
              "lun": 0,
              "name": "[concat(variables('vmName'),'_ContainerDisk')]",
              "createOption": "empty",
              "vhd": { "uri": "https://airgapwmsa.blob.core.windows.net/files/containerdisk.vhd" }
          },
          {
              "lun": 1,
              "name": "[concat(variables('vmName'),'_CephDisk')]",
              "createOption": "empty",
              "diskSizeGB": 1024
          }
      ]
    },

but running into this error-
Deployment failed. Correlation ID: 72545299-4710-46b6-a89b-baada39badc7. {
"error": {
"code": "OperationNotAllowed",
"message": "Addition of a blob based disk to VM with managed disks is not supported.",
"target": "dataDisk"
}
}

Since this approach isn't working- I'd like to either fix this somehow, or find an alternate approach. Any ideas?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,762 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Khurram Rahim 1,841 Reputation points
    2020-11-06T20:11:44.607+00:00

    https://learn.microsoft.com/en-us/azure/virtual-machines/linux/attach-disk-portal

    Please check mention below link it may help you thanks

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.