Modify Azure SQL Database Managed Instance using Azure CLI




First published on MSDN on Nov 14, 2018



Azure SQL Managed Instance is fully-managed SQL Server Database Engine hosted in Azure cloud. With Managed Instance you can easily add/remove cores associated to the instance and change the reserved size of the instance. You can use Azure CLI to easily manage size of the instance and automate this process.








The Azure CLI is Microsoft’s cross-platform command-line experience for managing Azure resources. You can use it in your browser with

Azure Cloud Shell

, or

install

it on macOS, Linux, or Windows and run it from the command line.




Azure CLI enables you to modify properties of the existing Managed Instances using

az sql mi update

command. If you don’t have managed instance you can find here more information about

creating the instance using Azure CLI

.



Prerequisite





Make sure that you set the subscription that you will use using something like the following command:






az account set –subscription b9c7a824-4bde-06c0-9778-e7c2a70573e1



Replace the value

b9c7a824-4bde-06c0-9778-e7c2a70573e1

with your subscription id.







Modify instance





Now you are ready to change the characteristics of the instance using

az sql mi update

command:






az sql mi update -g mi_group -n jovanpop-temp-mi –storage 64



This command might be very useful if you need to

scale up

or

scale down

the instance by changing the assigned storage size limit or number of cores.



The parameters that can be provided to this command are:






  • -g resource group




  • -n name of the instance




  • –storage new max instance size




  • –capacity new number of cores that will be assigned to instance




  • –admin-password new administrator password




  • –license-type  new licence type can be

    BasePrice

    or

    LicenseIncluded







Note that update process is not instance. If you have bigger instances, Azure would need to move all databases on the virtual machine that has enough resources to host your instance with the new size.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.