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.
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.
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.
- On Azure Portal, search for Logic apps
- Select the Logic Apps service
- Click the Add button
- Pick a Subscription from the list
- Pick a Resource Group from the list or create a new one
- Enter the Logic App name
- Select the Region from the list
- Select No if you do not require to Enable log analytics
- Select Consumption from the Plan type
- Click the Review + create button
- Click the Create button
- Navigate to the newly created Logic App and click the Edit button
- Select the Recurrence trigger
- Set the Interval to 1 Hour
- Add both Time zone and Start time parameters and set the desired values
- 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'))
- 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
- After passing your credentials and signing in select the Subscription from the list
- Select the Resource Group from the list
- Select the Microsoft.Fabric from the Resource Provider list
- Enter capacities/your_capacity_name on the Short Resource Id (replace the “your_capacity_name” with your actual capacity name)
- Enter 2023-11-01 on the Client Api Version
- Add the Location and SKU Name parameters, then select the location of your capacity and enter the desired SKU you want to upscale
- 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
The entire workflow must look like the following image:
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.
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.
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.