DEV Community

Kishore Sahoo for upnrunn technologies

Posted on • Originally published at on

Microsoft Power BI Embedded a WordPress Plugin

1. What is Power BI?

Power BI is a business analytics service provided by Microsoft. It provides interactive visualizations with self-service business intelligence capabilities, where end users can create reports and dashboards by themselves, without having to depend on information technology staff or database administrators.

2. How it useful in real business word

Power BI is a suite of business analytics tools that deliver insights throughout your organization. Connect to hundreds of data sources, simplify data prep, and drive ad hoc analysis. Produce beautiful reports, then publish them for your organization to consume on the web and across mobile devices. Everyone can create personalized dashboards with a unique, 360-degree view of their business. And scale across the enterprise, with governance and security built-in.

3. Embed analytics in your own application

With Power BI Embedded—for application developers—you can embed visual analytics in your products, so your users and customers can gain valuable insights, and you can get to market fast. To embed Power BI in your application or portal, you’ll need at least one Power BI Pro account, which will serve as a master account for your application. This master account will allow you to generate embed tokens to enable your application to access Power BI dashboards, reports, and visualizations.

4. Embed analytics in your WordPress site

We have created ‘Power BI Embedded for WordPress’ (URL: plugin, it uses the Power BI REST APIs and JavaScript APIs to embed Power BI dashboards, reports, tiles and various types of content on a WordPress site using a short-code. The plugin follows the “app owns data” process as documented by Microsoft at See for more information from Microsoft on how to Power BI embed content.

5. What are the steps to integrate with WordPress as a plugin and how it is being built

Go to plugin URL:

There are the different-different way to install WordPress plugin that is

– Go to your WordPress admin area and then go to plugins listing and then click on Add New button link that is on top of the listing, from add plugin page

You can search for ‘Power BI Embedded for WordPress’ plugin in the search box and then the plugin will appear in the searched listing, you can click on Install Now button.

– Another way to install a plugin you can download it from site, that plugin URL: and install it on your WordPress hosted site in the plugins directory and enable that plugin.

6. Steps to have a plugin for your power BI account

You need to have power bi account that will be required once you installed this plugin. On settings option of Power BI, you can configure details like,

User Name, Password, Client ID, Client Secret.

After adding the following details save settings and you should be able to see the right tick mark for OAuth Status field.

After configuring the plugin you can use the plugin like adding the short-code on a page. You can add Power BI Items from Power BI Menu and add new post type, fill up the details as per the requirement and publish the item.

One short-code will be generated that will appear on Items listing page.

Ex: [powerbi id=”13″ width=”100%” height=”350px”]

You can use this short-code in your posts or page to render the Power BI section.

Another important feature that we have added into the power bi plugin that is for managing and controlling the resource that is created on Azure portal.

This option allows the wp-admin to control the resource like in a way so that they can schedule the resource to START and PAUSE resource using API call.

We have added an option to save the few required details that need to be configured in plugins settings page that is like under ‘Schedule Power BI Resource’ section. There is an option to add Tenant ID, Subscription ID, Resource Group, Capacity. All these information needs to control a resource remotely using this plugin.

After adding proper settings you can select a time to START and PAUSE resource for each weekday.

Ex: If you want the schedule like on Monday resource should start at 8 am and should pause at 10 pm, then you can choose this way

Select the drop-down that is for Monday Field and select 8:00 for Start drop-down and select 22:00 for pause the resource.

For this, we have used wp-cron native WordPress schedule option to start and pause events. So the wp-cron will trigger upon visiting the site at 8 am if someone visits your site then the resource will be started automatically, and same for pause option.

This will not work properly if your site visitors are less and your site not having visitors that much in that case you can see the option to setup the cron job on your hosted server.

You can configure the cron job on your server that will run on every 30 minutes, that will allow more accurate events to occur like resource start and pause will happen on time.

To configure the cron job for WordPress see:

If you want to monitor the schedule cron event then you can also install:, this plugin shows the listed cron events where you can control your power bi resource.

Same likewise you can set up the time for each weekday if you want. If you do not want to start and pause resource on Monday than simply selects START option from start drop-down and same with PAUSE select pause option from that respected drop-down field.

7. Added new feature to have controls over Power BI Azure Resource that is configured on Azure

– How we have implemented this plugin for scheduling the resource

For adding a new feature to the power bi that can control resources remotely, they are providing some REST API endpoints that we have used to control resources.

On their blog, they mentioned updates

First of all, we have added an option that is need OAuth token that is being required in a start and pauses API call.

It is being generated from :{Azure Tenant Id}/oauth2/token

where we had made POST API call for that we have posted following values like

client_id={client id}
client_secret={client secret}

Note : Client id and secret are in the main setting section.

This call provides the OAuth token that is being used in resource management API calls.

So to PAUSE resource we can have :{Enter subscriptionId}/resourceGroups/{Enter resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{Enter dedicatedCapacityName}/suspend?api-version=2017-01-01-preview

In this call, we need to pass above generated OAuth management. azure token.

Same likewise with START resource:{Enter subscriptionId\}/resourceGroups/{Enter resourceGroupName\}/providers/Microsoft.PowerBIDedicated/capacities/{Enter dedicatedCapacityName\}/resume?api-version=2017-01-01-preview

This call also needs to have OAuth token like above.

After that, we have added an option that will allow us to set up the schedule to manage resource from plugin setting page.

We have added the new settings for all weekdays so admin can manage their resource easily from WordPress admin automatically.

We had thought on the best solution to check what we can do to trigger automatic action to control resource, and the solution is as WordPress has an option to set up the scheduled event(

We had set up the cron event for start and pause resource and for that, we have had taken site time zone that has been set on WordPress.

Note : To control resource more accurately it is suggested to set up the cron job on your WordPress hosted server.

Conclusion :

It is easy to control the power bi azure resource using our plugin automatically. And it is easy to configure. Now you do not need to manually start/pause resource on Azure portal cool.

If you do have any query contact us:

The post Microsoft Power BI Embedded a WordPress Plugin appeared first on upnrunn® | Build & Deploy Powerful Application.

Discussion (0)