# How to enable Azure SQL managed instance in Azure Arc - Part 3

# Full control over a PaaS-enabled SQL Server

Azure SQL Managed Instance (opens new window) allows you to run SQL Server in your control, enabling you to adhere to your security and policy requirements. It also provides PaaS features like automatic patching and version updates, automated backups (opens new window) and high availability (opens new window), which make management easy.

Azure Arc-enabled SQL Managed Instance allows you to run your SQL Managed instance anywhere. All you need is a an Azure Arc-enabled Kubernetes (opens new window) cluster with a data controller (opens new window) in it.

In this third part of the three-part Azure Arc series, we'll use the Arc-enabled Kubernetes (opens new window) cluster to create a data controller and host a SQL Managed Instance in it.

# Prerequisites

If you want to follow along, you'll need the following:

# Create an Azure Arc-enabled SQL Managed Instance

Before we can deploy data services, like a SQL Managed Instance, we need to create an Azure Arc data controller in the Arc-enabled Kubernetes.

  1. First we need to create an Azure Service Principal (opens new window) that the data controller uses to send metrics to Azure Monitor. Run the script below in the Azure Cloud Shell (opens new window) to create the service principal, and replace {ServicePrincipalName}, {SubscriptionId}, and {resourcegroup}. Make sure to save the details of the Service Principal when it is created
az ad sp create-for-rbac --name {ServicePrincipalName} --role Contributor --scopes /subscriptions/{SubscriptionId}/resourceGroups/{resourcegroup}
  1. Now assign a role to the service principal. Replace {appId}, {SubscriptionID}, and {resourcegroup}.
az role assignment create --assignee {appId} --role 'Monitoring Metrics Publisher' --scope subscriptions/{SubscriptionID}/resourceGroups/{resourcegroup}
  1. Next, go to the Azure portal (opens new window)
  2. Search for "Azure Arc" in the search box and click on the result. You will now see the Azure Arc overview blade
  3. Navigate to the Kubernetes clusters menu
  4. You'll see the connected Kubernetes cluster. Click on it
  5. Click on the Extensions menu
  6. Click Add
  7. Select Azure Arc data controller, and click Create. We need this to enable Azure Arc data services
  8. Fill in a name for the data controller
  9. Create a new Custom location by filling in a Name and Namespace. We'll use this later to deploy the SQL Managed Instance
  10. Select the Kubernetes configuration template that best resembles your Kubernetes cluster
  11. Pick the network Service Type
  12. Fill in a data controller Login and Password. You need these when you want to log into the data controller from other applications, like Azure Data Studio (opens new window)
  13. Fill in the details of the Service Principal that we created earlier
  14. Click Next: Additional Settings

(Create Azure Arc data controller)

  1. Uncheck the "Enable logs upload" setting
  2. Click Next: Tags
  3. Select Next: Review + Create, and then Create

After creating the data controller, you'll find it in the Azure Arc resource in the Azure portal. And in the Custom locations menu, you'll find the location it created.

(Azure Arc Custom location)

Next, we can create an Arc-enabled SQL Managed Instance.

  1. In the Arc resource in the Azure portal, navigate to the SQL Managed Instances menu
  2. Click Create
  3. Select the Resource group that contains the Arc-enabled Kubernetes cluster
  4. Pick the Custom location that the data controller created
  5. For Service type, select LoadBalancer
  6. Fill in the credentials for the Managed Instance with the Login and Password. You'll need these to log into the SQL Managed Instance
  7. Click Review + Create and then Create

(Create an Arc-enabled SQL Managed Instance)

It can take a few minutes to create the Managed Instance. When it's done, you can find it through the Azure Arc resource in the Azure portal. Or in the list of SQL Managed Instances, where it looks and behaves just like other SQL Managed Instances. The only difference is that it runs on an Arc-enabled Kubernetes cluster that runs on my local machine.

(The Arc-enabled SQL Managed Instance in the Azure portal)

# Conclusion

Azure Arc enables you to run managed Azure services anywhere, including data services like Azure SQL Managed Instance (opens new window), on an Arc-enabled Kubernetes cluster (opens new window). Go and check it out!