web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Resume/suspend PowerBI...
Power Automate
Unanswered

Resume/suspend PowerBI embedded capacity with REST API via Custom Connector

(1) ShareShare
ReportReport
Posted on by 13

Hello there! I've created a custom connector that sends a https request (post) using the Power BI Embedded api documented in here: https://docs.microsoft.com/pt-br/rest/api/power-bi-embedded/

When I test the connector while editing it, everything works fine and I get a 202 response, successfully suspending or resuming my capacity. I tried to build a flow to suspend (and one to resume) my capacity in a daily frequency using my custom connector and when I test it I get an error response "404, resource not found", causing the flow to stop at this point - however, when I check my embedded resource, the flow DOES SUSPEND/RESUME as supposed.

What am I missing here? My flow consists in calling the custom connector action after checking today's weekday (suspends the capacity between 10 pm and 4 am and on the weekend) and sending me an email (which never occurs, since it always crashes).

These are the inputs:

{
    "host": {
        "connectionReferenceName""shared_pbiembeddedconnector-<some-id>",
        "operationId""ControleCE"
    },
    "parameters": {
        "subscriptionId": mySubID,
        "resourceGroupName": myResourceGroupName,
        "dedicatedCapacityName"myCapacityName,
        "action""suspend",
        "api-version""2021-01-01"
    }
}
 
And these are the outputs:
Body:
{
  "statusCode"404,
  "message""Resource not found"
}
 
Header:
{
  "Access-Control-Allow-Methods""GET, PUT, PATCH, DELETE, POST",
  "Access-Control-Allow-Origin""*",
  "Access-Control-Max-Age""3600",
  "Access-Control-Expose-Headers""*",
  "Date""Fri, 29 Jul 2022 16:31:05 GMT",
  "Content-Length""54",
  "Content-Type""application/json"
}

 

 

Categories:
I have the same question (0)
  • soleary Profile Picture
    10 on at

    Hi @amklauck, I have the exact same issue.  I created a custom connector, tested it, and it works.  When I add it to a flow, it fails with the same message.  Like yours, it actually completes the POST request successfully and resumes or suspends the SKU.  Did you find a resolution or workaround for your solution?

     

    OUTPUTS

    {
        "statusCode"404,
        "headers": {
            "Access-Control-Allow-Methods""GET, PUT, PATCH, DELETE, POST",
            "Access-Control-Allow-Origin""*",
            "Access-Control-Max-Age""3600",
            "Access-Control-Expose-Headers""*",
            "Date""Mon, 07 Nov 2022 22:36:47 GMT",
            "Content-Length""54",
            "Content-Type""application/json"
        },
        "body": {
            "statusCode"404,
            "message""Resource not found"
        }
    }
  • amklauck Profile Picture
    13 on at

    Hi there @soleary! Unfortunately I couldn't find a resolution to this issue. I gave up using Power Automate and managed to achieve what I wanted using runbooks (Powershell Workflow) on an automation account inside the Azure Portal. I don't know if you are familiar to it (I wasn't back then), but I found it much more reliable than Power Automate. You can find a starting guide in here: https://www.flip-design.de/?p=730

  • soleary Profile Picture
    10 on at

    Thank you very much, @amklauck!  I've used PowerShell, but not Azure Automation Runbooks.  Agreed, this looks like a better option.  I will check this out...thanks for the quick reply and the tip!

  • Verified answer
    cowg843 Profile Picture
    28 on at

    Hi, 

    I had exactly the same issue, I had a custom connector setup to switch an embedded capacity on/off. It worked within test but when including it in a Power Automate flow, it showed as failed (despite the capacity starting or being paused).

    I believe I have found a solution. 

    In the settings of the action for the connector in Power Automate, change the setting for asynchronous pattern to false. 

    cowg843_0-1669206432940.png

     

    I did this and changed nothing else, but the action now shows as successfully completed. 

    Hope that resolves your issue.

  • soleary Profile Picture
    10 on at

    Hi @cowg843!
    Thank you for you response!  I got it working using a couple API calls, one to get a token and then one to turn the capacity on/off.  However, the custom connector is more reusable and a little more friendly for the users that aren't familiar with API calls.  I will definitely give this a try!  Thanks very much for the tip!

  • amklauck Profile Picture
    13 on at

    Thank you @cowg843! My solution with the runbooks is running very well, but I gave a try with my old Power Automate flow and the change of settings you mentioned. It worked like a charm! Hopefully it will help other users from now on, thanks.

  • reubenanderson Profile Picture
    4 on at

    Hey, 

     

    Found this issue as well. Like the solution says, I can get around it by disabling Async flow... but I kind of what to do better than that. I want it to email me when either; 

    - the service was running and is now shutdown

    - there was some other unexpected error. 

     

    And I want it to not email me if the service was already shutdown. 

     

    I figure, I should be able to check whether it's running.. and then fire the suspend... rather than trying to suspend it and getting an 'expected' error. 

     

    And also.. like... a 202 is the correct response for an async process... so.. this should just work eh. 

     

     

  • reubenanderson Profile Picture
    4 on at

    ... actually, yeah, it does work if you; 

     

    1. create a second custom connector that checks the state of a power bi embedded capacity. 

    https://learn.microsoft.com/en-us/rest/api/power-bi-embedded/capacities/get-details?tabs=HTTP

    It's basically the same rest API, but you need a second connector as this uses a GET rather than a POST 

     

    2. Have your Flow app check the state first - call the GET, parse the result.. proceed to stop depending on whether the provisioningState is "Paused". 

     

    Mine now works a treat. 

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard