Stop and start your Fabric Capacity using Power Automate

With Fabric Capacities trial coming to an end, you need to make sure to stop and start Fabric Capacities.

In my blog post below, I am going to show you how I can start or stop my Fabric Capacity by simply sending an email to myself with the details in the Subject Line to start or stop the capacity.

Fabric Capacity Details

Before completing the Power Automate flow, I first needed to get the Fabric Capacity details which I will use in the flow steps.

I logged into the Azure Portal and went to my existing Fabric Capacity, and I then got the following details:

  • Subscription
    • MVP
  • Resource Group
    • MVPN-RG_Demo
  • Resource Name which is also my Fabric Capacity Name
    • f2ause

This is what it looks like in the Azure Portal.

Creating the Flow

What I then did was to create the flow with the following steps as explained below.

  • The first step I created was to look for an email sent to myself where in the Subject Line it contains “Fabric Capacity”
    • A screenshot of a computer

Description automatically generated
  • Next, I created some Variables as it is easier to define and populate the variables which can then be re-used in subsequent steps. As well as if I need to use this flow for another capacity, I can just update the variables.
    • I created the following variables below.
      • VAR Fabric Capacity Name
        • This is my Fabric Capacity Name
        • A screenshot of a computer

Description automatically generated
      • TimeZone
        • This is my local time zone so that I can offset the UTC Time zone which is the default time zone for Power Automate.
        • A screenshot of a computer

Description automatically generated
  • Before deciding to start of stop the Fabric Capacity I needed to know what the current status of my Fabric Capacity is.
    • To do this, I created the following step to check the status.
    • I searched for “Read a Resource”
      • A screenshot of a computer

Description automatically generated
    • As shown below I selected my Subscription from the dropdown menu.
    • I also selected the Resource Group from the dropdown menu.
    • I also selected the Resource Provider from the dropdown menu.
    • For the Shortcut Resource Id, I put in “capacities/” and then selected my variable called “FabricCapacityName” from above.
    • And finally, I put in the Client API Version which is “2023-11-01”
    • A screenshot of a computer

Description automatically generated
  • Next, I created 2 Conditional steps, the reason I did this is because it is easier to control if I need to start or stop the capacity instead of nesting them.
    • I searched for Condition step
      • A screenshot of a computer

Description automatically generated
    • The first conditional step is if the email is to start the Capacity and the capacity is currently stopped or paused.
    • A screenshot of a computer screen

Description automatically generated
      • Number 1 is where I selected the Subject from the Object picker as shown below.
        • A screenshot of a computer

Description automatically generated
      • Number 2 is where I put in the following code below in the Expression Builder, which will extract the Status from the Capacity Status step
        • body('Check_Fabric_Capacity_Status')?['properties']?['state']
    • If both above equal to TRUE, meaning the email says start and the Capacity status is set to Paused then start the Capacity.
      • I searched for the step called “Invoke resource operation”
      • A screenshot of a computer

Description automatically generated
      • If this is the first time using the Azure Resource Manager, you will need to sign in
        • A screenshot of a login box

Description automatically generated
      • I then configured the step as shown below.
        • A screenshot of a computer

Description automatically generated
        • Number 1 from above is where I selected my Subscription from the dropdown menu.
        • Number 2 is where I selected the Resource Group from the dropdown menu.
        • Number 3 is where I selected the Resource Provider from the dropdown menu.
        • Number 4 is where I put in the Shortcut Resource Id, I put in “capacities/” and then selected my variable called “FabricCapacityName” from above.
        • Number 5 is where I put in the Client API Version which is “2023-11-01”
        • Number 6 is where I put the Action Name to “resume”, which will start the capacity.
        • A screenshot of a computer

Description automatically generated
    • The first conditional step is if the email is to stop the Capacity and the capacity is currently stopped or paused.
    • A screenshot of a computer

Description automatically generated
      • Number 1 is where I selected the Subject from the Object picker as shown below.
        • A screenshot of a computer

Description automatically generated
      • Number 2 is where I put in the following code below in the Expression Builder, which will extract the Status from the Capacity Status step
        • body('Check_Fabric_Capacity_Status')?['properties']?['state']
    • If both above equal to TRUE, meaning the email says start and the Capacity status is set to Start then start the Capacity.
      • I searched for the step called “Invoke resource operation”
      • A screenshot of a computer

Description automatically generated
      • If this is the first time using the Azure Resource Manager, you will need to sign in
        • A screenshot of a login box

Description automatically generated
      • I then configured the step as shown below.
        • A screenshot of a computer

Description automatically generated
        • Number 1 from above is where I selected my Subscription from the dropdown menu.
        • Number 2 is where I selected the Resource Group from the dropdown menu.
        • Number 3 is where I selected the Resource Provider from the dropdown menu.
        • Number 4 is where I put in the Shortcut Resource Id, I put in “capacities/” and then selected my variable called “FabricCapacityName” from above.
        • Number 5 is where I put in the Client API Version which is “2023-11-01”
        • Number 6 is where I put the Action Name to “suspend”, which will stop the capacity.
        • A screenshot of a computer

Description automatically generated
  • The final 2 steps I did was to check the Fabric Capacity again, so that I can email out the status of the Capacity so that I can confirm if it started or stopped as expected.
    • I copied and pasted the step called “Check Fabric Capacity Status” and renamed it to “Check Fabric Capacity Status Again” (Yes very original I know 😊)
    • Then in the send email step I put in the following details
    • A screenshot of a computer

Description automatically generated
    • Number 1 is where I am inserting the Status check from the Capacity with the code below.
        • body('Check_Fabric_Capacity_Status_Again')?['properties']?['state']
    • Number 2 is where I am once again putting the capacity status into the body.
    • Number 3 is where I am then using my variable from earlier called “TimeZone” to offset the DateTime so that is current for my time zone, which is GMT + 10 (I like to live in the future!)
      • addHours(utcNow(), variables('TimeZone'))
  • I then saved my Flow.

Testing the Flow

The final steps are to test the flow to make sure that it will start or stop as expected when I send the email.

  • The first email test is to start the capacity, I sent the following email
    • The flow then ran, and I got the following email back once the Capacity had started.
      • A screenshot of a computer

Description automatically generated
    • I also then went into the Azure Portal to make sure that it had indeed started.
      • A screenshot of a computer

Description automatically generated
  • The first email test is to stop the capacity, I sent the following email
    • A screenshot of a web page

Description automatically generated
    • The flow then ran, and I got the following email back once the Capacity had stopped or paused.
      • A screenshot of a computer

Description automatically generated
    • I also then went into the Azure Portal to make sure that it had indeed started.
      • A screenshot of a computer

Description automatically generated
    • NOTE: It sometimes can take a minute or three for the capacity to be stopped or paused.

Summary

In this blog post, I have shown you how to start or stop your Fabric capacity via email.

I hope you found this blog post useful.

And if you have any questions or suggestions, peace in the comments below.

Here a link to the Flow if you want to import this: StartorStopFabricCapacityfromEmail_FourMoo.zip

Thanks for reading!