cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HarpsichordMan
Helper I
Helper I

Programatically start/stop Azure PowerBI capacity for PowerBI Embedded

With the new start/stop capacity options on Azure for PowerBI, can I start and stop the capacity from a .net app or powershell?

I understand that I can pause capacity in the Azure Portal, but would like to be able to pause/start capacity using an API call.

2 ACCEPTED SOLUTIONS
dahti00
Frequent Visitor

Hi all.

Here is the documentation:
https://docs.microsoft.com/en-us/rest/api/power-bi-embedded/capacities

Here is guide for setting up Postman:
https://www.codit.eu/blog/2017/03/14/authenticate-postman-against-azure-service-management-api/

Wish you well!

Goddamn hate Azure by now though.... hope that changes

View solution in original post

asarraf21
Frequent Visitor
23 REPLIES 23
rshahrabani
Frequent Visitor

Hi,

 

I'm trying to start/stop Azure Power BI Embedded capacity using the REST API, but it is returning Unauthorized.

 

When executing the Capacities - Resume API at https://docs.microsoft.com/en-us/rest/api/power-bi-embedded/capacities/resume#code-try-0, it runs successfully, but when I run the same code (see below) in a .NET application it returns an Unauthorized error.

 

The difference between the application call and the REST API Try It is the access token.  If I use the access token generated at the url above in the application, it runs successfully, but if I use the access token that I obtained using the Power BI .NET SDK, then it fails with the Unauthorized error.

 

Please help, stuck on this problem for a long time.

 

Thanks,

Ronny

 

Code:

------

 

POST https://management.azure.com/subscriptions/<subscription_id>/resourceGroups/<resource_group>/provide...

Authorization: Bearer <access_token>

Content-type: application/json

 

asarraf21
Frequent Visitor
Jayendran
Solution Sage
Solution Sage

Using PowerShell commands (AzureRM.PowerBIEmbedded) and Azure Runbooks we can also automate things if we want

 

I've published the  runbooks workflow at the below link

https://gallery.technet.microsoft.com/scriptcenter/SuspendResumePBI-Embedded-dd630405

 

Hope this helps,

Jay

leo1
New Member

Hello guys,

 

Anyone discover any way to schedule an stop for Power BI Embedded?


wrote:

Anyone discover any way to schedule an stop for Power BI Embedded?


This is pretty straightforward... create a Powershell script that you can use within an Azure Automation runbook. This Powershell script should use the latest version of the Azure RM Powershell module that the Power BI team have added pause/resume capacity commands to. Then you schedule the runbook to run at the appropriate time of day/day of week.

 

It is probably easiest to create two separate runbooks; one for pausing, one for resuming - but you could add parameters to your script/runbook and handle both situations in the one script. Plus you might want to add parameters to indicate which capacity to pause/resume or maybe just hard-code this if appropriate.

 

It appears that the capacities pause and resume pretty quickly - but that might depend on time of day/region/capacity size, etc. Any insight from the Power BI team here would be great!

Perhaps you can use "Azure Automation runbook" ? to pause/resume your embedded capacities

Will look into that. Thanks

nimrod
Resolver II
Resolver II

Hi all,

Each new feature or addition we release is being announced in the monthly developer update for Power BI.

Be sure to follow up there for all new additions.

 

I'm troubled to hear about the pitfalls you are encountering.

To get started, use this documentation and follow the steps described there- https://docs.microsoft.com/en-us/power-bi/developer/embedding

 

I would be happy to hear more on specific problems you faced and what you think should be the solution.

 

Thanks,

dahti00
Frequent Visitor

Hi Nimrod.

If you have the time; these are the potential pitfalls (and I think I stumbled on every single one):

Your link doesn't help much for most ISV users since I'ts in C#. We use MEAN stack for instance
I prefer the API POST/GET method since It Isn't code language dependant.

Problems

Microsoft login (Both Azure and Power BI).
The old login experience took into account that you always want to choose your account type edu/work/personal upon login.
The new MS login is flawed in some ways:

  • Creates new accounts by asking for new password, so now I have 2 Azure accounts unwillingly.
  • Creates Azure accounts based on your Outlook email being open.
  • Blocks email client from working If you logged into azure before outlook.
  • No security feature per users, stay logged in however long you like, admin can be logged into many browsers and computers at the same time. This is not very safe for being a corporate service.
  • Solution: Azure session timer. Always show "choose type of account Edu/work/personal". Don't allow multi login for Azure admins, kick out from other session.

Azure account type
Your tech support did not know the prerequisit for Azure to allow access to resources - SKU or workspaces.

This led to:

  • Azure allowed account creation with @hotmail.com accounts.
  • Coorporate emails wont be recognized and thus creating Azure personal accounts.
  • There was no information atleast not within the pages concerning Power BI embedded; that Domain DNS had to be registered within Office 365 and Cloudflare of your company domain to allow full Azure functionality.
  • Solution: block Azure from certain email suffixes. Link clearly step by step guide of how to take over domain in Office 365, you have docs on this just link it to the step by step guide for Power bi embedded.

Power BI embedded docs

  • After knowing that changes to Embedded service would happen after July 2017 (scarse messages from MS in forums and some guy in the cube videos) there was still no documentation at all regarding Power BI SKU at november 2017.
  • No links to ARM for starting/pausing the service a vital API command for this new running cost service.
  • API documentation on Azure ARM and PBI API does not have any information of what request header and credentials are needed to get a Bearer token OR an Embed token for your report.
  • I have now searched half day after a connection documentation for PBI embedded. I'm guessing many will want to automate creation of reports and app workspaces. I want to use a report as template and populate this with new customer data. Are there any new connectors that the API could use besides Streaming JSON, MS SQL, SPARK, xlsx and CSV?
  • Add Product Portfolio overview. Power BI product line is getting more diffuse. Please explain capabilities and prices for all products in a matrix chart. For instance that dashboards doesnt exist in PBI desktop, data sources and measures can't be edited in PBI cloud. Dashboards can't be themed and can't crossfilter. PBI premium capabilities vs PBI embedded.
  • Solution: Delete your old docs, or atleast put a "notice of depricated service" on all old docs. Add new docs for SKU method. Include links under "How to embed"; to github for more languages, ARM API & Power BI API. Include the Headers needed for successful API calls. Update info about dataset switching and sources supported, the old Workspace collection method was more limited but I haven't seen any proof that more datasources are supported.

Thanks for the thorough feedback. 

It is important for us to hear your problems and suggestions.

While some of the bullets are not related directly to PBI, we will try to pass it forward.

 

Adding some notes to the last part:

Power BI embedded docs

  • After knowing that changes to Embedded service would happen after July 2017 (scarse messages from MS in forums and some guy in the cube videos) there was still no documentation at all regarding Power BI SKU at november 2017.

We have a monthly blog with all updates. See the relevant onehttps://powerbi.microsoft.com/en-us/blog/power-bi-embedded-capacity-based-skus-coming-to-azure/

  • No links to ARM for starting/pausing the service a vital API command for this new running cost service.

It's still pretty new. Again, you can find it through our monthly blog post. Here is what you are looking forhttps://docs.microsoft.com/en-us/rest/api/power-bi-embedded/

  • API documentation on Azure ARM and PBI API does not have any information of what request header and credentials are needed to get a Bearer token OR an Embed token for your report.\

We will look into it.

  • I have now searched half day after a connection documentation for PBI embedded. I'm guessing many will want to automate creation of reports and app workspaces. I want to use a report as template and populate this with new customer data. Are there any new connectors that the API could use besides Streaming JSON, MS SQL, SPARK, xlsx and CSV?

Starting June 2017, PBI Embedded supports all of the data sources that Power BI supports. The API itself can support SQL Azure/On-prem and AS Azure/ On-prem in all relevant connections. See November blog posthttps://powerbi.microsoft.com/en-us/blog/power-bi-developer-community-november-update/

  • Add Product Portfolio overview. Power BI product line is getting more diffuse. Please explain capabilities and prices for all products in a matrix chart. For instance that dashboards doesnt exist in PBI desktop, data sources and measures can't be edited in PBI cloud. Dashboards can't be themed and can't crossfilter. PBI premium capabilities vs PBI embedded.

Thanks for the feedback, we will look into it

jimmcslim
Helper III
Helper III

Was the availability of this API to pause/resume capacity announced on the Power BI blog?

 

It would be great if the team could communicate the addition of these features!

ckelbley
Frequent Visitor

I have had success using these API calls:

 

POST https://management.azure.com/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/Microsoft.PowerBIDedicated/capacities/CAPACITY_NAME/resume?api-version=2017-10-01
POST https://management.azure.com/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/Microsoft.PowerBIDedicated/capacities/CAPACITY_NAME/suspend?api-version=2017-10-01

 


@ckelbley wrote:

I have had success using these API calls:

 

POST https://management.azure.com/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/Microsoft.PowerBIDedicated/capacities/CAPACITY_NAME/resume?api-version=2017-10-01
POST https://management.azure.com/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/Microsoft.PowerBIDedicated/capacities/CAPACITY_NAME/suspend?api-version=2017-10-01

 


@ckelbley

Could you share where you find those APIs, any documentations?

I couldn't find any official documentation.  I just did some trial and error using Postman and tried different calls based on how the management APIs work for other resource types and looking at what the browser does when you click the pause/start button in the Azure portal.

dahti00
Frequent Visitor

Hi all.

Here is the documentation:
https://docs.microsoft.com/en-us/rest/api/power-bi-embedded/capacities

Here is guide for setting up Postman:
https://www.codit.eu/blog/2017/03/14/authenticate-postman-against-azure-service-management-api/

Wish you well!

Goddamn hate Azure by now though.... hope that changes

View solution in original post

Awesome. Looks like that was published awhile ago, so don't know why I could not find it. Thanks for the help.

While we're relatively new to PowerBI, I sure find that the pieces do not hang together very well. From an embedded standpoint, the pricing is just stupidly high for low volume scenarios. I have given up attempting to get one of my workspaces associated with a PowerBI instance. 3 people at MS failed to ever explain why, so we gave up.

 

Hi.


----Pricing suggestion----
Low volume scenarios with pausing the SKUs are cheap? 1$ /hour on a minute basis for A1 core.
Just create many resources for different tiers of users maybe?
* 1 tier A1 for everyday use like maybe marketing and purchasing.
* 1 tier A6 for accounting/strategy/logistics desicions to use at Quarterly critical business moments?
Start/Stop upon Report render in your app.

Depends if you have to start services for 500-100 users at different times and such though..

If you don't need the ability for Crossfiltering, data discovery, edit and save cababilities and seamless Excel 2016/PowerPoint 2016 compatability then yeah Power BI is not the only way: Mongo dB Node.js backend - Angular 5 Frontend - Some java graphs like: https://www.fusioncharts.com/dev/chart-guide/pie-and-doughnut-charts/creating-pie-and-doughnut-chart...

-----My story-----
My struggles with Power BI embedded has also been beyond reasonable 2weeks now.

After 45 mails, 3 calls and 4 Microsoft support contacts I finally got a tech that knew a thing or two about Azure and Power BI Embedded.

Microsoft Sign in - auto created accounts based on outlook accounts, created personal accounts instead of work/edu, Workspace Collections was still visible and available in Azure with documentation being outdated and not showing the new steps to take.

I have incorrectly managed via backdoor Microsoft CLI commands from Powershell create all the old resources but at the end nothing worked since Workspace Collections and Workspaces had been removed and I just received errors.

The next steps to take are scary and I fear will be as troublesome: How does Power BI PRO integrate with the new Embedded SKU solution. Almost all videos "GuyInTheCube" and Microsoft Docs/videos showcase the pre 2017-07-01 ways of embedding Reports.

If I ever get through this hell.. I will defenitely post a complete video on Youtube named "Pitfalls of Azure and Power BI Embedded - a complete Step by Step guide"

Frankly, we've spent more on trying to wire up embedded than we did on creating the functionality and still have no clue that what we have running is maintainable or proper licensing, etc. I've yet to find anyone at MS that really has the full picture on this.

 

I fear your video may be an extended length version since it focuses on "pitfalls"! PowerBI is not a bad tool but if you can't use it in real-world scenarios, it is not of value.

 

We're an ISV and would like to use it to replace some dashboards we have done using Google visualizations but keep hitting brickwalls. MS pricing takes the view, it seems, that PowerBI is going to be a monolithic solution. We just want to use it just as part of complex applications we develop and sometimes to quickly put together complex data we have in SQL for easier consumption by data analysts that work at our customer locations. I even get conflicting information from supposed licensing gurus that sell Office 365 as to whether PowerBI is part of E3 licensing or not. MS hurts themselves by making this so frustratingly obtuse and difficult, IMHO.

Eric_Zhang
Microsoft
Microsoft


@HarpsichordMan wrote:

With the new start/stop capacity options on Azure for PowerBI, can I start and stop the capacity from a .net app or powershell?

I understand that I can pause capacity in the Azure Portal, but would like to be able to pause/start capacity using an API call.


@HarpsichordMan

There might be. The legency documentation is not updated. I'm going to consult this internally and would post back if there comes any update.

I was wondering the same thing, and I found this:

https://docs.microsoft.com/en-us/azure/power-bi-embedded/pause-start

 

...Which is for databases, but the API implies it is for "pausing compute" which would probably be the same thing as powerbi embedded?

 

Edit: Wrong link - I meant this: https://docs.microsoft.com/en-us/azure/sql-data-warehouse/sql-data-warehouse-manage-compute-rest-api...

 

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors