LinkedService in Deleting state but not actually being deleted

Victor Seifert 131 Reputation points

I'm running the following command via a Azure Powershell job in my Release Pipeline in Azure DevOps:

Install-Module Az.Synapse -RequiredVersion 0.7.0 -Scope CurrentUser -Force  
Remove-AzSynapseLinkedService -WorkspaceName <SYNAPSE_WORKSPACE_NAME> -Name <LINKED_SERVICE_NAME> -Force  

And I get the following error message:

"The LinkedService <LINKED_SERVICE_NAME> is in Deleting state and cannot be deleted"  

It's been like this since Friday and there is no change to the state of the LinkedService - in Synapse I cannot see the LinkedService, but I also cannot create a new LinkedService with the same name. What should I do?


2022-07-11T07:11:50.6334463Z ========================== Starting Command Output ===========================  
2022-07-11T07:11:50.6648727Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a\_temp\1a41210a-35c1-4fae-8168-b2bc3a6419a8.ps1'"  
2022-07-11T07:11:53.1993963Z ##[command]Import-Module -Name C:\Modules\az_3.1.0\Az.Accounts\2.2.5\Az.Accounts.psd1 -Global  
2022-07-11T07:11:54.6109653Z WARNING: Both Az and AzureRM modules were detected on this machine. Az and AzureRM modules cannot be imported in the   
2022-07-11T07:11:54.6111459Z same session or used in the same script or runbook. If you are running PowerShell in an environment you control you can  
2022-07-11T07:11:54.6113846Z  use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine. If you are running in Azure   
2022-07-11T07:11:54.6115289Z Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found   
2022-07-11T07:11:54.6116410Z here:  
2022-07-11T07:11:56.3352902Z ##[command]Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue  
2022-07-11T07:11:57.0705619Z ##[command]Clear-AzContext -Scope Process  
2022-07-11T07:11:57.2000958Z ##[command]Connect-AzAccount -ServicePrincipal -Tenant XXXXXXXXXXXXXXXXXXXXXXXXX -Credential System.Management.Automation.PSCredential -Environment AzureCloud @processScope  
2022-07-11T07:12:03.7777152Z ##[command] Set-AzContext -SubscriptionId XXXXXXXXXXXXXXXXXXXXXXXXX -TenantId XXXXXXXXXXXXXXXXXXXXXXXXX  
2022-07-11T07:15:00.1756112Z ##[error]Service request failed.  
Status: 409 (Conflict)  
{"Message":"The LinkedService <LINKED_SERVICE_NAME> is in Deleting state and cannot be deleted"}  
Strict-Transport-Security: REDACTED  
x-ms-request-id: REDACTED  
x-ms-client-request-id: XXXXXXXXXXXXXXXXXXXXXXXXX  
Content-Length: 95  
Content-Type: application/json; charset=utf-8  
Date: Mon, 11 Jul 2022 07:14:59 GMT  
Server: Microsoft-HTTPAPI/2.0  
2022-07-11T07:15:00.3233761Z ##[error]PowerShell exited with code '1'.  
Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,140 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Victor Seifert 131 Reputation points

    After some very successful calls with the MS support figurd out the problem was that the linked services has been deleted in ADF and got stuck in Resource provider.

    Whatever magic the support worked, I was able to delete the service later on and now it's business as usual.

    1 person found this answer helpful.