Skip to content

Latest commit

 

History

History
116 lines (78 loc) · 6.06 KB

create-template-quickstart.md

File metadata and controls

116 lines (78 loc) · 6.06 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic ms.custom
Azure Resource Manager: Create an Azure SQL Managed Instance
Learn how to create an Azure SQL Managed Instance by using an Azure Resource Manager template.
urosmil
urmilano
mathoma
06/22/2020
azure-sql-managed-instance
deployment-configuration
quickstart
subject-armqs, mode-arm, devx-track-arm-template, ignite-2023

Quickstart: Create an Azure SQL Managed Instance using an ARM template

This quickstart focuses on the process of deploying an Azure Resource Manager template (ARM template) to create an Azure SQL Managed Instance and vNet. Azure SQL Managed Instance is an intelligent, fully managed, scalable cloud database, with almost 100% feature parity with the SQL Server database engine.

[!INCLUDE About Azure Resource Manager]

If your environment meets the prerequisites and you're familiar with using ARM templates, select the Deploy to Azure button. The template will open in the Azure portal.

Deploy to Azure

Prerequisites

  • An Azure subscription. If you don't have an Azure subscription, create a free account
  • In the general case, your user needs to have the role SQL Managed Instance Contributor assigned at subscription scope.
  • If provisioning in a subnet that is already delegated to Azure SQL Managed Instance, your user only needs the Microsoft.Sql/managedInstances/write permission assigned at subscription scope.

Review the template

The template used in this quickstart is from Azure Quickstart Templates.

:::code language="json" source="~/../quickstart-templates/quickstarts/microsoft.sql/sqlmi-new-vnet/azuredeploy.json":::

These resources are defined in the template:

More template samples can be found in Azure Quickstart Templates.

Deploy the template

Select Try it from the following PowerShell code block to open Azure Cloud Shell.

Important

Deploying a managed instance is a long-running operation. Deployment of the first instance in the subnet typically takes much longer than deploying into a subnet with existing managed instances. For average provisioning times, see SQL Managed Instance management operations.

$projectName = Read-Host -Prompt "Enter a project name that is used for generating resource names"
$location = Read-Host -Prompt "Enter the location (i.e. centralus)"
$templateUri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.sql/sqlmi-new-vnet/azuredeploy.json"

$resourceGroupName = "${projectName}rg"

New-AzResourceGroup -Name $resourceGroupName -Location $location
New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri $templateUri

Read-Host -Prompt "Press [ENTER] to continue ..."
read -p "Enter a project name that is used for generating resource names:" projectName &&
read -p "Enter the location (i.e. centralus):" location &&
templateUri="https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.sql/sqlmi-new-vnet/azuredeploy.json" &&
resourceGroupName="${projectName}rg" &&
az group create --name $resourceGroupName --location "$location" &&
az deployment group create --resource-group $resourceGroupName --template-uri  $templateUri &&
echo "Press [ENTER] to continue ..." &&
read

Review deployed resources

Visit the Azure portal and verify the managed instance is in your selected resource group. Because creating a managed instance can take some time, you might need to check the Deployments link on your resource group's Overview page.

Clean up resources

Keep the managed instance if you want to go to the Next steps, but delete the managed instance and related resources after completing any additional tutorials. After deleting a managed instance, see Delete a subnet after deleting a managed instance.

To delete the resource group:

$resourceGroupName = Read-Host -Prompt "Enter the Resource Group name"
Remove-AzResourceGroup -Name $resourceGroupName
echo "Enter the Resource Group name:" &&
read resourceGroupName &&
az group delete --name $resourceGroupName

Next steps

[!div class="nextstepaction"] Configure an Azure VM to connect to Azure SQL Managed Instance