Skip to content

Latest commit

 

History

History
60 lines (41 loc) · 2.7 KB

File metadata and controls

60 lines (41 loc) · 2.7 KB
title Azure CLI example: Create a managed instance
description Use this Azure CLI example script to create a managed instance in Azure SQL Managed Instance.
author urosmil
ms.author urmilano
ms.reviewer mathoma
ms.date 02/26/2024
ms.service azure-sql-managed-instance
ms.subservice deployment-configuration
ms.topic sample
ms.custom devx-track-azurecli
ms.devlang azurecli

Create an Azure SQL Managed Instance using the Azure CLI

[!INCLUDEappliesto-sqldb]

This Azure CLI script example creates an Azure SQL Managed Instance in a dedicated subnet within a new virtual network. It also configures a route table and a network security group for the virtual network. Once the script has been successfully run, the managed instance can be accessed from within the virtual network or from an on-premises environment. See Configure Azure VM to connect to an Azure SQL Managed Instance and Configure a point-to-site connection to an Azure SQL Managed Instance from on-premises.

Important

For limitations, see supported regions and supported subscription types.

[!INCLUDE quickstarts-free-trial-note]

[!INCLUDE azure-cli-prepare-your-environment.md]

Sample script

[!INCLUDE cli-run-local-sign-in.md]

Run the script

:::code language="azurecli" source="~/../azure_cli_scripts/sql-database/managed-instance/create-managed-instance.sh" id="FullScript":::

Clean up resources

[!INCLUDE cli-clean-up-resources.md]

az group delete --name $resourceGroup

Sample reference

This script uses the following commands. Each command in the table links to command specific documentation.

Command Description
az network vnet Virtual network commands.
az network vnet subnet Virtual network subnet commands.
az network route-table Network route table commands.
az sql mi SQL Managed Instance commands.
az sql midb Database commands for SQL Managed Instance.

Next steps

For more information on Azure CLI, see Azure CLI documentation.

Other SQL Database CLI script samples can be found in the Azure SQL Database documentation.