Skip to content

Conversation

@UrosKrsticMIPerf
Copy link

Related command
az sql mi create
az sql mi update

Description
Added memorySizeInGb parameter from the 2024-08-01-preview API to the az cli client. az sql mi create and update commands are affected.

Testing Guide
Added tests that test this new feature. Example of update command:
az sql mi update -g uroskrstic -n uroskrstic-flexi-test-azpowershell --memory 80 --gpv2 True

This checklist is used to make sure that common guidelines for a pull request are followed.

Copilot AI review requested due to automatic review settings November 26, 2025 11:28
@azure-client-tools-bot-prd
Copy link

Validation for Azure CLI Full Test Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd
Copy link

Validation for Breaking Change Starting...

Thanks for your contribution!

@yonzhan
Copy link
Collaborator

yonzhan commented Nov 26, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a memorySizeInGb parameter to the az sql mi create and az sql mi update commands, leveraging the 2024-08-01-preview API. This enables users to specify the memory size in gigabytes for SQL Managed Instances.

  • Added --memory parameter to create and update commands for SQL Managed Instances
  • Implemented parameter handling in custom logic and parameter definitions
  • Added comprehensive test coverage and documentation examples

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 8 comments.

File Description
test_sql_commands.py Adds two new test classes to verify memory size parameter functionality in create and update scenarios
custom.py Updates managed_instance_update function to handle memory_size_in_gb parameter and adds logic to set requested_logical_availability_zone to None
_params.py Defines the memory_size_in_gb parameter type and registers it for both create and update commands
_help.py Adds usage examples demonstrating the --memory parameter for create and update commands

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

self.cmd('sql mi delete --ids {} --yes'
.format(managed_instance['id']), checks=NoneCheck())

class SqlManagedInstanceHermesUpdateScenarioTest(ScenarioTest):
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

Class name 'SqlManagedInstanceHermesUpdateScenarioTest' conflicts with an existing class at line 8682. The new test class should be renamed to reflect its purpose of testing memory size in GB updates, such as 'SqlManagedInstanceMemorySizeInGBUpdateScenarioTest'.

Copilot uses AI. Check for mistakes.
Comment on lines +8749 to +8754
class SqlManagedInstanceMemorySizeInGBCreateScenarioTest(ScenarioTest):
@AllowLargeResponse()
def test_sql_mi_memorysizeingb_create(self):

subscription_id = '62e48210-5e43-423e-889b-c277f3e08c39'
group = 'uroskrstic'
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

This test contains hardcoded subscription IDs and resource group names but is missing the @live_only() decorator. Similar tests in the codebase (e.g., lines 8628, 8684) that use hardcoded resources include this decorator. Add @live_only() before the @AllowLargeResponse() decorator to prevent playback test failures.

Copilot uses AI. Check for mistakes.
Comment on lines +8804 to +8809
class SqlManagedInstanceHermesUpdateScenarioTest(ScenarioTest):
@AllowLargeResponse()
def test_sql_mi_memorysizeingb_update(self):

subscription_id = '62e48210-5e43-423e-889b-c277f3e08c39'
group = 'uroskrstic'
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

This test contains hardcoded subscription IDs and resource group names but is missing the @live_only() decorator. Similar tests in the codebase (e.g., lines 8628, 8684) that use hardcoded resources include this decorator. Add @live_only() before the @AllowLargeResponse() decorator to prevent playback test failures.

Copilot uses AI. Check for mistakes.
self.check('sku.family', '{family}'),
self.check('sku.capacity', '{v_cores}')])

# Get the managed instance and check GPv2 flag
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

Comment incorrectly refers to 'GPv2 flag' but the code is actually checking memory size in GB. Update to: '# Get the managed instance and check memory size in gb'.

Suggested change
# Get the managed instance and check GPv2 flag
# Get the managed instance and check memory size in gb

Copilot uses AI. Check for mistakes.
self.cmd('sql mi update -g {rg} -n {managed_instance_name} --gpv2 {is_general_purpose_v2} --memory {memory_size_in_gb}',
checks=[self.check('memorySizeInGb', '{memory_size_in_gb}')])

# Get the managed instance and check memory size in gb
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

[nitpick] Corrected capitalization of 'gb' to 'GB' to match the parameter name 'memorySizeInGb' and maintain consistency with other comments in the codebase.

Suggested change
# Get the managed instance and check memory size in gb
# Get the managed instance and check memory size in GB

Copilot uses AI. Check for mistakes.
options_list=['--memory'],
arg_type=memory_size_type,
help='The memory size of the managed instance.'
'Memory size must be specified in GB')
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

Missing space between the two help text strings. The help text will display as 'The memory size of the managed instance.Memory size must be specified in GB'. Add a space before the second string: ' Memory size must be specified in GB'.

Suggested change
'Memory size must be specified in GB')
' Memory size must be specified in GB')

Copilot uses AI. Check for mistakes.
- name: Create GPv2 managed instance with specified IOPS limit
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
- name: Create managed instance with specified memory size in GB
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 40GB
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

The example uses '40GB' without a space, but CLI parameter values typically don't include units. The value should be '40' (the number only), as the help text in _params.py specifies 'Memory size must be specified in GB'. Update to: --memory 40.

Copilot uses AI. Check for mistakes.
- name: Update managed instance to GPv2 with specified IOPS limit
text: az sql mi update -g mygroup -n myinstance -e GeneralPurpose --gpv2 true --iops 3000
- name: Update managed instance to use a specified memory size in GB
text: az sql mi update -g mygroup -n myinstance -e GeneralPurpose --memory 40GB
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

The example uses '40GB' without a space, but CLI parameter values typically don't include units. The value should be '40' (the number only), as the help text in _params.py specifies 'Memory size must be specified in GB'. Update to: --memory 40.

Suggested change
text: az sql mi update -g mygroup -n myinstance -e GeneralPurpose --memory 40GB
text: az sql mi update -g mygroup -n myinstance -e GeneralPurpose --memory 40

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot SQL az sql

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants