Skip to main content

virtual_hard_disks

Creates, updates, deletes, gets or lists a virtual_hard_disks resource.

Overview

Namevirtual_hard_disks
TypeResource
Idazure_stack.azure_stack_hci_vm.virtual_hard_disks

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
blockSizeBytesintegerBlock size in bytes.
containerIdstringStorage ContainerID of the storage container to be used for VHD.
createFromLocalbooleanBoolean indicating whether it is an existing local hard disk or if one should be created.
diskFileFormatstringThe format of the actual VHD file [vhd, vhdx]. Known values are: "vhdx" and "vhd". (vhdx, vhd)
diskSizeGBintegerSize of the disk in GB.
downloadUrlstringURL for downloading or accessing the virtual hard disk. This URL points to a secure link from where the VHD can be downloaded or accessed directly.
dynamicbooleanBoolean for enabling dynamic sizing on the virtual hard disk.
extendedLocationobjectThe extendedLocation of the resource.
hyperVGenerationstringThe hypervisor generation of the Virtual Machine [V1, V2]. Known values are: "V1" and "V2". (V1, V2)
locationstringThe geo-location where the resource lives. Required.
logicalSectorBytesintegerLogical sector in bytes.
maxSharesintegerThe maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time.
physicalSectorBytesintegerPhysical sector in bytes.
provisioningStatestringProvisioning state of the virtual hard disk. Known values are: "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". (Succeeded, Failed, InProgress, Accepted, Deleting, Canceled)
statusobjectThe observed state of virtual hard disks.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
tagsobjectResource tags.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, virtual_hard_disk_name, subscription_idGets a virtual hard disk.
list_by_resource_groupselectresource_group_name, subscription_idLists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response to get the next page of virtual hard disks.
list_allselectsubscription_idLists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response to get the next page of virtual hard disks.
create_or_updateinsertresource_group_name, virtual_hard_disk_name, subscription_id, locationThe operation to create or update a virtual hard disk. Please note some properties can be set only during virtual hard disk creation.
updateupdateresource_group_name, virtual_hard_disk_name, subscription_idThe operation to update a virtual hard disk.
create_or_updatereplaceresource_group_name, virtual_hard_disk_name, subscription_id, locationThe operation to create or update a virtual hard disk. Please note some properties can be set only during virtual hard disk creation.
deletedeleteresource_group_name, virtual_hard_disk_name, subscription_idThe operation to delete a virtual hard disk.
uploadexecresource_group_name, virtual_hard_disk_name, subscription_id, azureManagedDiskUploadUrlThe operation to upload a virtual hard disk.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
subscription_idstring
virtual_hard_disk_namestringName of the virtual hard disk. Required.

SELECT examples

Gets a virtual hard disk.

SELECT
id,
name,
blockSizeBytes,
containerId,
createFromLocal,
diskFileFormat,
diskSizeGB,
downloadUrl,
dynamic,
extendedLocation,
hyperVGeneration,
location,
logicalSectorBytes,
maxShares,
physicalSectorBytes,
provisioningState,
status,
systemData,
tags,
type
FROM azure_stack.azure_stack_hci_vm.virtual_hard_disks
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND virtual_hard_disk_name = '{{ virtual_hard_disk_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

INSERT examples

The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual hard disk creation.

INSERT INTO azure_stack.azure_stack_hci_vm.virtual_hard_disks (
tags,
location,
properties,
extendedLocation,
resource_group_name,
virtual_hard_disk_name,
subscription_id
)
SELECT
'{{ tags }}',
'{{ location }}' /* required */,
'{{ properties }}',
'{{ extendedLocation }}',
'{{ resource_group_name }}',
'{{ virtual_hard_disk_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
extendedLocation,
location,
properties,
systemData,
tags,
type
;

UPDATE examples

The operation to update a virtual hard disk.

UPDATE azure_stack.azure_stack_hci_vm.virtual_hard_disks
SET
tags = '{{ tags }}',
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND virtual_hard_disk_name = '{{ virtual_hard_disk_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
extendedLocation,
location,
properties,
systemData,
tags,
type;

REPLACE examples

The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual hard disk creation.

REPLACE azure_stack.azure_stack_hci_vm.virtual_hard_disks
SET
tags = '{{ tags }}',
location = '{{ location }}',
properties = '{{ properties }}',
extendedLocation = '{{ extendedLocation }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND virtual_hard_disk_name = '{{ virtual_hard_disk_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND location = '{{ location }}' --required
RETURNING
id,
name,
extendedLocation,
location,
properties,
systemData,
tags,
type;

DELETE examples

The operation to delete a virtual hard disk.

DELETE FROM azure_stack.azure_stack_hci_vm.virtual_hard_disks
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND virtual_hard_disk_name = '{{ virtual_hard_disk_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;

Lifecycle Methods

The operation to upload a virtual hard disk.

EXEC azure_stack.azure_stack_hci_vm.virtual_hard_disks.upload 
@resource_group_name='{{ resource_group_name }}' --required,
@virtual_hard_disk_name='{{ virtual_hard_disk_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"azureManagedDiskUploadUrl": "{{ azureManagedDiskUploadUrl }}"
}'
;