Share via

Removing Az synpase trigger

natalie 6 Reputation points Microsoft Employee
2021-10-25T22:39:55.26+00:00

I am trying to remove all triggers from a synapse workspace. However, I havent been able to delete them.

For example, I get the workspace, get the triggers. I checked I have the triggers. However when I try to delete I get the same outcome(not deleted as the remove-AzSynapseTrigger returns a bool).

$workspace = Get-AzSynapseWorkspace -Name $WorkspaceName
$currentTriggers = $workspace | Get-AzSynapseTrigger
Write-Host "Current triggers" $currentTriggers

foreach($trigger in $currentTriggers) {
    $triggerName = $trigger.Name
    Write-Host "Starting Deletion trigger with Force" $triggerName
    $isTriggerDeleted = $workspace | Remove-AzSynapseTrigger -Name $triggerName -Force
    if ($isTriggerDeleted -eq $true){
        Write-Host "Deleted trigger" $triggerName
    }
    else {
        Write-Host "The trigger was not deleted" $triggerName
    }
}

Only difference is that if i dont include the Force i get the option to confirm yes or no, and get a Object reference not set to an instance of an object.. But if include the "Force" i just dont get any errors, but the Trigger still is not deleted.

Are you sure you want to remove trigger 'DeviceBatteryDataToReportingTrigger'?
2021-10-22 22:48:57.547323: [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): [91mRemove-AzSynapseTrigger: [0m/package/unarchive/DeployTrigger.ps1:101
2021-10-22 22:48:57.547364: [96mLine |
2021-10-22 22:48:57.547404: [96m 101 | [0m \N{HORIZONTAL ELLIPSIS} erDeleted = [96mRemove-AzSynapseTrigger -WorkspaceName $workspaceName -Na [0m \N{HORIZONTAL ELLIPSIS}
2021-10-22 22:48:57.547451: [96m | [91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-10-22 22:48:57.547481: [91m [96m | [91mObject reference not set to an instance of an object.
2021-10-22 22:48:57.547494: [0m
2021-10-22 22:48:58.150885: The trigger was not deleted DeviceBatteryDataToReportingTrigger

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.


1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA 91,866 Reputation points
    2021-11-02T10:14:26.587+00:00

    Hello @natalie ,

    Thanks for the question and using MS Q&A platform.

    Could you please confirm if the trigger’s runtime state is “Started”? You can get the state by (Get-AzSynapseTrigger -WorkspaceName wsname -Name triggername).Properties.RuntimeState

    If the state of trigger is “Started”, you should first stop it, then the trigger can be deleted successfully. You can stop the trigger by run: Stop-AzSynapseTrigger -WorkspaceName wsname -Name triggername.

    145738-image.png

    Note: Any changes made via SDK, PowerShell will not be synced with the Synapse workspace linked with any source control. You can see the changes in the live mode.

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.