<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Power BI &#8211; SQLpowered.com</title>
	<atom:link href="https://sqlpowered.com/tag/power-bi/feed/" rel="self" type="application/rss+xml" />
	<link>https://sqlpowered.com</link>
	<description>SQL Server + BI</description>
	<lastBuildDate>Fri, 31 Dec 2021 20:42:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://sqlpowered.com/wp-content/uploads/2020/07/FavIcon-e1594067873682-99x100.png</url>
	<title>Power BI &#8211; SQLpowered.com</title>
	<link>https://sqlpowered.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Getting Tabular Object Model from Power BI XMLA Endpoint</title>
		<link>https://sqlpowered.com/getting-tabular-object-model-from-power-bi-xmla-endpoint/</link>
					<comments>https://sqlpowered.com/getting-tabular-object-model-from-power-bi-xmla-endpoint/#respond</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Sun, 11 Apr 2021 11:08:50 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Power BI]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=5158</guid>

					<description><![CDATA[It&#8217;s very easy to get TOM (Tabular Object Model) for datasets hosted in Power BI Service and extract various metadata from it (tables, measures, etc.). We will do it just now using a simple C# console application and download TOM for one sample dataset using Power BI User credentials. Similarly,...]]></description>
										<content:encoded><![CDATA[<p>It&#8217;s very easy to get TOM (<a href="https://docs.microsoft.com/en-us/analysis-services/tom/introduction-to-the-tabular-object-model-tom-in-analysis-services-amo?view=asallproducts-allversions" target="_blank" rel="noopener">Tabular Object Model</a>) for datasets hosted in Power BI Service and extract various metadata from it (tables, measures, etc.). We will do it just now using a simple C# console application and download TOM for one sample dataset using Power BI User credentials. Similarly, you can do that as Service Principal.</p>
<p>Let&#8217;s set up a few prerequisites first.</p>
<h3>1. Setting the Power BI Tenant</h3>
<p><strong>Note</strong>: If you don&#8217;t have a Power BI account with administrative rights then use this <a href="https://sqlpowered.com/create-a-new-power-bi-administrator/" target="_blank" rel="noopener">guide</a> to create one.</p>
<p>Login to your Power BI account with administrative privileges and in Admin Portal make sure you have enabled access to XMLA endpoints for your tenant in Power BI Admin Portal.</p>
<p><img fetchpriority="high" decoding="async" class="alignnone wp-image-5164" src="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002.png" alt="" width="704" height="349" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002.png 1506w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-300x149.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-1024x507.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-150x74.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-768x380.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-360x178.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-160x79.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-320x159.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-495x245.png 495w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-686x340.png 686w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-908x450.png 908w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-1009x500.png 1009w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-520x258.png 520w" sizes="(max-width: 704px) 100vw, 704px" /></p>
<p>Because we will call the XMLA endpoint as a Power BI User with Premium Per User capacity, go to the <em>Premium Per User</em> section and allow read-only access to XMLA endpoints in <em>Dataset workload settings.</em><br />
<img decoding="async" class="alignnone wp-image-5167" src="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04.png" alt="" width="407" height="453" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04.png 887w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-270x300.png 270w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-90x100.png 90w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-768x854.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-360x400.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-144x160.png 144w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-288x320.png 288w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-220x245.png 220w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-306x340.png 306w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-405x450.png 405w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-450x500.png 450w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-520x578.png 520w" sizes="(max-width: 407px) 100vw, 407px" /></p>
<p>For the Power BI Premium per Capacity settings check this <a href="https://www.youtube.com/watch?v=YEIKzeNCqGg" target="_blank" rel="noopener">video</a> from 6:48 because there it needs to be set too.</p>
<p>Then go to your workspaces and choose the one you will connect to.</p>
<p><img decoding="async" class="alignnone wp-image-5168" src="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06.png" alt="" width="406" height="394" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06.png 891w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-300x291.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-103x100.png 103w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-768x745.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-360x349.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-160x155.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-320x310.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-253x245.png 253w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-351x340.png 351w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-464x450.png 464w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-516x500.png 516w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-520x504.png 520w" sizes="(max-width: 406px) 100vw, 406px" /></p>
<p>Copy the Workspace connection because we will use it later in the C# Console app.</p>
<p><strong>Note</strong>: XMLA endpoints are supported only for workspaces hosted on <a href="https://docs.microsoft.com/en-us/power-bi/admin/service-premium-what-is" target="_blank" rel="noopener">Premium capacity</a>. If you will try to connect to a non-premium workspace you will get this exception:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="raw">Microsoft.AnalysisServices.ConnectionException: 
Initial catalog property is required in order to connect to Power BI Pro workspaces.</pre>
<p>You can test the proper configuration using the SQL Server Management Studio.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5170" src="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07.png" alt="" width="381" height="251" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07.png 873w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-300x198.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-150x100.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-768x506.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-360x237.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-160x105.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-320x211.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-372x245.png 372w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-516x340.png 516w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-683x450.png 683w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-759x500.png 759w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-520x342.png 520w" sizes="auto, (max-width: 381px) 100vw, 381px" /></p>
<p>Fill in your Power BI User account credentials (same as for powerbi.com) once prompted. You will see a list of available databases after successful authentication.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5175" src="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08.png" alt="" width="638" height="55" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08.png 1091w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-300x26.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-1024x88.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-150x13.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-768x66.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-360x31.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-160x14.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-320x28.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-520x45.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-720x62.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-980x84.png 980w" sizes="auto, (max-width: 638px) 100vw, 638px" /></p>
<h3>2. Downloading Tabular Object Model using C# console application</h3>
<p>Because our Power BI XMLA endpoint is ready for connection now, we will test it from a simple C# console application. You can build your own or just download the solution targeting .NET.Core 5.0.</p>
<ul>
<li><a href="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIXMLA.zip">PowerBIXMLA</a></li>
</ul>
<p>Two NuGet packages are required to connect to Analysis Services running under the hood of Power BI Service.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5161" src="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01.png" alt="" width="751" height="112" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01.png 1617w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-300x45.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-1024x153.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-150x22.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-768x114.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-1536x229.png 1536w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-360x54.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-160x24.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-320x48.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-520x78.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-720x107.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-980x146.png 980w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-1320x197.png 1320w" sizes="auto, (max-width: 751px) 100vw, 751px" /></p>
<p>The main method:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="csharp">using System;
using Microsoft.AnalysisServices;

namespace PowerBIXMLA
{
    class Program
    {
        static void Main(string[] args)
        {

            Server server = new Server();

            // Connect as Power BI User
            string workspaceConnection = "powerbi://api.powerbi.com/v1.0/myorg/YOUR_WORSPACE_NAME";
            string userId = "";
            string password = "";
            string connectStringUser = $"DataSource={workspaceConnection};User ID={userId};Password={password};";


            // Connect as Service Principal
            /*
            string workspaceConnection = "powerbi://api.powerbi.com/v1.0/myorg/YOUR_WORSPACE_NAME";
            string tenantId = "";
            string appId = "";
            string appSecret = "";
            string connectStringServicePrincipal = $"DataSource={workspaceConnection};User ID=app:{appId}@{tenantId};Password={appSecret};";
            */

            // Connect
            server.Connect(connectStringUser);

            // List Databases (Datasets - tabular models) and extract TOM (Tabular Object Model)
            foreach (Database database in server.Databases)
            {
                Console.WriteLine(database.Name);

                string tmslTable = JsonSerializer.SerializeDatabase(database);

                Console.WriteLine(tmslTable);
            }
        }
    }
}</pre>
<p>You need to modify the section with Power BI User credentials:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="csharp">string workspaceConnection = "powerbi://api.powerbi.com/v1.0/myorg/YOUR_WORSPACE_NAME"; 
string userId = ""; 
string password = "";</pre>
<ul>
<li><strong>worskspaceConnection</strong>: this is the <em>Workspace Connection</em> value we have copied above (powerbi://api.powerbi.com/v1.0/myorg/Premium WS)</li>
<li><strong>userId</strong>: Power BI User account name (username@domain.xx). The same you are using to sign in to Power BI Service.</li>
<li><strong>password</strong>: Your Power BI User password.</li>
</ul>
<p>We can list all server <em>Databases</em> once connected and use the <em>SerializeDatabase()</em> method to get the Tabular Object Model.</p>
<p>Rebuild the application and run int. In case of success you will see:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5163" src="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02.png" alt="" width="437" height="407" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02.png 816w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-300x280.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-107x100.png 107w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-768x716.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-360x336.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-160x149.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-320x298.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-263x245.png 263w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-365x340.png 365w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-483x450.png 483w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-536x500.png 536w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-520x485.png 520w" sizes="auto, (max-width: 437px) 100vw, 437px" /></p>
<p>Because we have called the <em>SerializeDatabase()</em> method the whole Database is serialized to JSON. Database-level properties are marked with blue. The Tabular Object Model is marked with green.</p>
<p>If you would like to serialize just the Tabular Object Model you can call SerializaeObject() method inside the Tabular namespace.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="csharp">Microsoft.AnalysisServices.Tabular.JsonSerializer.SerializeObject(database.Model);</pre>
<p>To do more with the main Tabular Object Model just reference the Tabular namespace and process the object like any other strong-typed objects.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="csharp">using Microsoft.AnalysisServices.Tabular;
...

Model model = database.Model;

foreach (Table t in model.Tables)
{
    Console.WriteLine(t.Name);
}
</pre>
<p>Finally, it&#8217;s important to understand that datasets uploaded to Power BI Service from Power BI *.pbix files are in fact hosted as standard Analysis Service Tabular Models in the Power BI Service. That means that you can use the same approach when connecting to the on-prem Tabular Analysis Services instance. Only the authentication process will be different. The XMLA itself is fully compatible.</p>
<h4>References</h4>
<ul>
<li><a href="https://docs.microsoft.com/en-us/power-bi/admin/service-premium-connect-tools" target="_blank" rel="noopener">Dataset connectivity with the XMLA endpoint</a></li>
<li><a href="https://docs.microsoft.com/en-us/analysis-services/tom/introduction-to-the-tabular-object-model-tom-in-analysis-services-amo?view=asallproducts-allversions" target="_blank" rel="noopener">Tabular Object Model (TOM)</a></li>
<li><a href="https://powerbidevcamp.powerappsportals.com/sessions/session04/" target="_blank" rel="noopener">Programing Datasets using the Tabular Object Model</a></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/getting-tabular-object-model-from-power-bi-xmla-endpoint/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Accessing the Power BI Admin API as Service Principal</title>
		<link>https://sqlpowered.com/accessing-the-power-bi-admin-api-as-service-principal/</link>
					<comments>https://sqlpowered.com/accessing-the-power-bi-admin-api-as-service-principal/#comments</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Mon, 05 Apr 2021 09:32:00 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Power BI]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=5095</guid>

					<description><![CDATA[End of the year 2020 Microsoft extended the Power BI Service API with new admin access-related endpoints and added the option to use Service Principal instead of a dedicated administrative account for connection. You can read more details on it in this official Power BI  Blog post. In this step-by-step...]]></description>
										<content:encoded><![CDATA[<p>End of the year 2020 Microsoft extended the Power BI Service API with new admin access-related endpoints and added the option to use Service Principal instead of a dedicated administrative account for connection. You can read more details on it in this official <a href="https://powerbi.microsoft.com/en-us/blog/announcing-new-admin-apis-and-service-principal-authentication-to-make-for-better-tenant-metadata-scanning/" target="_blank" rel="noopener">Power BI  Blog post</a>.</p>
<p>In this step-by-step tutorial, I will do the following:</p>
<ol>
<li>Configure an Azure Application.</li>
<li>Test the Application for successful connection to Azure AD.</li>
<li>Configure Power BI Tenant to allow Service Principals to read the new Admin API.</li>
<li>Connect to the Power BI tenant and print a list of Workspaces to check that everything is configured properly.</li>
</ol>
<p><strong>Prerequisites:</strong></p>
<ul>
<li>Active Azure Portal subscription. You can <a href="https://azure.microsoft.com/en-us/free" target="_blank" rel="noopener">create one for free</a>.</li>
<li>Power BI Service tenant and account with administrative privileges. You can use this simple <a href="https://sqlpowered.com/create-a-new-power-bi-administrator/" target="_blank" rel="noopener">tutorial </a>to configure it.</li>
<li>Downloaded and running <a href="https://sqlpowered.com/power-bi-api-connector-sample-application/" target="_blank" rel="noopener">Power BI API Connector</a> that we will be used for testing of the whole solution.</li>
</ul>
<p>Let&#8217;s start the challenge!</p>
<h3>1. Configure an Azure Application</h3>
<p>In the main Azure Portal menu navigate to <em>the Azure Active Directory</em> item and select <em>App registration.</em></p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5140" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01.png" alt="" width="331" height="414" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01.png 798w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-240x300.png 240w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-80x100.png 80w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-768x961.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-360x451.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-128x160.png 128w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-256x320.png 256w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-196x245.png 196w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-272x340.png 272w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-359x450.png 359w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-399x500.png 399w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-520x651.png 520w" sizes="auto, (max-width: 331px) 100vw, 331px" /></p>
<p>Start <em>New registration</em> of an Application.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5139" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03.png" alt="" width="612" height="171" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03.png 1294w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-300x84.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-1024x286.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-150x42.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-768x214.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-360x100.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-160x45.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-320x89.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-520x145.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-720x201.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-980x273.png 980w" sizes="auto, (max-width: 612px) 100vw, 612px" /></p>
<p>On the main registration screen please choose the application name. In our case, we will call the application <strong>SPW API Reader APP</strong>. You can keep default values for the rest of the form.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5138" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04.png" alt="" width="612" height="528" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04.png 1355w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-300x259.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-1024x883.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-116x100.png 116w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-768x663.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-360x311.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-160x138.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-320x276.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-284x245.png 284w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-394x340.png 394w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-522x450.png 522w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-580x500.png 580w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-520x449.png 520w" sizes="auto, (max-width: 612px) 100vw, 612px" /></p>
<p>Press the <em>Register</em> button and wait for the deployment to finish. The <em>Overview</em> page will show us two important values identifying our Application which will be used later.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5137" src="https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46.png" alt="" width="551" height="217" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46.png 1175w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-300x118.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-1024x403.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-150x59.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-768x303.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-360x142.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-160x63.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-320x126.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-520x205.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-720x284.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-980x386.png 980w" sizes="auto, (max-width: 551px) 100vw, 551px" /></p>
<ul>
<li><strong>Application (client ID)</strong> is the unique identification of the Application.</li>
<li><strong>Directory (tenant) ID</strong> is the unique identification of our tenant (organization).</li>
</ul>
<p>Both these IDs are needed for Azure Active Directory access via the OAuth protocol. Because they are like &#8220;user&#8221; names we also must create a password. Navigate to the <em>Certificates &amp; secrets </em>in the menu and press the <em>New client secret</em> button.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5136" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05.png" alt="" width="631" height="520" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05.png 1459w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-300x247.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-1024x844.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-121x100.png 121w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-768x633.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-110x90.png 110w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-360x297.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-160x132.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-320x264.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-297x245.png 297w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-413x340.png 413w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-546x450.png 546w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-607x500.png 607w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-520x428.png 520w" sizes="auto, (max-width: 631px) 100vw, 631px" /></p>
<p>Add a secret name and choose the expiration that fits your needs. Press Add button and a new Client Secret will be created.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5135" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06.png" alt="" width="175" height="204" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06.png 364w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06-258x300.png 258w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06-86x100.png 86w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06-360x419.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06-137x160.png 137w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06-275x320.png 275w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06-210x245.png 210w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06-292x340.png 292w" sizes="auto, (max-width: 175px) 100vw, 175px" /></p>
<p><strong>You must copy the Value of the secret now!</strong> On the next page refresh, the Copy icon will disappear and the secret value can&#8217;t be copied again. You must delete the secret then and create a new one.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5134" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07.png" alt="" width="845" height="156" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07.png 1771w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-300x55.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-1024x189.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-150x28.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-768x142.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-1536x284.png 1536w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-360x66.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-160x30.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-320x59.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-520x96.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-720x133.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-980x181.png 980w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-1320x244.png 1320w" sizes="auto, (max-width: 845px) 100vw, 845px" /></p>
<p>Because the Power BI Admin API allows only the Service Principal to be an Azure AD Group, we will create a new Group and assign our Application to it. Go back to Azure Active Directory and navigate to Groups.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5133" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08.png" alt="" width="351" height="265" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08.png 799w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-300x226.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-133x100.png 133w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-768x580.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-360x272.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-160x121.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-320x242.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-325x245.png 325w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-451x340.png 451w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-596x450.png 596w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-663x500.png 663w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-520x392.png 520w" sizes="auto, (max-width: 351px) 100vw, 351px" /></p>
<p>Press the <em>New group</em> button.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5131" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10.png" alt="" width="517" height="169" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10.png 1019w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-300x98.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-150x49.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-768x251.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-360x118.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-160x52.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-320x105.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-520x170.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-720x235.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-980x320.png 980w" sizes="auto, (max-width: 517px) 100vw, 517px" /></p>
<p>Create a new Group. Choose <em>Security</em> Group type and some meaningful Group name that you can later search for it easy.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5132" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09.png" alt="" width="555" height="440" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09.png 1176w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-300x238.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-1024x812.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-126x100.png 126w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-768x609.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-360x285.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-160x127.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-320x254.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-309x245.png 309w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-429x340.png 429w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-568x450.png 568w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-631x500.png 631w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-520x412.png 520w" sizes="auto, (max-width: 555px) 100vw, 555px" /></p>
<p>Once the Group is created navigate to it and click the Group name.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5130" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11.png" alt="" width="611" height="109" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11.png 1003w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-300x54.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-150x27.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-768x137.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-360x64.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-160x29.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-320x57.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-520x93.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-720x128.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-980x175.png 980w" sizes="auto, (max-width: 611px) 100vw, 611px" /></p>
<p>Press the <em>Add members</em> button.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5129" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12.png" alt="" width="518" height="260" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12.png 977w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-300x151.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-150x75.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-768x386.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-360x181.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-160x80.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-320x161.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-488x245.png 488w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-677x340.png 677w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-895x450.png 895w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-520x261.png 520w" sizes="auto, (max-width: 518px) 100vw, 518px" /></p>
<p>In the search box try to search for the name of our Application and then select the proper item filtered that it will move to the <em>Selected items</em> section.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5128" src="https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55.png" alt="" width="465" height="314" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55.png 970w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-300x203.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-148x100.png 148w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-768x519.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-360x243.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-160x108.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-320x216.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-362x245.png 362w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-503x340.png 503w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-665x450.png 665w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-739x500.png 739w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-520x352.png 520w" sizes="auto, (max-width: 465px) 100vw, 465px" /></p>
<p>Double-check that our Application is a member of the Group now.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5127" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13.png" alt="" width="361" height="213" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13.png 807w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-300x177.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-150x88.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-768x453.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-360x212.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-160x94.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-320x189.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-415x245.png 415w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-576x340.png 576w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-763x450.png 763w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-520x307.png 520w" sizes="auto, (max-width: 361px) 100vw, 361px" /></p>
<p>You have successfully:</p>
<ul>
<li>created new Azure Application</li>
<li>obtained unique Application ID, Tenant ID, and Application Secret values</li>
<li>created a new Azure Active Directory group and assigned the Application to be a member of it</li>
</ul>
<h3>2. Test the Application for successful connection to Azure AD.</h3>
<p>It&#8217;s time to test that the Application can successfully connect to Azure Active Directory and obtain a valid security token. This is the must-have step before we can try to access the Power BI Admin API itself.</p>
<p>To do this please download the <a href="https://sqlpowered.com/power-bi-api-connector-sample-application/" target="_blank" rel="noopener">Power BI API Connector</a> utility and check the post for details on how it works. Try to connect and obtain the security token. You can continue this tutorial once done.</p>
<p><em>Note:</em> You can also try to test the Power BI Admin API connection using the utility but it will fail with <em>Unauthorized</em> because our Application doesn&#8217;t have access to the Power BI Admin API now.</p>
<h3>3. Configure Power BI Tenant to allow Service Principals to read the new Admin API.</h3>
<p>Please login to the <a href="https://powerbi.microsoft.com" target="_blank" rel="noopener">Power BI Service</a> with an account with administrative privileges. If you will use an account without tenant-level administrative rights the <em>Tenant settings</em> section in the Admin portal is hidden at all. You can create a new Power BI Administrator or assign an existing user to the <em>Power BI administrator</em> role following this <a href="https://sqlpowered.com/create-a-new-power-bi-administrator/" target="_blank" rel="noopener">post</a>.</p>
<p>Once done navigate in the Power BI menu to the <em>Admin portal</em> section and then select <em>Tenant settings.</em></p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5126" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14.png" alt="" width="343" height="232" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14.png 753w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-300x203.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-148x100.png 148w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-360x243.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-160x108.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-320x216.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-362x245.png 362w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-503x340.png 503w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-666x450.png 666w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-740x500.png 740w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-520x352.png 520w" sizes="auto, (max-width: 343px) 100vw, 343px" /></p>
<p>Scroll down and find the <em>Admin API settings</em> section. Press the <em>Enabled</em> button and then choose the <em>Specific security groups</em> option. Search for the Azure Active Directory Group we have created above where our Application is a member of it. Press the <em>Apply</em> button.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5125" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15.png" alt="" width="666" height="409" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15.png 1517w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-300x184.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-1024x629.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-150x92.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-768x472.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-360x221.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-160x98.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-320x197.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-399x245.png 399w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-553x340.png 553w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-732x450.png 732w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-814x500.png 814w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-520x319.png 520w" sizes="auto, (max-width: 666px) 100vw, 666px" /></p>
<p>Security settings will be applied soon. It can take up to 15 minutes but usually, it takes not more than 2 minutes for the API is accessible.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5124" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16.png" alt="" width="432" height="93" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16.png 743w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16-300x65.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16-150x32.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16-360x78.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16-160x34.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16-320x69.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16-520x112.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16-720x155.png 720w" sizes="auto, (max-width: 432px) 100vw, 432px" /></p>
<p>That&#8217;s all from the configuration point of view.</p>
<h3>4. Connect to the Power BI tenant and print a list of Workspaces.</h3>
<p>It&#8217;s time to test that our Application can really access the Power BI Admin API now. We will use the <a href="https://sqlpowered.com/power-bi-api-connector-sample-application/" target="_blank" rel="noopener">Power BI API Connector</a> utility again and print a list of Tenant available Workspaces. To do this please create at least one Workspace if you have a brand new Power BI account because the API method <a href="https://docs.microsoft.com/en-us/rest/api/power-bi/admin/groups_getgroupsasadmin" target="_blank" rel="noopener"><span class="enlighter-m3">GetGroupsAsAdmin</span>()</a> used for testing doesn&#8217;t list the default<em> My workspace</em> item.</p>
<p>Navigate to Workspaces and press the <em>Create a workspace</em> button.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5123" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17.png" alt="" width="361" height="375" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17.png 894w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-289x300.png 289w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-96x100.png 96w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-768x798.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-360x374.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-154x160.png 154w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-308x320.png 308w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-236x245.png 236w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-327x340.png 327w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-433x450.png 433w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-481x500.png 481w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-520x540.png 520w" sizes="auto, (max-width: 361px) 100vw, 361px" /></p>
<p>Type Workspace name and <em>Save</em> it.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5122" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18.png" alt="" width="379" height="459" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18.png 891w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-247x300.png 247w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-844x1024.png 844w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-82x100.png 82w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-768x932.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-360x437.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-132x160.png 132w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-264x320.png 264w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-202x245.png 202w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-280x340.png 280w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-371x450.png 371w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-412x500.png 412w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-520x631.png 520w" sizes="auto, (max-width: 379px) 100vw, 379px" /></p>
<p>New Workspace should be visible in the list of available Workspaces.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5121" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_19.png" alt="" width="311" height="183" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_19.png 502w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_19-300x176.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_19-150x88.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_19-360x212.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_19-160x94.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_19-320x188.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_19-417x245.png 417w" sizes="auto, (max-width: 311px) 100vw, 311px" /></p>
<p>Run the Power BI API Connector utility again and after you will allow it to run the Power BI Admin API test it should connect successfully to your Power BI tenant, call the API and print a list of all available Workspace.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5086" src="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces.png" alt="" width="545" height="106" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces.png 1188w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-300x58.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-1024x199.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-150x29.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-768x149.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-360x70.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-160x31.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-320x62.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-520x101.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-720x140.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-980x191.png 980w" sizes="auto, (max-width: 545px) 100vw, 545px" /></p>
<p>As you can see our testing Workspace name is listed. There is also &#8220;Samples WS&#8221; Workspace listed to demonstrate that it&#8217;s really admin access listing all tenant Workspaces as Service Principal and not only Workspaces of the given Power BI account as if the API is accessed in the authenticated user access mode.</p>
<p>That&#8217;s it! You are done and you can continue building your own application to do something great with all the data available via the Power BI Admin API.</p>
<h3>References</h3>
<ul>
<li><a href="https://docs.microsoft.com/en-us/rest/api/power-bi/admin" target="_blank" rel="noopener">Power BI Admin REST API</a></li>
<li><a href="https://docs.microsoft.com/en-us/power-bi/admin/read-only-apis-service-principal-authentication" target="_blank" rel="noopener">https://docs.microsoft.com/en-us/power-bi/admin/read-only-apis-service-principal-authentication</a></li>
<li><a href="https://docs.microsoft.com/en-us/power-bi/developer/automation/overview-of-power-bi-rest-api" target="_blank" rel="noopener">https://docs.microsoft.com/en-us/power-bi/developer/automation/overview-of-power-bi-rest-api</a></li>
<li><a href="https://powerbi.microsoft.com/en-us/blog/announcing-new-admin-apis-and-service-principal-authentication-to-make-for-better-tenant-metadata-scanning" target="_blank" rel="noopener">https://powerbi.microsoft.com/en-us/blog/announcing-new-admin-apis-and-service-principal-authentication-to-make-for-better-tenant-metadata-scanning</a></li>
<li><a href="https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal" target="_blank" rel="noopener">https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal</a></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/accessing-the-power-bi-admin-api-as-service-principal/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Power BI API Connector (sample application)</title>
		<link>https://sqlpowered.com/power-bi-api-connector-sample-application/</link>
					<comments>https://sqlpowered.com/power-bi-api-connector-sample-application/#respond</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Sat, 03 Apr 2021 08:50:48 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Power BI]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=5076</guid>

					<description><![CDATA[PowerBIApiConnector is a simple console application that will help you to test two things: a connection to Azure Active Directory and that you have properly configured an Azure application to access the Power BI Admin Read-Only API. Application is created in .NET.Core 5.0 and you can download it as: PowerBIApiConnector_Executable...]]></description>
										<content:encoded><![CDATA[<p>PowerBIApiConnector is a simple console application that will help you to test two things: a connection to Azure Active Directory and that you have properly configured an Azure application to access the Power BI Admin Read-Only API.</p>
<p>Application is created in .NET.Core 5.0 and you can download it as:</p>
<ul>
<li><a href="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Executable.zip">PowerBIApiConnector_Executable</a> &#8211; executable files in *.zip package for direct use</li>
<li><a href="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution.zip">PowerBIApiConnector_Solution</a> &#8211; Visual Studio 2019 Project</li>
</ul>
<h3>How to use it?</h3>
<p>Extract the executable package files to a directory. You have two options how to launch the application:</p>
<p>A) Setup parameters at the application launch:</p>
<p><code class="EnlighterJSRAW" data-enlighter-language="generic">PowerBIApiConnector.exe {Application (client) ID} {Directory (tenant) ID} {Client Secret}</code></p>
<p>B) Execute it without parameters. Then you will be prompted for input values:</p>
<p lang="cs" style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"><img loading="lazy" decoding="async" class="alignnone wp-image-5080" src="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_InputParametersPrompt.png" alt="" width="322" height="104" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_InputParametersPrompt.png 604w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_InputParametersPrompt-300x97.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_InputParametersPrompt-150x48.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_InputParametersPrompt-360x116.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_InputParametersPrompt-160x52.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_InputParametersPrompt-320x103.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_InputParametersPrompt-520x168.png 520w" sizes="auto, (max-width: 322px) 100vw, 322px" /></p>
<p lang="cs">Input parameters are:</p>
<ul>
<li lang="cs"><strong>Application (client) ID</strong>: This is an Azure Application ID</li>
<li lang="cs"><strong>Directory (tenant) ID</strong>: Your organization (tenant) ID</li>
<li lang="cs"><strong>Client Secret: </strong>Application secret value<strong><br />
</strong></li>
</ul>
<p>You can get proper values for these parameters in Azure Portal: Navigate to your Application in Azure Active Directory and copy the first two parameters from the Application Overview page:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5081" src="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs.png" alt="" width="503" height="196" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs.png 1165w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-300x117.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-1024x399.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-150x58.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-768x299.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-360x140.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-160x62.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-320x125.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-520x203.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-720x281.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-980x382.png 980w" sizes="auto, (max-width: 503px) 100vw, 503px" /></p>
<p>For the Client Secret navigate as in the image below and copy the Value or create a new secret:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5082" src="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2.png" alt="" width="763" height="407" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2.png 2237w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-300x160.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-1024x547.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-150x80.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-768x410.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-1536x820.png 1536w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-2048x1093.png 2048w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-360x192.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-160x85.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-320x171.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-459x245.png 459w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-637x340.png 637w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-843x450.png 843w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-937x500.png 937w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-520x278.png 520w" sizes="auto, (max-width: 763px) 100vw, 763px" /></p>
<p>When you launch the application and authentication to Azure AD will succeed, you will see an authentication token printed to the console window:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5085" src="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution.png" alt="" width="571" height="204" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution.png 1199w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-300x107.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-1024x366.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-150x54.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-768x274.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-360x129.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-160x57.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-320x114.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-520x186.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-720x257.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-980x350.png 980w" sizes="auto, (max-width: 571px) 100vw, 571px" /></p>
<p>Same time you will be prompted if you would like to test the Power BI Admin Read-Only API access. You can skip this step in case you would like to test the Azure AD authentication only.</p>
<p>If you will input &#8220;Y&#8221; the GetGroupsAsAdmin() API call will be executed and when the application has properly configured access to the Power BI Admin API available tenant workspaces will be listed by name:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5086" src="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces.png" alt="" width="576" height="112" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces.png 1188w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-300x58.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-1024x199.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-150x29.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-768x149.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-360x70.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-160x31.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-320x62.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-520x101.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-720x140.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-980x191.png 980w" sizes="auto, (max-width: 576px) 100vw, 576px" /></p>
<h3>Solution content</h3>
<p>Two dependency packages are required (will be automatically downloaded via NuGet packages manager):</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5088" src="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution.png" alt="" width="299" height="184" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution.png 493w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution-300x185.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution-150x92.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution-360x222.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution-160x99.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution-320x197.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution-397x245.png 397w" sizes="auto, (max-width: 299px) 100vw, 299px" /></p>
<p>Main method code:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="csharp">using Microsoft.Identity.Client;
using Microsoft.PowerBI.Api;
using Microsoft.Rest;
using System.Linq;
using System;

namespace PowerBIApiConnector
{
    class Program
    {

        static PowerBIClient powerBIClient = null;
        static string accesToken = null;
        static IConfidentialClientApplication app;

        // Authentication variables
        private static string clientId;
        private static string tenantId;
        private static string clientSecret;

        // Power BI API paths
        private const string resource = "https://analysis.windows.net/powerbi/api";
        private const string ApiUrl = "https://api.powerbi.com";

        private static string authority;

        public static void Main(string[] args)
        {
            // Capture users input via prompt
            if (args.Count() == 0)
            {
                Console.WriteLine("Application (client) ID:");
                clientId = Console.ReadLine();

                Console.WriteLine("Directory (tenant) ID:");
                tenantId = Console.ReadLine();

                Console.WriteLine("Client Secret:");
                clientSecret = Console.ReadLine();
            }
            // Capture users input as launch parameters
            else if (args.Count() == 3)
            {
                clientId = args[0];
                tenantId = args[1];
                clientSecret = args[2];

                Console.WriteLine("------------------------");
                Console.WriteLine($"Application (client) ID: {clientId}");
                Console.WriteLine($"Directory (tenant) ID: {tenantId}");
                Console.WriteLine($"Client Secret: {clientSecret}");
                Console.WriteLine("------------------------");
            }
            else
            {
                Console.WriteLine("Mssing valid input parameters! Type: {Application (client) ID} {Directory (tenant) ID} {Client Secret} ");
            }

            // Set main API path for authentication
            authority = $"https://login.microsoftonline.com/{tenantId}";

            // Create authorization app
            try
            {
                app = ConfidentialClientApplicationBuilder
                    .Create(clientId)
                    .WithClientSecret(clientSecret)
                    .WithAuthority(new Uri(authority))
                    .Build();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Environment.Exit(1);
            }

            string[] scopes = new string[] { $"{resource}/.default" };
            AuthenticationResult result = null;

            // Authenticate and obtain permissions scope
            try
            {
                result = app.AcquireTokenForClient(scopes).ExecuteAsync().Result;
            }
            catch (MsalUiRequiredException ex)
            {
                // Insufficient permissions.
                Console.WriteLine(ex.Message);
                Environment.Exit(1);
            }
            catch (MsalServiceException ex) when (ex.Message.Contains("AADSTS70011"))
            {
                // Invalid application scope.
                Console.WriteLine(ex.Message);
                Environment.Exit(1);
            }

            // Print token
            Console.WriteLine($"App-Only Access Token:\n{result.AccessToken}\n");
            
            accesToken = result.AccessToken;
            var tokenCredentials = new TokenCredentials(result.AccessToken, "Bearer");
            
            // Test PowerBI Admin API
            Console.WriteLine("Test Power BI API (List workspaces as service principal via Read-Only Admin Api?) Type Y/N:");

            if ("y" == Console.ReadLine().ToLower())
            {
                Console.WriteLine("------------------------");
                Console.WriteLine("Connecting to Power BI API...");

                try
                {
                    // Create PowerBIClient instance
                    powerBIClient = new PowerBIClient(new Uri(ApiUrl), tokenCredentials);

                    // List workspace names with the Admin only method (GetGroupsAsAdmin)
                    var workspaceNames = powerBIClient.Groups.GetGroupsAsAdmin(100, filter: "type eq 'Workspace'").Value.Select(x =&gt; x.Name);

                    //Print output
                    Console.WriteLine("Workspaces found:");

                    foreach (string workspaceName in workspaceNames)
                    {
                        Console.WriteLine("  =&gt; " + workspaceName);
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Environment.Exit(1);
                }
            }

            Console.WriteLine("Done!");

        }
    }
}</pre>
<h3>References</h3>
<p>For additional references, I will recommend this excellent <a href="https://www.sqlbi.com/articles/creating-a-service-principal-account-for-power-bi-api/" target="_blank" rel="noopener">video</a> from Marco Russo and the official Microsoft <a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app" target="_blank" rel="noopener">guide</a>.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/power-bi-api-connector-sample-application/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Extracting Metadata from the Power BI Report File</title>
		<link>https://sqlpowered.com/extracting-metadata-from-the-power-bi-report-file/</link>
					<comments>https://sqlpowered.com/extracting-metadata-from-the-power-bi-report-file/#comments</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Sat, 19 Dec 2020 12:30:47 +0000</pubDate>
				<category><![CDATA[BI]]></category>
		<category><![CDATA[Power BI]]></category>
		<category><![CDATA[SSRS]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=4795</guid>

					<description><![CDATA[The more and more is Power BI used everywhere it&#8217;s starting to be really painful to incorporate it in any metadata management solution. This article is a result of 10 hours investigation on how to get metadata from Power BI files. To be honest, a lot of workarounds, community tools,...]]></description>
										<content:encoded><![CDATA[
<p>The more and more is Power BI used everywhere it&#8217;s starting to be really painful to incorporate it in any metadata management solution. This article is a result of 10 hours investigation on how to get metadata from Power BI files. To be honest, a lot of workarounds, community tools, and nearly zero support by Microsoft. Correct me if I&#8217;m wrong.</p>



<p>The original requirement was to extract metadata from more than five hundred Power BI reports deployed in on-premises <a href="https://powerbi.microsoft.com/en-us/report-server/">Power BI Report Server</a>. It&#8217;s not an issue to download all these reports to the local folder via a custom tool (I will publish one soon) or using the <a href="https://docs.microsoft.com/en-us/sql/reporting-services/developer/rest-api?view=sql-server-ver15" target="_blank" rel="noopener">Report Server REST API</a>. But this API doesn&#8217;t expose metadata contained inside the Power BI report file (*.pbix). And opposite there is nothing directly inside the Power BI Desktop tool to export metadata in some human-readable or further processing suitable format. A little bit more (means not a full metadata-export solution) can be realized with the <a href="https://docs.microsoft.com/en-us/rest/api/power-bi/" target="_blank" rel="noopener">Power BI Cloud Service API</a> but this isn&#8217;t an option for on-premises running Power BI Report Server.</p>



<p>Let&#8217;s concentrate on the *.pbix file itself and keep the API option to another post.</p>



<p>If I&#8217;m talking about Power BI &#8220;metadata&#8221; I mean everything that is hidden inside the report: data sources, tables, columns, measures, relations, visuals used, etc. &#8220;External&#8221; metadata like where the report is sitting on the Report Server, how often it is used, and who can access it that&#8217;s easy to collect directly from the Report Server. But users, especially data analysts, DWH developers, and metadata solution specialists are more interested to see what is referenced from the DWH inside the Power BI report, how the whole data lineage looks like, how measures are calculated and relations used.</p>



<p>There basically two ways how to get this metadata:</p>



<ul class="wp-block-list">
<li>via opening the *.pbix file in Power BI and connecting to the underlying SSAS service hosting an instance of the Power BI model</li>
<li>extracting the *.pbix file content and processing various files (*.json) from it.</li>
</ul>



<p>I don&#8217;t want to describe the SSAS option there because we have realized this will require a significant amount of time to automate it somehow for hundreds of reports. It may also need dedicated hardware to process report changes in time. But still, it&#8217;s a valid solution and you can view more on it there:</p>



<ul class="wp-block-list">
<li><a href="https://www.biinsight.com/connect-to-power-bi-desktop-model-from-excel-and-ssms/" target="_blank" rel="noopener">Connect to Power BI Desktop Model from Excel and SSMS</a></li>
<li><a href="https://www.youtube.com/watch?v=rYlIp1PrBcA" target="_blank" rel="noopener">Document your Power BI model with DAX Studio</a></li>
</ul>



<h3 class="wp-block-heading">Power BI files (*.pbix, *.pbit)</h3>



<p>The *.pbix file is the main file of the Power BI report. It contains all metadata and also all data imported inside the model using the Import option for source queries. *.pbit is the Power BI Template file. It has in general the same content regarding metadata but it doesn&#8217;t contain any data imported from data sources like the *.pbix file. Both files are in fact *.zip files with other files packed inside. So rename them with *.zip extension and review the content.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" class="wp-image-4820" src="https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_01.png" alt="" width="697" height="190" srcset="https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_01.png 1476w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_01-300x82.png 300w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_01-1024x279.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_01-150x41.png 150w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_01-768x209.png 768w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_01-360x98.png 360w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_01-160x44.png 160w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_01-320x87.png 320w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_01-520x142.png 520w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_01-720x196.png 720w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_01-980x267.png 980w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_01-1320x360.png 1320w" sizes="auto, (max-width: 697px) 100vw, 697px" /></figure>



<p>It looks like that both files have the same content. But if you will review it twice there is a significant difference in how the DataModel is stored. Inside the *.pbix file is the model stored using Xpress9 compression to make the file much smaller because it contains data too. Inside the *.pbit template file it is an extracted DataModelShema in JSON format instead of it.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" class="wp-image-4822" src="https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_03.png" alt="" width="647" height="280" srcset="https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_03.png 1318w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_03-300x130.png 300w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_03-1024x443.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_03-150x65.png 150w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_03-768x332.png 768w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_03-360x156.png 360w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_03-160x69.png 160w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_03-320x138.png 320w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_03-520x225.png 520w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_03-720x311.png 720w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_03-980x424.png 980w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_03-1156x500.png 1156w" sizes="auto, (max-width: 647px) 100vw, 647px" /></figure>



<p>The Xpress9 compression is my point of view the main issue of why it&#8217;s so complicated to get the metadata from the Power BI. I did several attempts to extract the file playing with a lot of stuff from C++ libraries thru Python scripts, 7z, ending inside UWP Windows. Compression namespace but without success. All these tools can work with the original Express only compression algorithm which is a part of the Windows encryption API for a long time. But I really didn&#8217;t found anything to extract the new Xpress9 algorithm.</p>



<p>What does it mean? Simple answer: Without the ability to decompress the Xpress9 DataModel file only two options are in-game on how to get the Power BI metadata from the file:</p>



<ul class="wp-block-list">
<li>via connection to running Power BI SSAS instance (as described above)</li>
<li>or via the option to save Power BI Template in the Power BI Desktop application and processing the *.pbit file.</li>
</ul>



<p>Saving Power BI files as a template looks to be a simple solution at first look. But let&#8217;s go back to the initial requirement: process metadata for more than five hundred Power BI reports deployed to Report Server or even tens of files stored somewhere locally. There is no option to call Power BI from the command line to do this conversion in the background or something like that. It really means that every single Power bI report must be opened in Power BI Desktop and manually resaved as a Power BI Template file.</p>



<p>There is one solution in this <a href="https://www.youtube.com/watch?v=s3ivC07XKPc" target="_blank" rel="noopener">video</a>. We can use Power Automate Desktop to capture the manual conversion from *.pbix to *.pbit and then replay it automatically for other *.pbix file in the folder. This solution may be suitable for the initial conversion of multiple *.pbix files to templates but it may be hard to implement it on regular basis to the customer&#8217;s infrastructure. It&#8217;s still a workaround solution only.</p>



<h2 class="wp-block-heading">The *.pbit file content</h2>



<p>What is inside the Power BI Report file is pretty well described in this <a href="https://www.fourmoo.com/2017/05/02/what-makes-up-a-power-bi-desktop-pbix-file/" target="_blank" rel="noreferrer noopener">blog post</a>.</p>



<p>The DataMashup file, containing Query Editor metadata, may be extracted with 7z:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">7z x DataMashup -o".\DataMashupDir\" -aoa</pre>



<p><img loading="lazy" decoding="async" class="alignnone  wp-image-4829" src="https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_04.png" alt="" width="359" height="315" srcset="https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_04.png 886w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_04-300x263.png 300w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_04-114x100.png 114w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_04-768x674.png 768w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_04-360x316.png 360w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_04-160x140.png 160w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_04-320x281.png 320w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_04-279x245.png 279w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_04-387x340.png 387w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_04-512x450.png 512w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_04-569x500.png 569w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_04-520x457.png 520w" sizes="auto, (max-width: 359px) 100vw, 359px" /></p>



<p>It&#8217;s reporting some warnings but looks like all files are extracted properly:</p>
<p><img loading="lazy" decoding="async" class="alignnone  wp-image-4830" src="https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_05.png" alt="" width="270" height="79" srcset="https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_05.png 457w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_05-300x88.png 300w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_05-150x44.png 150w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_05-360x106.png 360w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_05-160x47.png 160w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_05-320x94.png 320w" sizes="auto, (max-width: 270px) 100vw, 270px" /></p>
<p>For working with the DataModelSchema JSON file inside the *.pbit file there is one great tool available: <a href="https://tabulareditor.com">https://tabulareditor.com</a>. You can use it to open the *.pbit file directly and review its metadata:</p>
<p><img loading="lazy" decoding="async" class="alignnone  wp-image-4831" src="https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_Tabular_Editor_06.png" alt="" width="514" height="448" srcset="https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_Tabular_Editor_06.png 1331w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_Tabular_Editor_06-300x262.png 300w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_Tabular_Editor_06-1024x893.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_Tabular_Editor_06-115x100.png 115w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_Tabular_Editor_06-768x670.png 768w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_Tabular_Editor_06-360x314.png 360w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_Tabular_Editor_06-160x140.png 160w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_Tabular_Editor_06-320x279.png 320w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_Tabular_Editor_06-281x245.png 281w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_Tabular_Editor_06-390x340.png 390w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_Tabular_Editor_06-516x450.png 516w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_Tabular_Editor_06-573x500.png 573w, https://sqlpowered.com/wp-content/uploads/2020/12/Extract_Power_BI_Report_Metadata_Tabular_Editor_06-520x454.png 520w" sizes="auto, (max-width: 514px) 100vw, 514px" /></p>
<p>It&#8217;s doing a great job in parsing the DataModelSchema JSON and it is open source, so you can get inspired in the source a lot on what is inside the JSON.</p>
<p>For the live connection to the running Power BI model, <a href="https://daxstudio.org" target="_blank" rel="noopener">DAX Studio</a> is the ultimate solution.</p>
<h3>Conclusion</h3>
<p>Without the Xpress9 issue, it will be easy to have some simple solution to download *.pbix files from <em>dbo.Catalog</em> table in Report Server, convert it to ZIP, extract DataModel JSON schema, parse it, and upload it to metadata catalog. Conversion to *.pbit makes it cumbersome and workarounds are complicated.</p>



<p><strong>Further reading:</strong></p>



<ul class="wp-block-list">
<li><a href="https://cran.r-project.org/web/packages/pbixr/vignettes/explore.html" target="_blank" rel="noreferrer noopener">R library </a>to get Power BI metadata (using the SSAS connection solution but with interesting info about DataModel file)</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/extracting-metadata-from-the-power-bi-report-file/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Power BI Report Server release schedule</title>
		<link>https://sqlpowered.com/power-bi-report-server-release-schedule/</link>
					<comments>https://sqlpowered.com/power-bi-report-server-release-schedule/#respond</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Wed, 20 Feb 2019 21:59:09 +0000</pubDate>
				<category><![CDATA[BI]]></category>
		<category><![CDATA[Power BI]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=3306</guid>

					<description><![CDATA[Who is using Power BI Report Server in regular production with many users creating and publishing reports in Power BI Desktop is facing one crucial issue: there is regular monthly release for Power BI desktop but releases for Report Server for Power BI are coming unexpectedly even Microsoft has announced...]]></description>
										<content:encoded><![CDATA[<p>Who is using Power BI Report Server in regular production with many users creating and publishing reports in Power BI Desktop is facing one crucial issue: there is regular monthly release for Power BI desktop but releases for Report Server for Power BI are coming unexpectedly even Microsoft has announced it should be every 4 months. So it&#8217;s then really hard to align users with that and answer their question when exactly they can use this new cool Power BI Desktop feature also in their Power BI Desktop for Report Server version.</p>
<p>Starting 2019 is should be much easier to answer the question because Microsoft has announced <a href="https://powerbi.microsoft.com/cs-cz/blog/power-bi-report-server-release-timing-update/">regular release scheduling for Power BI Report Server</a>: <em>Starting in 2019, we will be shipping a new release of Power BI Report Server in January, May and September each year.</em></p>
<p>This should help us properly to plan for that, inform our users in advance and schedule updates for Power BI Desktop for Report Server to be updated on time.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/power-bi-report-server-release-schedule/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Power BI Helper</title>
		<link>https://sqlpowered.com/power-bi-helper/</link>
					<comments>https://sqlpowered.com/power-bi-helper/#respond</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Sun, 06 Jan 2019 18:44:12 +0000</pubDate>
				<category><![CDATA[BI]]></category>
		<category><![CDATA[Power BI]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=2866</guid>

					<description><![CDATA[Power BI Helper is a smart tool that allows us to analyze Power BI Desktop files or connect to the model running inside the Power BI Desktop instance and check various performance-related statistics or metadata. In the latest major update released in December 2019, it brings a huge list of...]]></description>
										<content:encoded><![CDATA[<p><a href="http://radacad.com/power-bi-helper" target="_blank" rel="noopener noreferrer">Power BI Helper</a> is a smart tool that allows us to analyze Power BI Desktop files or connect to the model running inside the Power BI Desktop instance and check various performance-related statistics or metadata.</p>
<p>In the latest major update released in <a href="https://radacad.com/power-bi-helper-december-2019-feature-summary" target="_blank" rel="noopener noreferrer">December 2019</a>, it brings a huge list of new features like pages, visuals and bookmarks metadata available, visual comparer, visualization tree, the reverse dependency tree, DMV execution page, and dependant calculations for tables and columns with many more features.</p>
<p>The most liked feature I&#8217;m using is the option to perform an in-depth review of how data are spread in Power BI *.pbix file before I will distribute them to the end-user. Usually, there is a lot of ballast from the development process consuming the memory and affecting performance. Using Power bI Helper I can easily identify such cases and remove obsolete data from the file and compact it for delivery and performance. The file compaction ratio can be significant. Check out more on <a href="http://radacad.com/find-the-most-expensive-columns-for-performance-tuning-bookmarks-and-more-with-power-bi-helper-version-november-2018" target="_blank" rel="noopener noreferrer">radacad.com</a> blog.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4483" src="https://sqlpowered.com/wp-content/uploads/2019/01/Power-BI-Helper-Analyze-File-Size.png" alt="" width="465" height="546" srcset="https://sqlpowered.com/wp-content/uploads/2019/01/Power-BI-Helper-Analyze-File-Size.png 1132w, https://sqlpowered.com/wp-content/uploads/2019/01/Power-BI-Helper-Analyze-File-Size-256x300.png 256w, https://sqlpowered.com/wp-content/uploads/2019/01/Power-BI-Helper-Analyze-File-Size-873x1024.png 873w, https://sqlpowered.com/wp-content/uploads/2019/01/Power-BI-Helper-Analyze-File-Size-85x100.png 85w, https://sqlpowered.com/wp-content/uploads/2019/01/Power-BI-Helper-Analyze-File-Size-768x901.png 768w, https://sqlpowered.com/wp-content/uploads/2019/01/Power-BI-Helper-Analyze-File-Size-360x422.png 360w, https://sqlpowered.com/wp-content/uploads/2019/01/Power-BI-Helper-Analyze-File-Size-136x160.png 136w, https://sqlpowered.com/wp-content/uploads/2019/01/Power-BI-Helper-Analyze-File-Size-273x320.png 273w, https://sqlpowered.com/wp-content/uploads/2019/01/Power-BI-Helper-Analyze-File-Size-209x245.png 209w, https://sqlpowered.com/wp-content/uploads/2019/01/Power-BI-Helper-Analyze-File-Size-290x340.png 290w, https://sqlpowered.com/wp-content/uploads/2019/01/Power-BI-Helper-Analyze-File-Size-384x450.png 384w, https://sqlpowered.com/wp-content/uploads/2019/01/Power-BI-Helper-Analyze-File-Size-426x500.png 426w, https://sqlpowered.com/wp-content/uploads/2019/01/Power-BI-Helper-Analyze-File-Size-520x610.png 520w" sizes="auto, (max-width: 465px) 100vw, 465px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/power-bi-helper/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Jak zakázat přihlašovací dialog při spuštění Power BI Desktop?</title>
		<link>https://sqlpowered.com/power-bi-desktop-disable-sign-up-form/</link>
					<comments>https://sqlpowered.com/power-bi-desktop-disable-sign-up-form/#respond</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Sun, 06 Jan 2019 12:07:19 +0000</pubDate>
				<category><![CDATA[BI]]></category>
		<category><![CDATA[Power BI]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=2855</guid>

					<description><![CDATA[Při spuštění Power BI Desktop nám stále vyskakuje přihlašovací formulář, který nás vybízí k registraci do powerbi.com nebo k přihlášení k již existujícímu účtu. Dialogy sice můžeme odklikat tím, že na prvním z nich zvolíme přihlášení k existujícímu účtu a následně přihlašovací formulář stornujeme, což ovšem není určitě ideální scénář,...]]></description>
										<content:encoded><![CDATA[<p>Při spuštění Power BI Desktop nám stále vyskakuje přihlašovací formulář, který nás vybízí k registraci do powerbi.com nebo k přihlášení k již existujícímu účtu. Dialogy sice můžeme odklikat tím, že na prvním z nich zvolíme přihlášení k existujícímu účtu a následně přihlašovací formulář stornujeme, což ovšem není určitě ideální scénář, kdy Power BI Desktop distribuujete většímu množství uživatelům v podnikovém prostředí, které nevyužívá powerbi.com.</p>
<p><span id="more-2855"></span></p>
<p>Pomocí <a href="https://docs.microsoft.com/en-us/power-bi/desktop-admin-sign-in-form" target="_blank" rel="noopener noreferrer">zde</a> popsaného postupu je možné zakázat zobrazování Sign-up formuláře při spuštění Power BI Desktop na úrovni registru, tedy rámci podnikového prostředí hromadně pomocí distribuce příslušné Policy.</p>
<p>Při instalaci Power BI Desktop na WINDOWS 10 uvedený klíč v registru zcela chybí, proto je přikládám zde:</p>
<p>[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Power BI Desktop] &#8220;ShowLeadGenDialog&#8221;=dword:00000000</p>
<p>Stačí jej vložit do souboru s příponou *.reg a spustit.</p>
<p>Po aplikaci se Power BI Desktop spustí rovnou takto:</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2858" src="https://sqlpowered.com/wp-content/uploads/2019/01/Power_BI_Desktop_Without_Sign_Up_Form.png" alt="" width="1919" height="1042" srcset="https://sqlpowered.com/wp-content/uploads/2019/01/Power_BI_Desktop_Without_Sign_Up_Form.png 1919w, https://sqlpowered.com/wp-content/uploads/2019/01/Power_BI_Desktop_Without_Sign_Up_Form-150x81.png 150w, https://sqlpowered.com/wp-content/uploads/2019/01/Power_BI_Desktop_Without_Sign_Up_Form-300x163.png 300w, https://sqlpowered.com/wp-content/uploads/2019/01/Power_BI_Desktop_Without_Sign_Up_Form-768x417.png 768w, https://sqlpowered.com/wp-content/uploads/2019/01/Power_BI_Desktop_Without_Sign_Up_Form-1024x556.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/01/Power_BI_Desktop_Without_Sign_Up_Form-160x87.png 160w, https://sqlpowered.com/wp-content/uploads/2019/01/Power_BI_Desktop_Without_Sign_Up_Form-320x174.png 320w, https://sqlpowered.com/wp-content/uploads/2019/01/Power_BI_Desktop_Without_Sign_Up_Form-451x245.png 451w, https://sqlpowered.com/wp-content/uploads/2019/01/Power_BI_Desktop_Without_Sign_Up_Form-626x340.png 626w, https://sqlpowered.com/wp-content/uploads/2019/01/Power_BI_Desktop_Without_Sign_Up_Form-829x450.png 829w, https://sqlpowered.com/wp-content/uploads/2019/01/Power_BI_Desktop_Without_Sign_Up_Form-921x500.png 921w, https://sqlpowered.com/wp-content/uploads/2019/01/Power_BI_Desktop_Without_Sign_Up_Form-520x282.png 520w" sizes="auto, (max-width: 1919px) 100vw, 1919px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/power-bi-desktop-disable-sign-up-form/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Stručný přehled Power BI služeb a nástrojů</title>
		<link>https://sqlpowered.com/strucny-prehled-power-bi-sluzeb-a-nastroju/</link>
					<comments>https://sqlpowered.com/strucny-prehled-power-bi-sluzeb-a-nastroju/#respond</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Fri, 20 May 2016 20:47:58 +0000</pubDate>
				<category><![CDATA[BI]]></category>
		<category><![CDATA[Power BI]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=1887</guid>

					<description><![CDATA[Power BI neboli Power Business Inteligence je sada nástrojů a služeb z dílny Microsoftu určená k rychlé a efektivní analýze dat z různých zdrojů a graficky působivé prezentaci získaných výsledků. Důležitým konceptem, který stojí na pozadí, je &#8220;Self-service BI&#8221;, velmi volně přeloženo &#8220;udělej si sám&#8221;, což v praxi znamená, že...]]></description>
										<content:encoded><![CDATA[<p>Power BI neboli Power Business Inteligence je sada nástrojů a služeb z dílny Microsoftu určená k rychlé a efektivní analýze dat z různých zdrojů a graficky působivé prezentaci získaných výsledků. Důležitým konceptem, který stojí na pozadí, je &#8220;Self-service BI&#8221;, velmi volně přeloženo &#8220;udělej si sám&#8221;, což v praxi znamená, že nástroje Power BI by nám měly umožnit stát se plnohodnotnými datovými analytiky a učinit nás co nejvíce nezávislými na vývojářích, firemním IT nebo externím dodavateli, což byly ještě několik let zpět v podstatě jediné možnosti, jak pracovat se složitějšími nebo objemnějšími daty, kde již Excel nebyl to úplně ideální řešení. Samozřejmě to neznamená, že by odzvonilo olapovým kostkám nebo Reporting Services. Právě naopak: Power BI nástroje umožňují uživatelům přistupovat ke kostkám a podobným datovým zdrojů a vytvářet jednoduše atraktivní reporty a vývojáři se mohou více soustředit na tvorbu datových zdrojů a řešit komplexní problémy, zatímco uživatelé si dokáží mnohá data načíst sami a provést efektivní analýzu a vizualizace bez další asistence. V článku se seznámíme se základními nástroji a službami z rodiny Power BI včetně jejich cloudové verze.<span id="more-1887"></span></p>
<p>PowerBI služby a nástroje můžeme rozdělit do tří velkých skupin:</p>
<ul>
<li><strong>www.powerbi.com</strong> &#8211; cloudová služba, umožňující jak datovou analýzu, tak publikování reportů z desktopových a mobilních aplikací, sdílení dat a spoustu dalších funkcionality, které se typicky ke cloudovým službám vážou.</li>
<li><strong>Power BI Desktop</strong> &#8211; plnohodnotná desktopová aplikace pro snadné vytváření a publikování graficky pokročilých reportů. Obsahuje následující moduly:
<ul>
<li><em>Power Query</em>
<ul>
<li>Pokročilý nástroj k extrakci dat z velkého množství podporovaných datových zdrojů a jejich transformaci pomocí jazyka M</li>
</ul>
</li>
<li><em>Power Pivot</em>
<ul>
<li>In-memory nástroj pro datové modelování, práci s relacemi, agregacemi a výrazy.</li>
</ul>
</li>
<li><em>Power View</em>
<ul>
<li>Interaktivní nástroj pro vizualizaci dat se širokou podporou různých vizuálních prvků a jejich vzájemnou interakci.</li>
</ul>
</li>
</ul>
</li>
<li><strong>Power BI doplňky pro Excel</strong>
<ul>
<li>Excel je stále primárním nástrojem pro datovou analýzu a doplňky, které je možné v něm aktivovat nebo jsou jeho nativní součástí od verze 2016, jej vybavují velmi podobnou funkcionalitou, jakou nabízí Power BI Dektop, a přinášejí i některé pokročilé funkce, které pro změnu v Power BI Desktop dostupné nejsou.</li>
<li><em>Power Pivot</em>
<ul>
<li>Umožňuje přímo v Excelu vytvářet komplexní datové modely s relacemi, hierarchiemi, pokročilými agregacemi a výrazy.</li>
<li>Data v modelu jsou zpracovávána přímo v paměti (xVelocity, Vertipaq engine) a můžeme dotazovat řádově větší objemy dat mnohem efektivněji, než jsou-li data uložena v listech</li>
</ul>
</li>
<li><em>Power Query</em>
<ul>
<li>Samostatný plugin pro vytváření pokročilých dotazů z nejrůznějších datových zdrojů &#8211; orientován na ETL proces.</li>
<li>Od verze Excel 2016 již není nutné instalovat plugin samostatně a Power Query je přímo součástí záložky Data.</li>
<li>Podporuje široké množství datových zdrojů od SQL Serveru, Analytických služeb, Sharepoint, XML až po Facebook nebo Google Analytics.</li>
</ul>
</li>
<li><em>Power View</em>
<ul>
<li>Nástroj pro vytváření graficky působivých a především interaktivních reportů nad různými datovými zdroji.</li>
</ul>
</li>
<li><em>Power Map</em>
<ul>
<li>Nástroj pro rychlé a jednoduché zobrazování dat v mapách a mapových grafech podle geografických údajů z datového zdroje.</li>
<li>V Office 2016 přejmenováno na 3D Maps (ale stále dostupné jako COM doplněk PowerMap)</li>
</ul>
</li>
</ul>
</li>
<li><strong>Power BI Report Server</strong>
<ul>
<li>Speciální edice Microsoft Reporting Services, která umožňuje zobrazovat soubory vytvořené pomocí Power BI Desktop v on-premise prostředí stejně jako klasických reporty SSRS (paginated reports).</li>
<li>Pro tvorbu reportů vyžaduje speciální edici Power BI Desktop for Report Server.</li>
</ul>
</li>
<li><strong>Power BI Mobile Apps</strong>
<ul>
<li>Mobilní aplikace pro zobrazování Power BI sestav na platformách Android, Apple či Windows Mobile</li>
</ul>
</li>
</ul>
<p>V praxi se můžeme setkat ještě s produktem pod označením &#8220;Power BI for Office 365&#8221;, jehož podpora ale byla od 31.12.2015 omezena a od 31.3.2016 byl definitivně označen za zastaralý. Aktivním předplatitelům byla nabídnuta možnost přejít na Power BI Pro službu a podrobnosti najdeme v článku <a href="https://powerbi.microsoft.com/en-us/documentation/powerbi-admin-migrating-to-the-new-power-bi-experience/">Migrating to the new Power BI experience</a>.</p>
<p><strong>Cena</strong></p>
<p>Pokud se bavíme o ceně za Power BI, máme na mysli především její cloudovou verzi a řešení pro on-premise(Power BI Report Server) . Power BI Desktop je zdarma, své lokální reporty tedy můžete vytvářet bez omezení.</p>
<p>Cloudová služba Power BI existuje ve Free a placené Pro nebo Premium verzi.  Ve free verzi si vyzkoušíte vše podstatné, především prohlížení datových sestav na webu. Hlavními důvody, které by nás mohly vést k pořízení placené verze, jsou především pokročilé moduly pro import dat z interních datových zdrojů (On Premise prostředí &#8211; Personal Data Gateway), emailové subscribce nebo sdílení sestav s ostatními uživateli.</p>
<p>Power BI Premium je určeno především pro podnikové prostřední a integraci s on-premise řešeními.</p>
<p>Detalní srovnání Free, Pro a Premium najdete <a href="https://stoneridgesoftware.com/what-are-the-differences-between-power-bi-free-power-bi-pro-and-power-bi-premium/" target="_blank" rel="noopener noreferrer">zde</a>.</p>
<p><a href="https://powerbi.microsoft.com/cs-cz/pricing/" target="_blank" rel="noopener noreferrer">Aktuální cena</a> Pro verze je $9.99 za uživatele a měsíc, což lze považovat za relativně rozumné nastavení i pro českého uživatele.</p>
<p>Pokud si budete chtít Power BI vyzkoušet, je třeba pamatovat na jednu podstatnou skutečnost: pro registraci není možné využít emailové adresy z volně dostupných poštovních služeb (*.hotmail, *.gmail, atd. a bohužel ani řadu českých freemailových služeb), ale je nutné použít pracovní emailovou adresu.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/strucny-prehled-power-bi-sluzeb-a-nastroju/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
