Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/azure-cli/azure/cli/command_modules/vm/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2127,7 +2127,7 @@ def attach_managed_data_disk(cmd, resource_group_name, vm_name, disk=None, ids=N
DataDisk, ManagedDiskParameters, DiskCreateOption = cmd.get_models(
'DataDisk', 'ManagedDiskParameters', 'DiskCreateOptionTypes')
if size_gb is None:
size_gb = 1023
default_size_gb = 1023

if disk_ids is not None:
disks = disk_ids
Expand All @@ -2141,7 +2141,7 @@ def attach_managed_data_disk(cmd, resource_group_name, vm_name, disk=None, ids=N
if new:
data_disk = DataDisk(lun=disk_lun, create_option=DiskCreateOption.empty,
name=parse_resource_id(disk_item)['name'],
disk_size_gb=size_gb, caching=caching,
disk_size_gb=size_gb if size_gb else default_size_gb, caching=caching,
managed_disk=ManagedDiskParameters(storage_account_type=sku))
else:
params = ManagedDiskParameters(id=disk_item, storage_account_type=sku)
Expand All @@ -2164,6 +2164,16 @@ def attach_managed_data_disk(cmd, resource_group_name, vm_name, disk=None, ids=N
"id": disk_item
}
}
if size_gb is not None:
disk.update({
'diskSizeGb': size_gb
})
if sku is not None:
disk.update({
"managedDisk": {
"storageAccountType": sku
}
})
disk_lun += 1
vm.storage_profile.data_disks.append(disk)
if source_disk_restore_point is not None:
Expand All @@ -2177,6 +2187,16 @@ def attach_managed_data_disk(cmd, resource_group_name, vm_name, disk=None, ids=N
"id": disk_item
}
}
if size_gb is not None:
disk.update({
'diskSizeGb': size_gb
})
if sku is not None:
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected. This line uses 5 spaces for indentation instead of the required 4 spaces.

Copilot uses AI. Check for mistakes.
disk.update({
"managedDisk": {
"storageAccountType": sku
}
})
disk_lun += 1
vm.storage_profile.data_disks.append(disk)

Expand Down
Loading
Loading