Featured image of post Using Power Automate to Switch a Workspace Capacity

Using Power Automate to Switch a Workspace Capacity

Laura GB

Introduction

There are times to avoid capacity issues you need to automatically move a workspace from one capacity to another. Situations could include a capacity getting close to capacity, a new capacity becoming available or a scheduled peak activity that requires a standby capacity being used.

Scenario

I have 2 capacities that are in the same region. There are restrictions on moving regions that are detailed here https://learn.microsoft.com/en-us/fabric/admin/portal-workspace-capacity-reassignment#restrictions-on-moving-workspaces-around I am admin of the workspace and the capacity I am assigning the workspace to, or I could just be Fabric Admin.

Create the Flow

This flow is going to be a child flow so that it can run as a once off and be called as part of another process. I wrote a blog post back in 2022 regarding the requirements of a child flow this can be found here

The action we are going to perform is a rest api call to Fabric to assign a capacity. Microsoft have provided documentation.

Microsoft Learn - Workspaces - Assign a Capacity

So the information required is the workspace id and the capacity id. We will add those as parameters into the manual trigger.

📝 Instructions
  1. Inside a solution, create an instant flow and enter in a name for the flow
  2. Select Manually trigger a flow
  3. Click create to enter into the flow editor
  4. Expand the trigger and add 2 text inputs, WorkspaceID and CapacityID
  5. Add a compose step to construct the url required, see the code block below. Be aware the [’text’] refers to the first text parameter on the trigger. In the editor it will show up as WorkspaceID.
  6. Rename your compose step and save your flow
1
https://api.fabric.microsoft.com/v1/workspaces/@{triggerBody()['text']}/assignToCapacity

Screen grab of the create flow dialog and the flow with a trigger and compose as described in the above instructions

HTTP Call to Microsoft Fabric

We are going to use a HTTP with Microsoft Entra ID that is preauthorised.

📝 Instructions
  1. Find and add the HTTP with Microsoft Entra ID action
  2. If this is the first time using this connection it will prompt for connection details, otherwise skip to 6.
  3. Select Log in with Microsoft Entra ID as the authentication type.
  4. For Base Resource URL and Resource URI enter in https://api.fabric.microsoft.com/
  5. Click Sign and do the stuff to complete the connection and the action appears
  6. Select POST for the method and the compose output for the Url
  7. For the body you need to enter in a short JSON statement, see code block below. Text_1 is refering to the second trigger input, it will show as CapacityID once entered.
1
2
3
{
capacityId: "@{triggerBody()['text_1']}"
}

screen grans of the connection details and action details as described in the instructions

Testing the flow

The flow is now ready to be tested. Make sure you have the workspace and capacity ids ready.

📝 Instructions

1. 1. 1. 1. 1.

Child Flow Requirements

Resources

2026 Laura Graham-Brown
Built with Hugo
Theme Stack designed by Jimmy