Managed API reference for Azure SQL Database Managed Instances

You can create and manage Azure SQL Database Managed Instances using the Azure portal, PowerShell, Azure CLI, REST API, and Transact-SQL. In this article, you can find an overview of functions and API that you can use to create and configure Managed Instance.

Azure portal: Create a managed instance

For a quickstart showing you how to create an Azure SQL Database Managed Instance, see Quickstart: Create an Azure SQL Database Managed Instance.

PowerShell: Create and manage managed instances

Note

This article has been updated to use the new Azure PowerShell Az module. You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. For Az module installation instructions, see Install Azure PowerShell.

Important

The PowerShell Azure Resource Manager module is still supported by Azure SQL Database, but all future development is for the Az.Sql module. For these cmdlets, see AzureRM.Sql. The arguments for the commands in the Az module and in the AzureRm modules are substantially identical.

To create and manage managed instances with Azure PowerShell, use the following PowerShell cmdlets. If you need to install or upgrade PowerShell, see Install Azure PowerShell module.

Cmdlet Description
New-AzSqlInstance Creates an Azure SQL Database Managed Instance
Get-AzSqlInstance Returns information about Azure SQL Managed Instance
Set-AzSqlInstance Sets properties for an Azure SQL Database Managed Instance
Remove-AzSqlInstance Removes an Azure SQL Managed Database Instance
New-AzSqlInstanceDatabase Creates an Azure SQL Database Managed Instance database
Get-AzSqlInstanceDatabase Returns information about Azure SQL Managed Instance database
Remove-AzSqlInstanceDatabase Removes an Azure SQL Managed Database Instance database
Restore-AzSqlInstanceDatabase Restores an Azure SQL Managed Database Instance database

Azure CLI: Create and manage managed instances

To create and manage managed instances with Azure CLI, use the following Azure CLI SQL Managed Instance commands. Use the Cloud Shell to run the CLI in your browser, or install it on macOS, Linux, or Windows.

Tip

For an Azure CLI quickstart, see Working with SQL Managed Instance using Azure CLI.

Cmdlet Description
az sql mi create Creates a Managed Instance
az sql mi list Lists available Managed Instances
az sql mi show Get the details for a Managed Instance
az sql mi update Updates a Managed Instance
az sql mi delete Removes a Managed Instance
az sql midb create Creates a managed database
az sql midb list Lists available managed databases
az sql midb restore Restore a managed database
az sql midb delete Removes a managed database

Transact-SQL: Create and manage instance databases

To create and manage instance database after the Managed Instance is created, use the following T-SQL commands. You can issue these commands using the Azure portal, SQL Server Management Studio, Azure Data Studio. Visual Studio Code, or any other program that can connect to an Azure SQL Database server and pass Transact-SQL commands.

Tip

For quickstarts showing you have to configure and connect to a Managed Instance using SQL Server Management Studio on Microsoft Windows, see Quickstart: Configure Azure VM to connect to an Azure SQL Database Managed Instance and Quickstart: Configure a point-to-site connection to an Azure SQL Database Managed Instance from on-premises.

Important

You cannot create or delete a Managed Instance using Transact-SQL.

Command Description
CREATE DATABASE Creates a new Managed Instance database. You must be connected to the master database to create a new database.
ALTER DATABASE Modifies an Azure SQL Managed Instance database.

REST API: Create and manage managed instances

To create and manage Managed Instances, use these REST API requests.

Command Description
Managed Instances - Create Or Update Creates or updates a Managed Instance.
Managed Instances - Delete Deletes a Managed Instance.
Managed Instances - Get Gets a Managed Instance.
Managed Instances - List Returns a list of Managed Instances in a subscription.
Managed Instances - List By Resource Group Returns a list of Managed Instances in a resource group.
Managed Instances - Update Updates a Managed Instance.

Next steps