Microsoft Fabric: Automating Fabric Capacity Scaling with Azure Logic Apps


In a previous post I explained how to manage the capacity costs of a Fabric F capacity (under Pay-As-You-Go pricing model) using Logic Apps to Suspend and Resume it.

A customer who read my previous blog asked me “Can we use a similar method to scale up and down before and after specific workloads?”. This blog post is to answer exactly that.

I want to make some important points clear first and before we dig deeper into the solution:

  • The method described in this post works with Fabric F SKUs under Pay-As-You-Go pricing model.
  • If you have a Power BI Premium capacity, then this method is not valid for your case. But you might be interested in the autoscale option for Power BI Premium capacities.
  • Depending on your current workload, scaling down may not work due to resource unavailability.
  • Depending on your workload, this method may take a while to go through.
  • You need to be either a Capacity Admin or a Fabric Admin to successfully implement this method.
  • This method works based on user authentication, however, you may want to use Service Principal or Manage Identity which require more effort but could be a more desirable method in many scenarios.
  • This post explains a very basic scenario, you’re welcome to scale it to your specific needs.
  • You can consider this post as a continuation of the previous post. So if you are unsure you correctly understand what this blog is trying to explain, then I suggest you read my previous post first where I explain the Logic Apps implementation in more detail.

The Problem

I have an F Fabric capacity and I want to upscale it to an upper tier between the pick-time from 8 AM to 12 PM local time, then downscale it to its original tier.

The Solution

There are many ways to do this including using Azure Resource Manager APIs, Manage Azure Resources in PowerShell, or using Azure Resource Manager connector that can be used on Azure Logic Apps, Power Automate Premium, and Power Apps Premium. This post explores the use of Azure Resource Manager connectors in Azure Logic Apps. With that, let’s begin.

  1. On Azure Portal, search for Logic apps
  2. Select the Logic Apps service
Select Azure Logic Apps on Azure Portal
Select Azure Logic Apps on the Azure Portal
  1. Click the Add button
  2. Pick a Subscription from the list
  3. Pick a Resource Group from the list or create a new one
  4. Enter the Logic App name
  5. Select the Region from the list
  6. Select No if you do not require to Enable log analytics
  7. Select Consumption from the Plan type
  8. Click the Review + create button
Create new Logic Apps service on Azure Portal
  1. Click the Create button
Confirm creating new Logic Apps service
  1. Navigate to the newly created Logic App and click the Edit button
  2. Select the Recurrence trigger
Use a Recurrence trigger on Azure Logic Apps
  1. Set the Interval to 1 Hour
  2. Add both Time zone and Start time parameters and set the desired values
Configure the Recurrence trigger
  1. Add a Condition action under the Control operation and use the following expression to check if the time is between 8 AM and 12 PM:

int(formatDateTime(convertFromUtc(utcNow(), 'New Zealand Standard Time'), 'HH'))

Use Condition Action on Azure Logic App
  1. On the True side of the condition, add a Create or update a resource action which could be found by searching for Azure resource manager operation
  2. After passing your credentials and signing in select the Subscription from the list
  3. Select the Resource Group from the list
  4. Select the Microsoft.Fabric from the Resource Provider list
  5. Enter capacities/your_capacity_name on the Short Resource Id (replace the “your_capacity_name” with your actual capacity name)
  6. Enter 2023-11-01 on the Client Api Version
  7. Add the Location and SKU Name parameters, then select the location of your capacity and enter the desired SKU you want to upscale
Use “Create or update a resource” action from “Azure resource manager” operation to upscale Fabric capacity SKU
  1. Repeat the steps from number 18 and add another Create or update a resource for the False side of the condition to downscale the SKU and save the solution
Use “Create or update a resource” action from “Azure resource manager” operation to downscale Fabric capacity SKU

The entire workflow must look like the following image:

Scaling Fabric Capacity with Logic Apps

That is it. The workflow will automatically run every hour and upscale the Fabric capacity to an F8 SKU if the time is between 8 AM and 12 PM, otherwise it ensures that the capacity SKU remains at F2 SKU.

Note

This Logic App successfully works only when the Fabric capacity is running. So if the capacity is suspended, then the flow will fail with the BadRequest, Service is not ready to be updated error. The reason for that is the Create or update a resource action from the Azure resource manager operation uses a PUT API method which requires the Fabric capacity to be running.

Conclusion

This blog post offers step-by-step guidance on automating the scaling of Microsoft Fabric F capacity using Azure Logic Apps and the Azure Resource Manager connector. I tried to also highlight crucial considerations and limitations.

As always, I invite you to share your thoughts in the comments below. Follow me on X aka Twitter and LinkedIn to get notified of my new posts.