DEV Community

Cover image for Pausing Dedicated SQL Pools with Synapse Pipelines
Jared Westover
Jared Westover

Posted on • Edited on

Pausing Dedicated SQL Pools with Synapse Pipelines

This article was inspired by a Microsoft article 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

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

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
  3. Select the Settings tab then click in the URL entry space, then select Add dynamic content. image
  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')
  5. Select the drop-down for Method and select GET.
  6. Select Advanced to expand the content. Select Managed Identity as the Authentication type. For Resource enter https://management.azure.com/ image

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
  3. Select the Activates tab then click in the Expression entry space, then select Add dynamic content. image
  4. 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
  6. Under Activities > General drag a Web activity to the True activities canvas.
  7. In the General tab, name this stage Pause image
  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
  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

Closing

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

Top comments (0)