Jump to content

Using Azure Policy to onboard multiple SQL Servers at scale to Azure Arc-enabled SQL Server - Part 1

Featured Replies

Posted

The demand for deploying agents in bulk on on-premise SQL servers is increasing, and manual deployment of the agent in bulk is a highly time-consuming task.

 

 

 

Azure Arc-enabled SQL Server extends Azure services to SQL Server instances hosted outside of Azure: in your data center, in edge site locations like retail stores, or any public cloud or hosting provider. It's worth noting that the SQL Server instance that you intend to enable with Azure Arc can be installed on a virtual or physical machine running either Windows or Linux.

 

 

 

To onboard a Azure Arc-enabled SQL server, If your SQL Server instance is not yet connected to Azure, you can initiate the connection process from the target machine by using the onboarding script. This script connects the server to Azure and installs the Azure extension specifically for SQL Server. Assuming that your server is already connected to Azure, you can proceed directly to the section titled "When the machine is already connected to an Arc-enabled Server."

 

 

 

You can refer to the table below to compare each method and decide which one suits your deployment needs best. For more in-depth information, click on the links to view the steps for each topic.

 

 


Method

Description

Interactively

Manually connect the SQL Server instance on a single physical or virtual machine that is not currently connected to Azure Arc. Connect when machine not connected to Azure

Interactively

Connect your SQL Server to Azure Arc with installer (.msi)

Interactively

Manually connect the SQL Server on a single physical or virtual machine that is already connected to Azure Arc. Connect your SQL Server to Azure Arc on a server already connected to Azure Arc

At scale

Automatically connect Azure Arc-enabled SQL Servers

At scale

Connect SQL Servers at scale using Azure policy

At scale

Connect SQL Server at scale using script

At scale

Connect SQL Server machines at scale with a Configuration Manager custom task sequence

 

 

 

If you're planning to onboard hundreds of instances, it's recommended to scale the Arc extension installation either through Azure policy or with a PowerShell script remotely. However, using Azure policy would be a much easier approach for managing a large number of instances, compared to manually executing a PowerShell script. Using Azure Policy to install the SQL Server extension at scale on Arc-enabled SQL Server instances can be an efficient and effective solution, particularly for large environments with many servers to manage. When the policy is applied to a group of servers, it will automatically trigger the installation of the SQL Server extension on each server in the group. This can save a significant amount of time and effort compared to manually installing the extension on each server individually.

 

 

 

largevv2px999.thumb.png.60d3e039edebf1c63bae362b887c32a8.png

 

 Azure Arc-enabled SQL Server architecture

 

 

 

In this particular blog post, I covered on how to simplify onboarding multiple SQL Servers to Azure Arc-enabled SQL Server at scale using Azure policy.

 

 

 

Prerequisites

 

Use Azure Policy to connect multiple SQL Servers at Scale

 

 

  1. Navigate to the ArcSql-Levelup resource group, and then select the "Policies" option as depicted in the screenshot below. It's worth mentioning that policies can be enabled at either subscription or management group level, but for the purpose of this lab, we will enable them at the resource group level.

 

largevv2px999.png.7f25497b339ea4b7da23b7305dfca149.png

 

 

 

 

 

  1. Go to Assignments and click on Assign policy.

 

largevv2px999.png.7069b86df05a7ec34e032a1fcd6d10dc.png

 

 

 

 

 

  1. Click on ellipsis against Policy definition field to select and assign policy.

 

largevv2px999.thumb.png.aa86bee6870562266ac756a0a0da90fc.png

 

 

 

 

 

  1. Enter "SQL Server extension" in the search field to search for SQL Server extension and assign policy, select “Configure Arc-enabled machines running SQL Server to have SQL Server extension installed” policy and click Add.

  • You have the option to automatically connect SQL Server instances on multiple Arc-enabled machines by utilizing an Azure policy definition called "Configure Arc-enabled machines running SQL Server to have SQL Server extension installed."
  • By default, this policy definition isn't assigned to any specific scope. However, once you assign this policy definition to a chosen scope, it installs the Azure extension for SQL Server on all Azure Arc-enabled servers where SQL Server is installed. Once the extension is installed, it connects the SQL Server instances on the machine with Azure and continuously runs to detect changes to the SQL Server configuration and synchronize them with Azure.

 

largevv2px999.thumb.png.c14a2f01bead08ae5bfabfa7ed78fcfb.png

 

 

 

  1. Leave the policy name suggested by Azure portal and make sure policy is enabled and click on Next.

 

largevv2px999.thumb.png.95aac1de4927746e58011c9dd1a2f965.png

 

 

 

 

 

  1. Click on Next again until you are in Remediation tab as shown in the screenshot below and select “Create a remediation task” check box to address non-compliance of SQL Servers. Review all the parameters highlighted and make sure they match in your policy definition and click Next.

 

largevv2px999.thumb.png.c0c7f734d2534e2bcb83ea8981334ac6.png

 

 

 

 

 

  1. Enter resource non-compliant message as shown below or chose your own message and click “Review + Create”.

 

largevv2px999.png.709af50a281ed04dea2bd94ea2026fa1.png

 

 

 

 

 

8. Review all the policy information and click Create.

 

 

 

largevv2px999.thumb.png.fdc356c2d2cde85ab2f8b0bcb122d6d6.png

 

 

 

 

 

  1. Once policy is created you will see this policy under Policy assignments as shown in the screenshot below.

 

largevv2px999.png.a5cf65d7505e142c2b7fb0a7c0947591.png

 

 

 

  1. Click on Remediation under Policy Authoring and then select Remediation tasks tab as shown the in the screenshot below to view Remediation task status. This will take some time to assess Arc-enabled servers for SQL Server extension status and remediate by installing SQL Server extension.

 

largevv2px999.png.2f2ec49f6f2e21a3ea8cfbaa8b57fdc6.png

 

 

 

 

 

11. Allow sometime to apply remediation and check status by clicking Refresh.

 

largevv2px999.png.8e6369bde6bb446caa4bfd39262e376c.png

 

 

 

  1. Click anywhere on the remediation task to view remediated resources.

 

largevv2px999.thumb.png.9ba607e5e065a1bb6ddb0d7b3e02913f.png

 

 

 

  1. Click on one of the servers to view SQL Server extension installed on the Arc-enabled server resource.

 

largevv2px999.png.7fe9f120eb68b5f80da836800e877b90.png

 

 

 

 

 

  1. Go to ArcSql-Levelup resource group and verify Arc-enabled SQL Server resources are created.

 

largevv2px999.png.e89e005b4d30ec620b8b7c7f5eeab065.png

 

 

 

Summary:

 

In this blog post, I covered on how to simplify Onboarding multiple SQL Servers to Azure Arc-enabled SQL Server at scale using Azure policy. Azure Policy can certainly be an efficient way to install the SQL Server extension at scale on Arc-enabled SQL Server instances.

 

In case you're interested in learning more about deployment options for Azure Arc enabled SQL Server, you can refer to the following Microsoft Docs article.

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...