| title | Disconnect SQL Server Instances from Azure Arc | |
|---|---|---|
| description | Get steps to disconnect and unregister your SQL Server instances from Azure Arc. | |
| author | MikeRayMSFT | |
| ms.author | mikeray | |
| ms.reviewer | randolphwest | |
| ms.date | 05/08/2026 | |
| ms.topic | how-to | |
| ms.custom |
|
[!INCLUDE sqlserver]
This article describes how to 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. To stop managing a SQL Server instance with Azure Arc, remove the SQL Server extension. After you complete these steps, SQL Server - Azure Arc resources and associated components are fully removed from your system and Azure.
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.
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 Allow lists and block lists.
To uninstall Azure Extension for SQL Server:
- In the Azure portal, go to Azure Arc.
- Under Machines, select the specific server that hosts the SQL Server instance.
- Under Extensions, select the extension that you want to uninstall (
WindowsAgent.SqlServerif it's a Windows machine, orLinuxAgent.SqlServerif it's a Linux machine). - Select Uninstall.
- When prompted, confirm that you want to uninstall the extension.
To remove the SQL Server - Azure Arc resource:
- In the Azure portal, go to Azure Arc.
- Under SQL Server instances, select the specific SQL Server instance that you want to remove.
- Select Delete.
- When prompted, confirm that you want to delete the resource.
To remove dependent resources from a resource group:
- In the Azure portal, go to the resource group where the SQL Server resource was.
- Under Overview, select the specific SQL Server resource and resources that you want to remove.
- Select Delete.
- When prompted, confirm that you want to delete the resources.
To uninstall Azure Extension for SQL Server, run:
Remove-AzConnectedMachineExtension -MachineName "{your machine name}" -ResourceGroup "{your resource group name}" -Name "{extension name}" -NoWaitFor Windows machines, use the extension name WindowsAgent.SqlServer. For Linux machines, use the extension name LinuxAgent.SqlServer.
To remove the SQL Server - Azure Arc resource, run:
remove-azresource -ResourceGroup "{your resource group name}" -ResourceType Microsoft.AzureArcData/SqlServerInstances -Name "{full SQL instance name}" -ForceIf your instance (SQL Server - Azure Arc resource) has dependent Azure resources such as databases (SQL Server database - Azure Arc resource), this command might take a long time to finish. You can add an -AsJob parameter to return immediately and run the command as a background job.
Tip
Run the script from Azure Cloud Shell. It has the required Azure PowerShell modules preinstalled, and you're authenticated automatically. For details, see Running the script using Cloud Shell.
To uninstall Azure Extension for SQL Server, run:
az connectedmachine extension delete --machine-name "{your machine name}" --resource-group "{your resource group name}" --name "{OS}Agent.SqlServer" --publisher "Microsoft.AzureData"
To remove the SQL Server - Azure Arc resource, run:
az resource delete --resource-group "{your resource group name}" --resource-type Microsoft.AzureArcData/SqlServerInstances --name "{full SQL instance name}"
If your instance (SQL Server - Azure Arc resource) has dependent Azure resources, such as SQL Server databases, this command might take a long time to finish. You can add the --No-Wait parameter to return immediately and run the command as a background job.
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 an open-source SQL Server sample and includes step-by-step instructions.
[!INCLUDE resource-caching-after-deletion]
After you uninstall Azure Extension for SQL Server, some files and database objects remain.
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 created by the agent remain after you uninstall the extension.
If you don't install the extension in least privilege mode, the agent uses the NT AUTHORITY\SYSTEM account.
Disabling or deleting the extension doesn't remove the NT AUTHORITY\SYSTEM login from any databases because other applications might require this login. You must manually remove the login from each user database.
An NT AUTHORITY\SYSTEM account doesn't apply to installations that use least privilege.
For more information about least privilege mode, see Operate SQL Server enabled by Azure Arc with least privilege.