Synapse Stop and Restart Triggers missing in Github Actions

Rhuan Samary Barreto 90 Reputation points
2023-05-05T07:14:51.46+00:00

In the following link:

https://learn.microsoft.com/en-us/azure/synapse-analytics/cicd/continuous-integration-delivery#configure-the-deployment-task

There is a way for stopping and restarting triggers in Azure DevOps Release pipeline. But this is missing for Github Actions. The only thing we have available is to deploy/validate templates.

How can I stop and restart triggers so they can be automatically deployed using Github Actions?

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,696 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bhargava-MSFT 29,266 Reputation points Microsoft Employee
    2023-05-06T18:21:08.6933333+00:00

    Hello Rhuan Samary Barreto,

    Welcome to the MS Q&A platform.

    To stop a trigger, you can include the below code in the workspace template.

    az synapse trigger stop --name "myTrigger" --workspace-name "myWorkspace"

    To start a trigger:

    az synapse trigger start --name "myTrigger" --workspace-name "myWorkspace"
    
    

    To stop all triggers in a Synapse workspace using the az synapse trigger stop command, you can use the az synapse trigger list command to get a list of all triggers in the workspace, and then loop through the list to stop each trigger.

    # Set the workspace name and resource group name
    workspaceName="myWorkspace"
    resourceGroupName="myResourceGroup"
    
    # Get the list of triggers in the workspace
    triggerList=$(az synapse trigger list --workspace-name $workspaceName --resource-group $resourceGroupName --query "[].name" -o tsv)
    
    # Loop through the list of triggers and stop each one
    for triggerName in $triggerList
    do
      echo "Stopping trigger $triggerName"
      az synapse trigger stop --name $triggerName --workspace-name $workspaceName --resource-group $resourceGroupName
    done
    
    

    To start all triggers in the end:

    # Loop through the list of triggers and start each one
    for triggerName in $triggerList
    do
      echo "Starting trigger $triggerName"
      az synapse trigger start --name $triggerName --workspace-name $workspaceName --resource-group $resourceGroupName
    done
    
    

    I hope this helps. Please let me know if you have any further questions.

    0 comments No comments