Skip to content

Commit

Permalink
vm disk tach
Browse files Browse the repository at this point in the history
  • Loading branch information
Jing-song committed Nov 1, 2024
1 parent 1a8eac0 commit 43ff5e3
Show file tree
Hide file tree
Showing 6 changed files with 381 additions and 0 deletions.
50 changes: 50 additions & 0 deletions Commands/tree.json
Original file line number Diff line number Diff line change
Expand Up @@ -212022,6 +212022,56 @@
"availability-set"
]
},
"disk": {
"commands": {
"attach-detach-data-disk": {
"help": {
"short": "Attach and detach data disks to/from the virtual machine."
},
"names": [
"vm",
"disk",
"attach-detach-data-disk"
],
"versions": [
{
"name": "2024-03-01",
"resources": [
{
"id": "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/attachdetachdatadisks",
"plane": "mgmt-plane",
"version": "2024-03-01"
}
],
"stage": "Preview"
}
]
}
},
"help": {
"lines": [
"Azure Virtual Machines use disks as a place to store an operating system, applications, and",
" data. All Azure virtual machines have at least two disks: An operating system disk, and a",
" temporary disk. The operating system disk is created from an image, and both the operating",
" system disk and the image are actually virtual hard disks (VHDs) stored in an Azure storage",
" account. Virtual machines also can have one or more data disks, that are also stored as",
" VHDs.",
" Azure Managed and Unmanaged Data Disks have a maximum size of 4095 GB (with the exception of",
" larger disks in preview). Azure Unmanaged Disks also have a maximum capacity of 4095 GB.",
" For more information, see:",
" - Azure Disks - https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview.",
" - Larger Managed Disks in Public Preview - https://azure.microsoft.com/blog/introducing-the-",
" public-preview-of-larger-managed-disks-sizes/",
" - Ultra SSD Managed Disks in Public Preview - https://docs.microsoft.com/azure/virtual-",
" machines/disks-types."
],
"short": "Manage the managed data disks attached to a VM."
},
"names": [
"vm",
"disk"
]
},
"extension": {
"commandGroups": {
"image": {
Expand Down
9 changes: 9 additions & 0 deletions Commands/vm/disk/_attach-detach-data-disk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# [Command] _vm disk attach-detach-data-disk_

Attach and detach data disks to/from the virtual machine.

## Versions

### [2024-03-01](/Resources/mgmt-plane/L3N1YnNjcmlwdGlvbnMve30vcmVzb3VyY2Vncm91cHMve30vcHJvdmlkZXJzL21pY3Jvc29mdC5jb21wdXRlL3ZpcnR1YWxtYWNoaW5lcy97fS9hdHRhY2hkZXRhY2hkYXRhZGlza3M=/2024-03-01.xml) **Preview**

<!-- mgmt-plane /subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/attachdetachdatadisks 2024-03-01 -->
23 changes: 23 additions & 0 deletions Commands/vm/disk/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# [Group] _vm disk_

Manage the managed data disks attached to a VM.

Azure Virtual Machines use disks as a place to store an operating system, applications, and\
data. All Azure virtual machines have at least two disks: An operating system disk, and a\
temporary disk. The operating system disk is created from an image, and both the operating\
system disk and the image are actually virtual hard disks (VHDs) stored in an Azure storage\
account. Virtual machines also can have one or more data disks, that are also stored as\
VHDs.\
Azure Managed and Unmanaged Data Disks have a maximum size of 4095 GB (with the exception of\
larger disks in preview). Azure Unmanaged Disks also have a maximum capacity of 4095 GB.\
For more information, see:\
- Azure Disks - https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview.\
- Larger Managed Disks in Public Preview - https://azure.microsoft.com/blog/introducing-the-\
public-preview-of-larger-managed-disks-sizes/\
- Ultra SSD Managed Disks in Public Preview - https://docs.microsoft.com/azure/virtual-\
machines/disks-types.

## Commands

- [attach-detach-data-disk](/Commands/vm/disk/_attach-detach-data-disk.md)
: Attach and detach data disks to/from the virtual machine.
3 changes: 3 additions & 0 deletions Commands/vm/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Manage Linux or Windows virtual machines.
- [availability-set](/Commands/vm/availability-set/readme.md)
: Group resources into availability sets.

- [disk](/Commands/vm/disk/readme.md)
: Manage the managed data disks attached to a VM.

- [extension](/Commands/vm/extension/readme.md)
: Manage extensions on VMs.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"plane": "mgmt-plane", "resources": [{"id": "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/attachdetachdatadisks", "version": "2024-03-01", "swagger": "mgmt-plane/compute/ResourceProviders/Microsoft.Compute/Paths/L3N1YnNjcmlwdGlvbnMve3N1YnNjcmlwdGlvbklkfS9yZXNvdXJjZUdyb3Vwcy97cmVzb3VyY2VHcm91cE5hbWV9L3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS92aXJ0dWFsTWFjaGluZXMve3ZtTmFtZX0vYXR0YWNoRGV0YWNoRGF0YURpc2tz/V/MjAyNC0wMy0wMQ=="}], "commandGroups": [{"name": "vm disk", "commands": [{"name": "attach-detach-data-disk", "version": "2024-03-01", "resources": [{"id": "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/attachdetachdatadisks", "version": "2024-03-01", "swagger": "mgmt-plane/compute/ResourceProviders/Microsoft.Compute/Paths/L3N1YnNjcmlwdGlvbnMve3N1YnNjcmlwdGlvbklkfS9yZXNvdXJjZUdyb3Vwcy97cmVzb3VyY2VHcm91cE5hbWV9L3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS92aXJ0dWFsTWFjaGluZXMve3ZtTmFtZX0vYXR0YWNoRGV0YWNoRGF0YURpc2tz/V/MjAyNC0wMy0wMQ=="}], "argGroups": [{"name": "", "args": [{"type": "ResourceGroupName", "var": "$Path.resourceGroupName", "options": ["g", "resource-group"], "required": true, "idPart": "resource_group"}, {"type": "SubscriptionId", "var": "$Path.subscriptionId", "options": ["subscription"], "required": true, "idPart": "subscription"}, {"type": "string", "var": "$Path.vmName", "options": ["vm-name"], "required": true, "idPart": "name", "help": {"short": "The name of the virtual machine."}}]}, {"name": "Parameters", "args": [{"type": "array<object>", "var": "$parameters.dataDisksToAttach", "options": ["data-disks-to-attach"], "group": "Parameters", "help": {"short": "The list of managed data disks to be attached."}, "item": {"type": "object", "args": [{"type": "string", "var": "$parameters.dataDisksToAttach[].caching", "options": ["caching"], "help": {"short": "Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** **ReadWrite.** The defaulting behavior is: **None for Standard storage. ReadOnly for Premium storage.**"}, "enum": {"items": [{"name": "None", "value": "None"}, {"name": "ReadOnly", "value": "ReadOnly"}, {"name": "ReadWrite", "value": "ReadWrite"}]}}, {"type": "string", "var": "$parameters.dataDisksToAttach[].deleteOption", "options": ["delete-option"], "help": {"short": "Specifies whether data disk should be deleted or detached upon VM deletion. Possible values are: **Delete.** If this value is used, the data disk is deleted when VM is deleted. **Detach.** If this value is used, the data disk is retained after VM is deleted. The default value is set to **Detach**."}, "enum": {"items": [{"name": "Delete", "value": "Delete"}, {"name": "Detach", "value": "Detach"}]}}, {"type": "object", "var": "$parameters.dataDisksToAttach[].diskEncryptionSet", "options": ["disk-encryption-set"], "help": {"short": "Specifies the customer managed disk encryption set resource id for the managed disk."}, "args": [{"type": "string", "var": "$parameters.dataDisksToAttach[].diskEncryptionSet.id", "options": ["id"], "help": {"short": "Resource Id"}}]}, {"type": "string", "var": "$parameters.dataDisksToAttach[].diskId", "options": ["disk-id"], "required": true, "help": {"short": "ID of the managed data disk."}}, {"type": "integer32", "var": "$parameters.dataDisksToAttach[].lun", "options": ["lun"], "help": {"short": "The logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. If not specified, lun would be auto assigned."}}, {"type": "boolean", "var": "$parameters.dataDisksToAttach[].writeAcceleratorEnabled", "options": ["write-accelerator-enabled"], "help": {"short": "Specifies whether writeAccelerator should be enabled or disabled on the disk."}}]}}, {"type": "array<object>", "var": "$parameters.dataDisksToDetach", "options": ["data-disks-to-detach"], "group": "Parameters", "help": {"short": "The list of managed data disks to be detached."}, "item": {"type": "object", "args": [{"type": "string", "var": "$parameters.dataDisksToDetach[].detachOption", "options": ["detach-option"], "help": {"short": "Supported options available for Detach of a disk from a VM. Refer to DetachOption object reference for more details."}, "enum": {"items": [{"name": "ForceDetach", "value": "ForceDetach"}]}}, {"type": "string", "var": "$parameters.dataDisksToDetach[].diskId", "options": ["disk-id"], "required": true, "help": {"short": "ID of the managed data disk."}}]}}]}], "operations": [{"longRunning": {"finalStateVia": "location"}, "operationId": "VirtualMachines_AttachDetachDataDisks", "http": {"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/attachDetachDataDisks", "request": {"method": "post", "path": {"params": [{"type": "string", "name": "resourceGroupName", "arg": "$Path.resourceGroupName", "required": true}, {"type": "string", "name": "subscriptionId", "arg": "$Path.subscriptionId", "required": true}, {"type": "string", "name": "vmName", "arg": "$Path.vmName", "required": true}]}, "query": {"consts": [{"readOnly": true, "const": true, "default": {"value": "2024-03-01"}, "type": "string", "name": "api-version", "required": true}]}, "body": {"json": {"schema": {"type": "object", "name": "parameters", "required": true, "props": [{"type": "array<object>", "name": "dataDisksToAttach", "arg": "$parameters.dataDisksToAttach", "item": {"type": "object", "props": [{"type": "string", "name": "caching", "arg": "$parameters.dataDisksToAttach[].caching", "enum": {"items": [{"value": "None"}, {"value": "ReadOnly"}, {"value": "ReadWrite"}]}}, {"type": "string", "name": "deleteOption", "arg": "$parameters.dataDisksToAttach[].deleteOption", "enum": {"items": [{"value": "Delete"}, {"value": "Detach"}]}}, {"type": "object", "name": "diskEncryptionSet", "arg": "$parameters.dataDisksToAttach[].diskEncryptionSet", "props": [{"type": "string", "name": "id", "arg": "$parameters.dataDisksToAttach[].diskEncryptionSet.id"}]}, {"type": "string", "name": "diskId", "arg": "$parameters.dataDisksToAttach[].diskId", "required": true}, {"type": "integer32", "name": "lun", "arg": "$parameters.dataDisksToAttach[].lun"}, {"type": "boolean", "name": "writeAcceleratorEnabled", "arg": "$parameters.dataDisksToAttach[].writeAcceleratorEnabled"}]}, "identifiers": ["diskId"]}, {"type": "array<object>", "name": "dataDisksToDetach", "arg": "$parameters.dataDisksToDetach", "item": {"type": "object", "props": [{"type": "string", "name": "detachOption", "arg": "$parameters.dataDisksToDetach[].detachOption", "enum": {"items": [{"value": "ForceDetach"}]}}, {"type": "string", "name": "diskId", "arg": "$parameters.dataDisksToDetach[].diskId", "required": true}]}, "identifiers": ["diskId"]}], "clientFlatten": true}}}}, "responses": [{"statusCode": [200], "body": {"json": {"var": "$Instance", "schema": {"type": "object", "props": [{"type": "array<object>", "name": "dataDisks", "item": {"type": "object", "props": [{"type": "string", "name": "caching", "enum": {"items": [{"value": "None"}, {"value": "ReadOnly"}, {"value": "ReadWrite"}]}}, {"type": "string", "name": "createOption", "required": true, "enum": {"items": [{"value": "Attach"}, {"value": "Copy"}, {"value": "Empty"}, {"value": "FromImage"}, {"value": "Restore"}]}}, {"type": "string", "name": "deleteOption", "enum": {"items": [{"value": "Delete"}, {"value": "Detach"}]}}, {"type": "string", "name": "detachOption", "enum": {"items": [{"value": "ForceDetach"}]}}, {"readOnly": true, "type": "integer64", "name": "diskIOPSReadWrite"}, {"readOnly": true, "type": "integer64", "name": "diskMBpsReadWrite"}, {"type": "integer32", "name": "diskSizeGB"}, {"type": "@VirtualHardDisk_read", "name": "image"}, {"type": "integer32", "name": "lun", "required": true}, {"type": "@ManagedDiskParameters_read", "name": "managedDisk"}, {"type": "string", "name": "name"}, {"type": "object", "name": "sourceResource", "props": [{"type": "string", "name": "id"}]}, {"type": "boolean", "name": "toBeDetached"}, {"type": "@VirtualHardDisk_read", "name": "vhd"}, {"type": "boolean", "name": "writeAcceleratorEnabled"}]}, "identifiers": ["lun"]}, {"type": "string", "name": "diskControllerType", "enum": {"items": [{"value": "NVMe"}, {"value": "SCSI"}]}}, {"type": "object", "name": "imageReference", "props": [{"type": "string", "name": "communityGalleryImageId"}, {"readOnly": true, "type": "string", "name": "exactVersion"}, {"type": "string", "name": "id"}, {"type": "string", "name": "offer"}, {"type": "string", "name": "publisher"}, {"type": "string", "name": "sharedGalleryImageId"}, {"type": "string", "name": "sku"}, {"type": "string", "name": "version"}]}, {"type": "object", "name": "osDisk", "props": [{"type": "string", "name": "caching", "enum": {"items": [{"value": "None"}, {"value": "ReadOnly"}, {"value": "ReadWrite"}]}}, {"type": "string", "name": "createOption", "required": true, "enum": {"items": [{"value": "Attach"}, {"value": "Copy"}, {"value": "Empty"}, {"value": "FromImage"}, {"value": "Restore"}]}}, {"type": "string", "name": "deleteOption", "enum": {"items": [{"value": "Delete"}, {"value": "Detach"}]}}, {"type": "object", "name": "diffDiskSettings", "props": [{"type": "string", "name": "option", "enum": {"items": [{"value": "Local"}]}}, {"type": "string", "name": "placement", "enum": {"items": [{"value": "CacheDisk"}, {"value": "NvmeDisk"}, {"value": "ResourceDisk"}]}}]}, {"type": "integer32", "name": "diskSizeGB"}, {"type": "object", "name": "encryptionSettings", "props": [{"type": "object", "name": "diskEncryptionKey", "props": [{"type": "string", "name": "secretUrl", "required": true}, {"type": "object", "name": "sourceVault", "required": true, "props": [{"type": "string", "name": "id"}], "cls": "SubResource_read"}]}, {"type": "boolean", "name": "enabled"}, {"type": "object", "name": "keyEncryptionKey", "props": [{"type": "string", "name": "keyUrl", "required": true}, {"type": "@SubResource_read", "name": "sourceVault", "required": true}]}]}, {"type": "@VirtualHardDisk_read", "name": "image"}, {"type": "object", "name": "managedDisk", "props": [{"type": "object", "name": "diskEncryptionSet", "props": [{"type": "string", "name": "id"}], "cls": "DiskEncryptionSetParameters_read"}, {"type": "string", "name": "id"}, {"type": "object", "name": "securityProfile", "props": [{"type": "@DiskEncryptionSetParameters_read", "name": "diskEncryptionSet"}, {"type": "string", "name": "securityEncryptionType", "enum": {"items": [{"value": "DiskWithVMGuestState"}, {"value": "NonPersistedTPM"}, {"value": "VMGuestStateOnly"}]}}]}, {"type": "string", "name": "storageAccountType", "enum": {"items": [{"value": "PremiumV2_LRS"}, {"value": "Premium_LRS"}, {"value": "Premium_ZRS"}, {"value": "StandardSSD_LRS"}, {"value": "StandardSSD_ZRS"}, {"value": "Standard_LRS"}, {"value": "UltraSSD_LRS"}]}}], "cls": "ManagedDiskParameters_read"}, {"type": "string", "name": "name"}, {"type": "string", "name": "osType", "enum": {"items": [{"value": "Linux"}, {"value": "Windows"}]}}, {"type": "object", "name": "vhd", "props": [{"type": "string", "name": "uri"}], "cls": "VirtualHardDisk_read"}, {"type": "boolean", "name": "writeAcceleratorEnabled"}]}]}}}}, {"statusCode": [202], "header": {"items": [{"name": "Location"}]}}, {"isError": true, "body": {"json": {"schema": {"type": "@ODataV4Format"}}}}]}}], "outputs": [{"type": "object", "ref": "$Instance", "clientFlatten": true}], "confirmation": ""}]}]}
Loading

0 comments on commit 43ff5e3

Please sign in to comment.