{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-virtual-machines/json-schema/microsoft-azure-virtual-machines-attach-detach-data-disks-request-schema.json",
  "title": "AttachDetachDataDisksRequest",
  "description": "Specifies the input for attaching and detaching data disks.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_superseded/microsoft-azure-virtual-machines-virtual-machines-api-openapi.yml#/components/schemas/AttachDetachDataDisksRequest",
  "type": "object",
  "properties": {
    "dataDisksToAttach": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DataDisk"
      },
      "description": "The list of managed data disks to be attached."
    },
    "dataDisksToDetach": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "diskId": {
            "type": "string",
            "description": "ID of the managed data disk."
          },
          "detachOption": {
            "type": "string",
            "description": "Specifies the detach behavior to be used while detaching a disk or which is already in the process of detachment.",
            "enum": [
              "ForceDetach"
            ]
          }
        }
      },
      "description": "The list of managed data disks to be detached."
    }
  },
  "$defs": {
    "DataDisk": {
      "type": "object",
      "description": "Describes a data disk.",
      "required": [
        "lun",
        "createOption"
      ],
      "properties": {
        "lun": {
          "type": "integer",
          "format": "int32",
          "description": "Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM."
        },
        "name": {
          "type": "string",
          "description": "The disk name."
        },
        "caching": {
          "type": "string",
          "description": "Specifies the caching requirements.",
          "enum": [
            "None",
            "ReadOnly",
            "ReadWrite"
          ]
        },
        "createOption": {
          "type": "string",
          "description": "Specifies how the virtual machine disk should be created.",
          "enum": [
            "FromImage",
            "Empty",
            "Attach",
            "Copy",
            "Restore"
          ]
        },
        "diskSizeGB": {
          "type": "integer",
          "format": "int32",
          "description": "Specifies the size of an empty data disk in gigabytes."
        },
        "managedDisk": {
          "$ref": "#/$defs/ManagedDiskParameters"
        },
        "deleteOption": {
          "type": "string",
          "description": "Specifies whether data disk should be deleted or detached upon VM deletion.",
          "enum": [
            "Delete",
            "Detach"
          ]
        }
      }
    },
    "ManagedDiskParameters": {
      "type": "object",
      "description": "The parameters of a managed disk.",
      "properties": {
        "id": {
          "type": "string",
          "description": "Resource Id."
        },
        "storageAccountType": {
          "type": "string",
          "description": "Specifies the storage account type for the managed disk.",
          "enum": [
            "Premium_LRS",
            "Premium_ZRS",
            "Standard_LRS",
            "StandardSSD_LRS",
            "StandardSSD_ZRS",
            "UltraSSD_LRS",
            "PremiumV2_LRS"
          ]
        }
      }
    }
  }
}