Disconnect SQL Server instances from Azure Arc

Applies to: SQL Server

This article describes how you can disconnect SQL Server instances from Azure Arc by using the Azure portal or a command shell. It applies to SQL Server instances enabled by Azure Arc.

Prerequisites

Your Azure account must have a Contributor role for the instance subscription and resource group.

Note

You don't need access to the hosting machine to disconnect from Azure Arc.

Opt out of automatic installation

Before you uninstall Azure Extension for SQL Server, opt out of automatic installation of the extension by adding the following tag and value to the Azure Arc-enabled SQL Server resource:

Tag Value
ArcSQLServerExtensionDeployment Disabled

Alternatively, you can limit which extensions can be installed on your server. You can configure lists of the extensions that you want to allow and block on the server. To learn more, see Allowlists and blocklists.

Uninstall Azure Extension for SQL Server

To uninstall Azure Extension for SQL Server:

  1. In the Azure portal, go to Azure Arc.
  2. Under Machines, select the specific server that hosts the SQL Server instance.
  3. Under Extensions, select the extension that you want to uninstall (WindowsAgent.SqlServer if it's a Windows machine, or LinuxAgent.SqlServer if it's a Linux machine).
  4. Select Uninstall.
  5. When you're prompted, confirm that you want to uninstall the extension.

To remove the SQL Server - Azure Arc resource:

  1. In the Azure portal, go to Azure Arc.
  2. Under SQL Server instances, select the specific SQL Server instance that you want to remove.
  3. Select Delete.
  4. When you're prompted, confirm that you want to delete the resource.

To disconnect all the Azure Arc-enabled SQL Server instances in a larger scope (such as a resource group, a subscription, or multiple subscriptions) with a single command, use the script to uninstall Azure Extension for SQL Server. The script is as an open-source SQL Server sample and includes step-by-step instructions.

Residual files and accounts

After you uninstall Azure Extension for SQL Server, some files and database objects stay.

Files

Uninstalling the extension deletes the binary files, but extension logs and other data might not be deleted.

Disabling the extension doesn't delete any binary files or folders.

Tables

Tables that the agent created stay after you uninstall the extension.

Accounts

If you didn't install the extension in least privilege mode, the agent uses the NTAUTHORITY\SYSTEM account.

Disabling or deleting the extension doesn't remove the NTAUTHORITY\SYSTEM login from any databases because other applications might require this login. You have to manually remove the role from each user database.

An NTAUTHORITY\SYSTEM account doesn't apply to installations that use least privilege.

For details about least privilege mode, see Operate SQL Server enabled by Azure Arc with least privilege.