{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Synapse/workspaces/triggers",
"apiVersion": "2021-06-01-preview",
"name": "[concat(parameters('workspaceName'), '/', parameters('triggerName'))]",
"properties": {
"runtimeState": "[parameters('triggerState')]"
}
}
],
"parameters": {
"workspaceName": {
"type": "string",
"metadata": {
"description": "The name of the Synapse workspace"
}
},
"triggerName": {
"type": "string",
"metadata": {
"description": "The name of the Synapse pipeline trigger"
}
},
"triggerState": {
"type": "string",
"allowedValues": [
"Started",
"Stopped"
],
"metadata": {
"description": "The desired state of the Synapse pipeline trigger"
}
}
}
}
Explanation
To usethis template in your CI/CD pipeline, you will need to provide the necessary parameters (workspaceName
, triggerName
, and triggerState
) during the deployment process. You can integrate it with Azure DevOps or GitHub Actions.
This is how you can call this template using Azure CLI:
az deployment group create --resource-group <ResourceGroupName> \
--template-file <TemplateFilePath> \
--parameters workspaceName=<WorkspaceName> triggerName=<TriggerName> triggerState=<TriggerState>
In your CI/CD pipeline, you can add steps to first stop the triggers before deploying your artifacts and then start the triggers again after deployment.
- stage: Deploy
jobs:
- job: DeployArtifacts
steps:
- task: AzureCLI@2
inputs:
azureSubscription: 'AzureSubscription'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az deployment group create --resource-group <ResourceGroupName> --template-file stopTriggerTemplate.json --parameters workspaceName=<WorkspaceName> triggerName=<TriggerName> triggerState=Stopped
# Add steps to deploy your artifacts here
- task: AzureCLI@2
inputs:
azureSubscription: 'AzureSubscription'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az deployment group create --resource-group <ResourceGroupName> --template-file startTriggerTemplate.json --parameters workspaceName=<WorkspaceName> triggerName=<TriggerName> triggerState=Started