title | description | author | ms.author | ms.reviewer | ms.date | ms.topic | ms.custom | |
---|---|---|---|---|---|---|---|---|
Disconnect SQL Server instances from Azure Arc |
Get steps to disconnect and unregister your SQL Server instances from Azure Arc. |
MikeRayMSFT |
mikeray |
randolphwest |
09/09/2024 |
how-to |
|
[!INCLUDE sqlserver]
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.
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 Allowlists and blocklists.
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.SqlServer
if it's a Windows machine, orLinuxAgent.SqlServer
if it's a Linux machine). - Select Uninstall.
- When you're 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 you're prompted, confirm that you want to delete the resource.
To uninstall Azure Extension for SQL Server, run:
Remove-AzConnectedMachineExtension -MachineName "{your machine name}" -ResourceGroup "{your resource group name}" -Name "{extension name}" -NoWait
For Windows machines, the extension name is WindowsAgent.SqlServer
. For Linux machines, the extension name is 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}" -Force
If 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'll be 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 as an open-source SQL Server sample and includes step-by-step instructions.
After you uninstall Azure Extension for SQL Server, some files and database objects stay.
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 that the agent created stay after you uninstall the extension.
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.