Skip to content

Commit 9ebad1f

Browse files
[SQL] az sql mi create/update: Add memory size in gb parameter (#32466)
1 parent aa0680e commit 9ebad1f

File tree

6 files changed

+8654
-0
lines changed

6 files changed

+8654
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,8 @@
944944
text: az sql mi create -g mygroup -n myinstance -l mylocation -i -u myusername -p mypassword --subnet /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Network/virtualNetworks/{VNETName}/subnets/{SubnetName} --am Windows
945945
- name: Create GPv2 managed instance with specified IOPS limit
946946
text: az sql mi create -g mygroup -n myinstance -l mylocation -i -u myusername -p mypassword --subnet /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Network/virtualNetworks/{VNETName}/subnets/{SubnetName} -e GeneralPurpose --gpv2 true -f Gen8IH -c 4 --storage 256GB --iops 3000
947+
- name: Create managed instance with specified memory size in GB
948+
text: az sql mi create -g mygroup -n myinstance -l mylocation -i -u myusername -p mypassword --subnet /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Network/virtualNetworks/{VNETName}/subnets/{SubnetName} -e GeneralPurpose --gpv2 true -f Gen8IM -c 4 --storage 256GB --iops 3000 --memory 40
947949
"""
948950

949951
helps['sql mi delete'] = """
@@ -1083,6 +1085,8 @@
10831085
text: az sql mi update -g mygroup -n myinstance --am Windows
10841086
- name: Update managed instance to GPv2 with specified IOPS limit
10851087
text: az sql mi update -g mygroup -n myinstance -e GeneralPurpose --gpv2 true --iops 3000
1088+
- name: Update managed instance to use a specified memory size in GB
1089+
text: az sql mi update -g mygroup -n myinstance -e GeneralPurpose --memory 40
10861090
"""
10871091

10881092
helps['sql midb'] = """

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,10 @@ def get_location_type_with_default_from_resource_group(cli_ctx):
419419
help='Preferred metadata to use for authentication of synced on-prem users. Default is AzureAD.',
420420
arg_type=get_enum_type(['AzureAD', 'Windows', 'Paired']))
421421

422+
memory_size_type = CLIArgumentType(
423+
options_list=['--memory'],
424+
help='The memory size in gigabytes (GB).')
425+
422426
db_service_objective_examples = 'Basic, S0, P1, GP_Gen4_1, GP_S_Gen5_8, BC_Gen5_2, HS_Gen5_32.'
423427
dw_service_objective_examples = 'DW100, DW1000c'
424428

@@ -2326,6 +2330,12 @@ def _configure_security_policy_storage_params(arg_ctx):
23262330
arg_type=capacity_param_type,
23272331
help='The capacity of the managed instance in integer number of vcores.')
23282332

2333+
c.argument('memory_size_in_gb',
2334+
options_list=['--memory'],
2335+
arg_type=memory_size_type,
2336+
help='The memory size of the managed instance.'
2337+
' Memory size must be specified in GB')
2338+
23292339
c.argument('collation',
23302340
help='The collation of the managed instance.')
23312341

@@ -2395,6 +2405,7 @@ def _configure_security_policy_storage_params(arg_ctx):
23952405
'minimal_tls_version',
23962406
'virtual_network_subnet_id',
23972407
'vcores',
2408+
'memory_size_in_gb',
23982409
'storage_size_in_gb',
23992410
'storage_iops',
24002411
'collation',

src/azure-cli/azure/cli/command_modules/sql/custom.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5369,6 +5369,7 @@ def managed_instance_update( # pylint: disable=too-many-locals
53695369
administrator_login_password=None,
53705370
license_type=None,
53715371
vcores=None,
5372+
memory_size_in_gb=None,
53725373
storage_size_in_gb=None,
53735374
storage_iops=None,
53745375
assign_identity=False,
@@ -5425,6 +5426,8 @@ def managed_instance_update( # pylint: disable=too-many-locals
54255426
license_type or instance.license_type)
54265427
instance.v_cores = (
54275428
vcores or instance.v_cores)
5429+
instance.memory_size_in_gb = (
5430+
memory_size_in_gb or instance.memory_size_in_gb)
54285431
instance.storage_size_in_gb = (
54295432
storage_size_in_gb or instance.storage_size_in_gb)
54305433
instance.storage_iops = storage_iops
@@ -5456,6 +5459,10 @@ def managed_instance_update( # pylint: disable=too-many-locals
54565459
instance.requested_backup_storage_redundancy = requested_backup_storage_redundancy
54575460
instance.zone_redundant = None
54585461

5462+
# Have to set requested logical avail zone to none explicitly otherwise requests will fail
5463+
# as the default value is string 'NoPreference' which is invalid for update requests currently
5464+
instance.requested_logical_availability_zone = None
5465+
54595466
if public_data_endpoint_enabled is not None:
54605467
instance.public_data_endpoint_enabled = public_data_endpoint_enabled
54615468

0 commit comments

Comments
 (0)