TIP
🔥 Download the FREE Azure Developer Guide eBook here (opens new window).
💡 Learn more : What is Azure SQL Managed Instance? (opens new window).
📺 Watch the video : How to enable Azure SQL managed instance in Azure Arc - Part 3 (opens new window).
# 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:
- An Azure subscription (If you don't have an Azure subscription, create a free account (opens new window) before you begin)
- You need to have an Arc-enabled server, with an Arc-enabled Kubernetes cluster. You can follow part 1 (opens new window) and part 2 of this series of posts (opens new window) to get started.
# 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.
- 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}
- 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}
- Next, go to the Azure portal (opens new window)
- Search for "Azure Arc" in the search box and click on the result. You will now see the Azure Arc overview blade
- Navigate to the Kubernetes clusters menu
- You'll see the connected Kubernetes cluster. Click on it
- Click on the Extensions menu
- Click Add
- Select Azure Arc data controller, and click Create. We need this to enable Azure Arc data services
- Fill in a name for the data controller
- Create a new Custom location by filling in a Name and Namespace. We'll use this later to deploy the SQL Managed Instance
- Select the Kubernetes configuration template that best resembles your Kubernetes cluster
- Pick the network Service Type
- 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)
- Fill in the details of the Service Principal that we created earlier
- Click Next: Additional Settings
(Create Azure Arc data controller)
- Uncheck the "Enable logs upload" setting
- Click Next: Tags
- 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.
- In the Arc resource in the Azure portal, navigate to the SQL Managed Instances menu
- Click Create
- Select the Resource group that contains the Arc-enabled Kubernetes cluster
- Pick the Custom location that the data controller created
- For Service type, select LoadBalancer
- Fill in the credentials for the Managed Instance with the Login and Password. You'll need these to log into the SQL Managed Instance
- 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!