Skip to content

Commit ab4a3fd

Browse files
authored
[Compute] Add instant access support for restore point collection and restore point (#32953)
1 parent 952949f commit ab4a3fd

19 files changed

+7954
-78
lines changed

src/azure-cli/azure/cli/command_modules/vm/_help.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2993,6 +2993,10 @@
29932993
29942994
az restore-point create --exclude-disks "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123" \
29952995
--resource-group "myResourceGroup" --collection-name "rpcName" --name "rpName"
2996+
- name: Create a restore point with instant-access-duration-minutes
2997+
text: |-
2998+
az restore-point create --exclude-disks "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123" \
2999+
--resource-group "myResourceGroup" --collection-name "rpcName" --name "rpName" --instant-access-duration-minutes 120
29963000
"""
29973001

29983002
helps['restore-point wait'] = """

src/azure-cli/azure/cli/command_modules/vm/_params.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def load_arguments(self, _):
230230
c.argument('bandwidth_copy_speed', min_api='2023-10-02',
231231
help='If this field is set on a snapshot and createOption is CopyStart, the snapshot will be copied at a quicker speed.',
232232
arg_type=get_enum_type(["None", "Enhanced"]))
233-
c.argument('instant_access_duration_minutes', options_list=['--instant-access-duration-minutes', '--ia-duration'], type=int, help='For snapshots created from Premium SSD v2 or Ultra disk, this property determines the time in minutes the snapshot is retained for instant access to enable faster restore. The disk sku should be UltraSSD_LRS or PremiumV2_LRS')
233+
c.argument('instant_access_duration_minutes', options_list=['--instant-access-duration-minutes', '--instant-access-duration', '--ia-duration'], type=int, help='For snapshots created from Premium SSD v2 or Ultra disk, this property determines the time in minutes the snapshot is retained for instant access to enable faster restore. The disk sku should be UltraSSD_LRS or PremiumV2_LRS.')
234234
# endregion
235235

236236
# region Images
@@ -1584,6 +1584,9 @@ def load_arguments(self, _):
15841584
c.argument('source_data_disk_resource', nargs='+', help='Resource Id of the source data disk')
15851585
c.argument('data_disk_restore_point_encryption_set', nargs='+', help='Customer managed data disk encryption set resource id')
15861586
c.argument('data_disk_restore_point_encryption_type', nargs='+', arg_type=get_enum_type(self.get_models('RestorePointEncryptionType')), help='The type of key used to encrypt the data of the data disk restore point.')
1587+
c.argument('instant_access_duration_minutes', options_list=['--instant-access-duration-minutes', '--instant-access-duration', '--ia-duration'], type=int,
1588+
help='This property determines the time in minutes the snapshot is retained as instant access for '
1589+
'restoring Premium SSD v2 or Ultra disk with fast restore performance in this restore point.')
15871590

15881591
with self.argument_context('restore-point show') as c:
15891592
c.argument('restore_point_name', options_list=['--name', '-n', '--restore-point-name'],

src/azure-cli/azure/cli/command_modules/vm/aaz/latest/restore_point/_create.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@
1111
from azure.cli.core.aaz import *
1212

1313

14+
@register_command(
15+
"restore-point create",
16+
)
1417
class Create(AAZCommand):
1518
"""Create the restore point. Updating properties of an existing restore point is not allowed.
1619
1720
:example: Create a restore point
18-
az restore-point create --exclude-disks "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123" --resource-group "myResourceGroup" --collection-name "rpcName" --name "rpName"
21+
az restore-point create --exclude-disks "/subscriptions/{subscription-id}/resourceGroups/myResour ceGroup/providers/Microsoft.Compute/disks/disk123" --resource-group "myResourceGroup" --collection-name "rpcName" --name "rpName" --instant-access-duration-minutes 120
1922
2023
:example: Create a restore point with --consistency-mode CrashConsistent
2124
az vm create -n vm -g rg --image UbuntuLTS --tag EnableCrashConsistentRestorePoint=True
@@ -24,9 +27,9 @@ class Create(AAZCommand):
2427
"""
2528

2629
_aaz_info = {
27-
"version": "2024-11-01",
30+
"version": "2025-04-01",
2831
"resources": [
29-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/restorepointcollections/{}/restorepoints/{}", "2024-11-01"],
32+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/restorepointcollections/{}/restorepoints/{}", "2025-04-01"],
3033
]
3134
}
3235

@@ -82,6 +85,11 @@ def _build_arguments_schema(cls, *args, **kwargs):
8285
# define Arg Group "Properties"
8386

8487
_args_schema = cls._args_schema
88+
_args_schema.instant_access_duration_minutes = AAZIntArg(
89+
options=["--instant-access-duration", "--instant-access-duration-minutes"],
90+
arg_group="Properties",
91+
help="This property determines the time in minutes the snapshot is retained as instant access for restoring Premium SSD v2 or Ultra disk with fast restore performance in this restore point. Range is between 60 and 300. Default is 300.",
92+
)
8593
_args_schema.source_metadata = AAZObjectArg(
8694
options=["--source-metadata"],
8795
arg_group="Properties",
@@ -340,7 +348,7 @@ def url_parameters(self):
340348
def query_parameters(self):
341349
parameters = {
342350
**self.serialize_query_param(
343-
"api-version", "2024-11-01",
351+
"api-version", "2025-04-01",
344352
required=True,
345353
),
346354
}
@@ -371,6 +379,7 @@ def content(self):
371379
if properties is not None:
372380
properties.set_prop("consistencyMode", AAZStrType, ".consistency_mode")
373381
properties.set_prop("excludeDisks", AAZListType, ".exclude_disks")
382+
properties.set_prop("instantAccessDurationMinutes", AAZIntType, ".instant_access_duration_minutes")
374383
properties.set_prop("sourceMetadata", AAZObjectType, ".source_metadata")
375384
_CreateHelper._build_schema_api_entity_reference_create(properties.set_prop("sourceRestorePoint", AAZObjectType, ".source_restore_point"))
376385

@@ -449,6 +458,9 @@ def _build_schema_on_201(cls):
449458
serialized_name="instanceView",
450459
flags={"read_only": True},
451460
)
461+
properties.instant_access_duration_minutes = AAZIntType(
462+
serialized_name="instantAccessDurationMinutes",
463+
)
452464
properties.provisioning_state = AAZStrType(
453465
serialized_name="provisioningState",
454466
flags={"read_only": True},
@@ -482,6 +494,9 @@ def _build_schema_on_201(cls):
482494
_element.replication_status = AAZObjectType(
483495
serialized_name="replicationStatus",
484496
)
497+
_element.snapshot_access_state = AAZStrType(
498+
serialized_name="snapshotAccessState",
499+
)
485500

486501
replication_status = cls._schema_on_201.properties.instance_view.disk_restore_points.Element.replication_status
487502
replication_status.completion_percent = AAZIntType(
@@ -756,6 +771,9 @@ def _build_schema_on_201(cls):
756771
)
757772

758773
proxy_agent_settings = cls._schema_on_201.properties.source_metadata.security_profile.proxy_agent_settings
774+
proxy_agent_settings.add_proxy_agent_extension = AAZBoolType(
775+
serialized_name="addProxyAgentExtension",
776+
)
759777
proxy_agent_settings.enabled = AAZBoolType()
760778
proxy_agent_settings.imds = AAZObjectType()
761779
_CreateHelper._build_schema_host_endpoint_settings_read(proxy_agent_settings.imds)
@@ -803,9 +821,6 @@ def _build_schema_on_201(cls):
803821
serialized_name="diskSizeGB",
804822
flags={"read_only": True},
805823
)
806-
_element.lun = AAZIntType(
807-
flags={"read_only": True},
808-
)
809824
_element.managed_disk = AAZObjectType(
810825
serialized_name="managedDisk",
811826
)

src/azure-cli/azure/cli/command_modules/vm/aaz/latest/restore_point/_show.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
from azure.cli.core.aaz import *
1212

1313

14+
@register_command(
15+
"restore-point show",
16+
)
1417
class Show(AAZCommand):
1518
"""Get the restore point.
1619
@@ -19,9 +22,9 @@ class Show(AAZCommand):
1922
"""
2023

2124
_aaz_info = {
22-
"version": "2024-11-01",
25+
"version": "2025-04-01",
2326
"resources": [
24-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/restorepointcollections/{}/restorepoints/{}", "2024-11-01"],
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/restorepointcollections/{}/restorepoints/{}", "2025-04-01"],
2528
]
2629
}
2730

@@ -135,7 +138,7 @@ def query_parameters(self):
135138
"$expand", self.ctx.args.expand,
136139
),
137140
**self.serialize_query_param(
138-
"api-version", "2024-11-01",
141+
"api-version", "2025-04-01",
139142
required=True,
140143
),
141144
}
@@ -196,6 +199,9 @@ def _build_schema_on_200(cls):
196199
serialized_name="instanceView",
197200
flags={"read_only": True},
198201
)
202+
properties.instant_access_duration_minutes = AAZIntType(
203+
serialized_name="instantAccessDurationMinutes",
204+
)
199205
properties.provisioning_state = AAZStrType(
200206
serialized_name="provisioningState",
201207
flags={"read_only": True},
@@ -229,6 +235,9 @@ def _build_schema_on_200(cls):
229235
_element.replication_status = AAZObjectType(
230236
serialized_name="replicationStatus",
231237
)
238+
_element.snapshot_access_state = AAZStrType(
239+
serialized_name="snapshotAccessState",
240+
)
232241

233242
replication_status = cls._schema_on_200.properties.instance_view.disk_restore_points.Element.replication_status
234243
replication_status.completion_percent = AAZIntType(
@@ -503,6 +512,9 @@ def _build_schema_on_200(cls):
503512
)
504513

505514
proxy_agent_settings = cls._schema_on_200.properties.source_metadata.security_profile.proxy_agent_settings
515+
proxy_agent_settings.add_proxy_agent_extension = AAZBoolType(
516+
serialized_name="addProxyAgentExtension",
517+
)
506518
proxy_agent_settings.enabled = AAZBoolType()
507519
proxy_agent_settings.imds = AAZObjectType()
508520
_ShowHelper._build_schema_host_endpoint_settings_read(proxy_agent_settings.imds)
@@ -550,9 +562,6 @@ def _build_schema_on_200(cls):
550562
serialized_name="diskSizeGB",
551563
flags={"read_only": True},
552564
)
553-
_element.lun = AAZIntType(
554-
flags={"read_only": True},
555-
)
556565
_element.managed_disk = AAZObjectType(
557566
serialized_name="managedDisk",
558567
)

src/azure-cli/azure/cli/command_modules/vm/aaz/latest/restore_point/collection/_create.py

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ class Create(AAZCommand):
1818
"""Create operation to create or update the restore point collection. Please refer to https://aka.ms/RestorePoints for more details. When updating a restore point collection, only tags may be modified.
1919
2020
:example: Create or update a restore point collection.
21-
az restore-point collection create --location "norwayeast" --source-id "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM" --tags myTag1="tagValue1" --resource-group "myResourceGroup" --collection-name "myRpc"
21+
az restore-point collection create --location "norwayeast" --source-id "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM" --tags myTag1="tagValue1" --resource-group "myResourceGroup" --collection-name "myRpc" --instant-access true
2222
"""
2323

2424
_aaz_info = {
25-
"version": "2024-11-01",
25+
"version": "2025-04-01",
2626
"resources": [
27-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/restorepointcollections/{}", "2024-11-01"],
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/restorepointcollections/{}", "2025-04-01"],
2828
]
2929
}
3030

@@ -67,6 +67,15 @@ def _build_arguments_schema(cls, *args, **kwargs):
6767
tags = cls._args_schema.tags
6868
tags.Element = AAZStrArg()
6969

70+
# define Arg Group "Properties"
71+
72+
_args_schema = cls._args_schema
73+
_args_schema.instant_access = AAZBoolArg(
74+
options=["--instant-access"],
75+
arg_group="Properties",
76+
help="This property determines whether instant access snapshot is enabled for restore points created under this restore point collection for Premium SSD v2 or Ultra disk. Instant access snapshot for Premium SSD v2 or Ultra disk is instantaneously available for restoring disk with fast restore performance.",
77+
)
78+
7079
# define Arg Group "Source"
7180

7281
_args_schema = cls._args_schema
@@ -142,7 +151,7 @@ def url_parameters(self):
142151
def query_parameters(self):
143152
parameters = {
144153
**self.serialize_query_param(
145-
"api-version", "2024-11-01",
154+
"api-version", "2025-04-01",
146155
required=True,
147156
),
148157
}
@@ -173,6 +182,7 @@ def content(self):
173182

174183
properties = _builder.get(".properties")
175184
if properties is not None:
185+
properties.set_prop("instantAccess", AAZBoolType, ".instant_access")
176186
properties.set_prop("source", AAZObjectType)
177187

178188
source = _builder.get(".properties.source")
@@ -226,6 +236,9 @@ def _build_schema_on_200_201(cls):
226236
)
227237

228238
properties = cls._schema_on_200_201.properties
239+
properties.instant_access = AAZBoolType(
240+
serialized_name="instantAccess",
241+
)
229242
properties.provisioning_state = AAZStrType(
230243
serialized_name="provisioningState",
231244
flags={"read_only": True},
@@ -273,6 +286,9 @@ def _build_schema_on_200_201(cls):
273286
serialized_name="instanceView",
274287
flags={"read_only": True},
275288
)
289+
properties.instant_access_duration_minutes = AAZIntType(
290+
serialized_name="instantAccessDurationMinutes",
291+
)
276292
properties.provisioning_state = AAZStrType(
277293
serialized_name="provisioningState",
278294
flags={"read_only": True},
@@ -306,6 +322,9 @@ def _build_schema_on_200_201(cls):
306322
_element.replication_status = AAZObjectType(
307323
serialized_name="replicationStatus",
308324
)
325+
_element.snapshot_access_state = AAZStrType(
326+
serialized_name="snapshotAccessState",
327+
)
309328

310329
replication_status = cls._schema_on_200_201.properties.restore_points.Element.properties.instance_view.disk_restore_points.Element.replication_status
311330
replication_status.completion_percent = AAZIntType(
@@ -580,6 +599,9 @@ def _build_schema_on_200_201(cls):
580599
)
581600

582601
proxy_agent_settings = cls._schema_on_200_201.properties.restore_points.Element.properties.source_metadata.security_profile.proxy_agent_settings
602+
proxy_agent_settings.add_proxy_agent_extension = AAZBoolType(
603+
serialized_name="addProxyAgentExtension",
604+
)
583605
proxy_agent_settings.enabled = AAZBoolType()
584606
proxy_agent_settings.imds = AAZObjectType()
585607
_CreateHelper._build_schema_host_endpoint_settings_read(proxy_agent_settings.imds)
@@ -627,9 +649,6 @@ def _build_schema_on_200_201(cls):
627649
serialized_name="diskSizeGB",
628650
flags={"read_only": True},
629651
)
630-
_element.lun = AAZIntType(
631-
flags={"read_only": True},
632-
)
633652
_element.managed_disk = AAZObjectType(
634653
serialized_name="managedDisk",
635654
)

src/azure-cli/azure/cli/command_modules/vm/aaz/latest/restore_point/collection/_list.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class List(AAZCommand):
2222
"""
2323

2424
_aaz_info = {
25-
"version": "2024-11-01",
25+
"version": "2025-04-01",
2626
"resources": [
27-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/restorepointcollections", "2024-11-01"],
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/restorepointcollections", "2025-04-01"],
2828
]
2929
}
3030

@@ -112,7 +112,7 @@ def url_parameters(self):
112112
def query_parameters(self):
113113
parameters = {
114114
**self.serialize_query_param(
115-
"api-version", "2024-11-01",
115+
"api-version", "2025-04-01",
116116
required=True,
117117
),
118118
}
@@ -179,6 +179,9 @@ def _build_schema_on_200(cls):
179179
)
180180

181181
properties = cls._schema_on_200.value.Element.properties
182+
properties.instant_access = AAZBoolType(
183+
serialized_name="instantAccess",
184+
)
182185
properties.provisioning_state = AAZStrType(
183186
serialized_name="provisioningState",
184187
flags={"read_only": True},
@@ -226,6 +229,9 @@ def _build_schema_on_200(cls):
226229
serialized_name="instanceView",
227230
flags={"read_only": True},
228231
)
232+
properties.instant_access_duration_minutes = AAZIntType(
233+
serialized_name="instantAccessDurationMinutes",
234+
)
229235
properties.provisioning_state = AAZStrType(
230236
serialized_name="provisioningState",
231237
flags={"read_only": True},
@@ -259,6 +265,9 @@ def _build_schema_on_200(cls):
259265
_element.replication_status = AAZObjectType(
260266
serialized_name="replicationStatus",
261267
)
268+
_element.snapshot_access_state = AAZStrType(
269+
serialized_name="snapshotAccessState",
270+
)
262271

263272
replication_status = cls._schema_on_200.value.Element.properties.restore_points.Element.properties.instance_view.disk_restore_points.Element.replication_status
264273
replication_status.completion_percent = AAZIntType(
@@ -533,6 +542,9 @@ def _build_schema_on_200(cls):
533542
)
534543

535544
proxy_agent_settings = cls._schema_on_200.value.Element.properties.restore_points.Element.properties.source_metadata.security_profile.proxy_agent_settings
545+
proxy_agent_settings.add_proxy_agent_extension = AAZBoolType(
546+
serialized_name="addProxyAgentExtension",
547+
)
536548
proxy_agent_settings.enabled = AAZBoolType()
537549
proxy_agent_settings.imds = AAZObjectType()
538550
_ListHelper._build_schema_host_endpoint_settings_read(proxy_agent_settings.imds)
@@ -580,9 +592,6 @@ def _build_schema_on_200(cls):
580592
serialized_name="diskSizeGB",
581593
flags={"read_only": True},
582594
)
583-
_element.lun = AAZIntType(
584-
flags={"read_only": True},
585-
)
586595
_element.managed_disk = AAZObjectType(
587596
serialized_name="managedDisk",
588597
)

0 commit comments

Comments
 (0)