Pausing Dedicated SQL Pools with Synapse Pipelines
Tags: azure, synapse, sql, tutorial
Published: 2021-08-09 17:37:38

This article was inspired by a Microsoft [article](https://docs.microsoft.com/en-us/azure/synapse-analytics/sql/how-to-pause-resume-pipelines) on the same subject. I would highly recommend reviewing the original. What follows is an attempt to simplify the process and focus only on pausing the dedicated pool.

##Step 1: Create a New Pipeline in Synapse Studio
1. Navigate to your workspace and open Synapse Studio.
2. Click the Integrate icon, then select the ***+*** sign to create a new pipeline.
3. Name your pipeline *PausePool*.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wr45uffolydw1cp2zd32.png)

##Step 2: Create Pipeline Parameters
1. Select the **Parameters** tab near the bottom of the pipeline screen. 
2. Select **+New** to create each of the following parameters:

Name | Type | Default Values
------------ | ------------- | -------------
ResourceGroup | string | Name of your resource group
SubscriptionID | string | Subscription Id of your resource group
WorkspaceName | string | Name of your workspace
SQLPoolName | string | Name of your dedicated SQL pool

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1i1yjtwx4cc2h08oqh7u.png)

##Step 3: Check the Dedicated Pool State
1. Under **Activities** > **General** drag a Web activity to the pipeline canvas as the first stage of your pipeline.
2. In the **General** tab, name this stage Check State.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c1b81jtkhx8wz2p536d6.png)
3. Select the Settings tab then click in the URL entry space, then select Add dynamic content.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ymabz96fr87pst4e61od.png)
4. Copy and paste the GET request that has been parameterized using the @concat string function below into the dynamic content box. Select **Finish**. The following code is a simple GET request:
    ``
@concat('https://management.azure.com/subscriptions/',pipeline().parameters.SubscriptionID,'/resourceGroups/',pipeline().parameters.ResourceGroup,'/providers/Microsoft.Synapse/workspaces/',pipeline().parameters.WorkspaceName,'/sqlPools/',pipeline().parameters.SQLPoolName,'?api-version=2021-03-01')
     ``
1. Select the drop-down for Method and select **GET**.
1. Select Advanced to expand the content. Select Managed Identity as the Authentication type. For Resource enter `https://management.azure.com/`
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i2dje1kgbtt90w74b9vu.png)

##Step 4: Add an If Condition to Pause
 
1. Under **Activities** > **Iteration & conditionals** drag an If condition activity to the pipeline canvas as the second stage of your pipeline.
2. In the **General** tab, name this stage *Pause If Online*.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tmqum03aswtmuqdvivkq.png)
3. Select the **Activates** tab then click in the **Expression** entry space, then select **Add dynamic content**.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e536xmfr9q7f0778pid8.png)
7. Copy and paste the expression below into the dynamic content box. Select **Finish**. The following code is an expression which returns True if the status is Online:
    ``
@equals(activity('Check State').output.properties.status,'Online')
    ``
5. On the Activities tab, select the edit icon for the True case.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5qqsfblbufacepfc8k51.png)
6. Under **Activities** > **General** drag a Web activity to the True activities canvas.
7. In the **General** tab, name this stage *Pause*
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ehkdhsobi9jj877nuouu.png)
8. Copy and paste the POST request that has been parameterized using the @concat string function below into the dynamic content box. Select **Finish**. The following code is a simple Get request:
    ``@concat('https://management.azure.com/subscriptions/',pipeline().parameters.SubscriptionID,'/resourceGroups/',pipeline().parameters.ResourceGroup,'/providers/Microsoft.Synapse/workspaces/',pipeline().parameters.WorkspaceName,'/sqlPools/',pipeline().parameters.SQLPoolName,'/pause?api-version=2021-03-01')
    ``
9. Select the drop-down for **Method** and select **POST**.
10. In the Body section type *Pause*.
11. Select **Advanced** to expand the content. Select **Managed Identity** as the Authentication type. For Resource enter `https://management.azure.com/`
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/es0q4xqjdrgieh8wg5at.png)
12. You can run your pipeline by selecting **Debug** mode. After your debug is successful, you can add a trigger to schedule the pipeline execution.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ig3xp5wi15shkxvvy0y.png)

##Closing
I hope you found this article helpful. Would you mind letting me know of any comments or questions you have below?