his blog post covers the latest updates for Power BI Developers community. Don’t forget to check out the October blog post, if you haven’t done so already.
Power BI Embedded
Better check out what we offer, so you won’t end up like Chris…
Here is the list of November updates for Power BI Embedded
New capacities in Azure
- Azure Resource Manager API
- CSP purchase channel
Embed capabilities
- Visual Options menu and Context menu extension
- Preload API for a better loading experience
- Security group sharing
Automation & life-cycle management
- Update connection string- support for more data sources
- RLS support on AS Azure for pre-defined roles
Azure Resource Manager API
The release of the new Azure capacities for Power BI Embedded in October enables ISVs to enjoy the full elasticity of an Azure resource. ISVs can now pause or resume capacity, scale up or down and pay for hourly usage only. To fully leverage this capability, those actions need to occur programmatically.
So now, as promised, we are releasing Azure Resource Management APIs to do all these actions automatically. These are all the actions you can perform using the ARM API:
- Scale up/ down
- Pause/ start resource
- Create/ Delete resource
- Get capacity information
- Update capacity
- Get capacity list in a resource group/ subscription
Here are some code samples you can use:
Scale up/ down:
string content = "{\"sku\":{\"name\":\"" + "{Enter new sku for scaling}" + "\"}}";
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] contentArray = encoding.GetBytes(content);
HttpWebRequest request = System.Net.WebRequest.Create(requestUri) as System.Net.HttpWebRequest;
request.Method = "PATCH";
request.Headers.Add("Authorization", String.Format("Bearer {0}", accessToken));
request.ContentType = "application/json; charset=utf-8";
request.ContentLength = contentArray.Length;
Stream stream = request.GetRequestStream();
stream.Write(contentArray, 0, contentArray.Length);
stream.Close();
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
Pause:
HttpWebRequest request = System.Net.WebRequest.Create(requestUri) as System.Net.HttpWebRequest;
request.Method = “POST”;
request.ContentLength = 0;
request.Headers.Add("Authorization", String.Format("Bearer {0}", accessToken));
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
Start:
HttpWebRequest request = System.Net.WebRequest.Create(requestUri) as System.Net.HttpWebRequest;
request.Method = “POST”;
request.ContentLength = 0;
request.Headers.Add("Authorization", String.Format("Bearer {0}", accessToken));
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
You can download the full ARM SDK from GitHub, or learn more from our documentation.
We will add support for ARM PowerShell soon.
Cloud Service Provider purchase channel now available
CSP subscription type can now purchase Power BI Embedded. The CSP offering joins all the rest of subscription types that are already supported for purchasing Power BI Embedded capacity.
Visual Options menu and Context menu extension
Power BI visuals have two menus: Context menu and Options menu. Options menu is opened by clicking the ellipsis icon on the top corner of the visual. Context menu is opened by right click on the data. Both menus can now be extended to add customized actions specific to your app and users.
In the example below, you can see warehouse robot assets table, that shows data on health and maintenance of the robots. Clicking on the ellipsis icon on the top-right corner will open the Options menu.
Notice that the bottom item is a customized extension to open a service ticket.
If we right -click on any data point in the table, the Context menu will open.
On the Context menu, where you can get the data point on which the user clicked, you can see another item- “Analyze Asset”.
If the user clicks on “Open service ticket” from the context menu, the following action will be initiated-
Notice that the warehouse app used the data point on which the user clicked to ease the ticket process.
This is a good example of how application developers can shorten the time-to-action by adding relevant capabilities where insights are discovered. Learn more on menu extensions.
To extend the menus, define and pass the object in the extension object under Embed Configuration, when loading the embedded content. You can add or update the menu extensions during a user’s session using the updateSettings method.
Here is a sample code to define a menu extension:
{
command: {
name: "command name",
title: "command title",
icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEU...AAABJRU5ErkJggg==",
extend:
{
visualContextMenu: {
title: "context menu title",
},
visualOptionsMenu: {
title: "options menu title",
}
}
}
Once the user clicked on the extension item, a commandTriggered event is invoked. Implement event handler using this JS code:
report.on(“commandTriggered”, function(command) {
// Handler code
});
Preload API for a better loading experience
The Power BI JavaScript SDK now offers developers the ability to preload our embedded endpoint, which will provide better and faster experience when displaying Power BI Embedded Reports & Dashboards.
We offer the new powerbi.preload() function, which loads all related Power BI scripts and styles in the background, to later be consumed via browser cache.
The new API requires only the desired embedUrl and embedded entity type (report, dashboard, tile) to start the preloading process.
This experience is best suited for applications that do not require Power BI Embedded on their initial pages and can utilize background preprocessing of Power BI's scripts and styles, which will only be used in later times by the application's end user.
To use the new preloading API, one would need to acquire the embedUrl of the artifact he wants to later embed, specific reportId or dashboardId are not required. Once the embedUrl is retrieved, use the following code:
var config = {
type: 'report',
embedUrl: embedUrl
};
powerbi.preload(config);
Security group sharing- automatic refresh of user’s permission
Power BI embedded will refresh user's permissions when accessing underlying content to enable smooth interaction with embedded data.
When you choose to embed Power BI for your organization's internal users (users have a Power BI account and granted permissions for the underlying artifacts) they will no longer need to sign into Power BI to refresh their permissions. This limitation was mostly around sharing content with security group where end users didn't log into PowerBI.com after they were added to the security group. With the new experience available for reports (soon to become available for dashboards), Power BI embedded diagnoses this state and as part of the session automatically refreshes end user permissions and retry resource reloading, resulting in a smooth experience for the end user.
Update connection string
The current Power BI SetAllConnections API enables developers to change the dataset connection so they can duplicate reports and dashboards for new customers and connect each copy to the customer’s data source. However, until now the API only supported DirectQuery connections.
Now we offer a new Update Connection API that extends this capability to more connections. This API supports SQL and AS connections, for all types- Cloud, on-premise, direct, live connection, cached.
To support the new API, we extended the info returned for each data source in the Get Datasources API. Each datasource object now has data on the datasource type and connection details- server and database names.
With this new API, we help developers fully automate their onboarding of new customers, by cloning workspaces and their content. See this blog post for complete example of how to clone workspaces.
(note- this example does not contain the new Update Connection API)
RLS support on AS Azure for pre-defined roles
For ISVs working with AS Azure, we added support for specifying roles on the embed token generation to apply custom filter on the data. After Defining your user’s roles in AS, you can pass the relevant role you wish to filter the data with. Applying RLS will give each user a view of the relevant data for his role.
Note that when specifying roles on embed token generation, the master user UPN must be provided as effective user name, and the master user must be member of all the relevant roles in AS Azure.
What’s still puzzling
Starting now, nothing should be! We gathered some of the most common problems developers and ISVs have been facing and asking about in the community in 2 documents-
- ‘Troubleshooting’ doc to help you get by all the obstacles on your way for building a great app.
- FAQ doc to answer all your question regarding the Product, licensing and Azure offering.
This is the first draft and we will constantly add more answers, so be sure to first check out this docs before turning to support channels with any problems.
Q: Can I use only a Pro license without a dedicated capacity to work with Power BI Embedded in Production? I’m trying it on my application and I can see it is working.
No. Using a single Pro license without a dedicated capacity for multiple customers in production is a violation of the license. To move to production, make sure your embedded content resides in dedicated capacity- a Power BI Premium or Power BI Embedded capacity. You can use a single Pro license without a dedicated capacity when you develop your application.
Production environments require more embed tokens than the number included with a Pro capacity, as such, these embed tokens are intended for development only. When used in production environments, users will see errors when the number of tokens exceed the number of embedded requests.
Custom Visuals
As part of our ongoing commitment to empower the community to create and to use custom visuals, we are excited to share that custom visuals developers can now get listed as partners and offer their services on AppSource to potential customers, to promote their business.
Custom visuals developers can offer tailor-made visual development, custom visuals development training, or other consulting services regarding custom visuals, through AppSource’s consulting services. Listing on AppSource helps developers reach many potential customers who are looking for a vendor to develop custom visuals for their unique needs.
Read the full announcement and how to apply in the community site blog here.
API
API 1.9 is now available, adding the ability to open the default browser and navigate to a URL.
LaunchUrl API comes in handy when you need to refer the user to a website or an external resource, such as documentation or support. The API receives a URL and then launches it in the device’s default browser, after getting consent from the user. Use the LaunchUrl API with buttons and links to enrich the user’s experience.
Here is an example of an enriched chiclet slicer, with URLs enabled. Titles which have URLs present in the data, will be shown as blue clickable links. The user can see the URL on hover before clicking it, and will get a consent popup upon clicking, to prevent unwanted navigation. The URL will open in a new browser window.
Here is the sample code used:
public dataPoints: ChicletSlicerDataPoint[];
public bindEvents(options: ChicletSlicerBehaviorOptions, selectionHandler: ISelectionHandler): void {
const slicers: Selection < SelectableDataPoint > = this.slicers = options.slicerItemContainers,
slicerClear: Selection < any > = options.slicerClear,
slicerItemLabels = options.slicerItemLabels;
this.slicerItemLabels = options.slicerItemLabels;
this.slicerItemInputs = options.slicerItemInputs;
this.dataPoints = options.dataPoints;
this.interactivityService = options.interactivityService;
this.slicerSettings = options.slicerSettings;
this.options = options;
slicerItemLabels.on("click", (dataPoint: ChicletSlicerDataPoint) => {
(d3.event as MouseEvent).preventDefault();
if (this.slicerSettings.images.clickableImage && dataPoint.url) {
options.host.launchUrl(dataPoint.url);
}
});
Take a look also at the sample bar chart tutorial for additional information and best practices.
Security matters
Make sure you read the security developer guideline, so you take security and privacy issues into consideration while developing your custom visuals, which will also get you closer to certifying the visuals, as Microsoft is following the same guidelines as part of its certification process.
The security guidelines cover areas such as data leakage, XSS attacks, privacy, and more, as well as recommended good practices like lint. Highly recommended.
As always, feel free to use all the communication channels at your disposal to connect with our team, share your thoughts and ask questions:
- Community
- Contact us for support- pbicvsupport@microsoft.com
That’s all for this post. We hope you found it useful. Please continue sending us your feedback, it’s very important to us. Have an amazing feature in mind? please share it and vote in our Power BI Embedded Ideas forum, or our Custom Visuals Ideas forum.