{"id":783,"date":"2020-12-21T13:14:46","date_gmt":"2020-12-21T11:14:46","guid":{"rendered":"https:\/\/www.flip-design.de\/?p=783"},"modified":"2020-12-21T13:21:31","modified_gmt":"2020-12-21T11:21:31","slug":"power-bi-service-principals","status":"publish","type":"post","link":"https:\/\/www.flip-design.de\/?p=783","title":{"rendered":"Power BI Service Principals"},"content":{"rendered":"\n<p>With the <a href=\"https:\/\/app.powerbi.com\/embedsetup\">Power BI Embedded OnBoarding Too<\/a>l you can easily embed applications. But the standard mode uses an users with a password. This users requires a Power BI Pro license and normally this users stands under  some organizational standards, such as the password must be change after X days. But the biggest issue are, that the password is unencrypted at the web.config file.<br>These issues can be resolved by using a \u201cservice principal\u201d account. Microsoft has documented the way at this page:<a href=\"https:\/\/docs.microsoft.com\/en-us\/power-bi\/developer\/embedded\/embed-service-principal\">https:\/\/docs.microsoft.com\/en-us\/power-bi\/developer\/embedded\/embed-service-principal<\/a><br><br>But here are some missing hints to get the principal work, such as the API permissions. This Blog Post will show you step by step how you can configure a account and setup a demo application.<\/p>\n\n\n\n<p>First you must enable at the Admin Portal of your Power BI tenant the use of the \u201cservice principals\u201d. (in a productive scenario you should use groups, not the entire organization)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"745\" src=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/21-12-_2020_9-07-45-1-1024x745.jpg\" alt=\"\" class=\"wp-image-807\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/21-12-_2020_9-07-45-1-1024x745.jpg 1024w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/21-12-_2020_9-07-45-1-300x218.jpg 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/21-12-_2020_9-07-45-1-768x559.jpg 768w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/21-12-_2020_9-07-45-1-412x300.jpg 412w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/21-12-_2020_9-07-45-1.jpg 1312w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>To configure our embedded application we need our workspace and report id. (needed to configure the config file)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"605\" height=\"247\" src=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-18.png\" alt=\"\" class=\"wp-image-785\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-18.png 605w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-18-300x122.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-18-500x204.png 500w\" sizes=\"(max-width: 605px) 100vw, 605px\" \/><figcaption>1 = workspace id<br>2 = report id<\/figcaption><\/figure>\n\n\n\n<p>Next we must create at the Azure tenant an \u201c<a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/active-directory\/develop\/quickstart-register-app\">App registration<\/a>\u201d:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"605\" height=\"318\" src=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-19.png\" alt=\"\" class=\"wp-image-786\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-19.png 605w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-19-300x158.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-19-500x263.png 500w\" sizes=\"(max-width: 605px) 100vw, 605px\" \/><\/figure>\n\n\n\n<p>Then we must create the client secret<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"519\" height=\"390\" src=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-20.png\" alt=\"\" class=\"wp-image-787\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-20.png 519w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-20-300x225.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-20-399x300.png 399w\" sizes=\"(max-width: 519px) 100vw, 519px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"605\" height=\"131\" src=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-21.png\" alt=\"\" class=\"wp-image-788\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-21.png 605w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-21-300x65.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-21-500x108.png 500w\" sizes=\"(max-width: 605px) 100vw, 605px\" \/><figcaption><strong>Important<\/strong>: After you left this page, you cannot get the secret again!<\/figcaption><\/figure>\n\n\n\n<p>Now we must give the service principal API permissions for Power BI<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"605\" height=\"391\" src=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-24.png\" alt=\"\" class=\"wp-image-791\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-24.png 605w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-24-300x194.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-24-464x300.png 464w\" sizes=\"(max-width: 605px) 100vw, 605px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"605\" height=\"325\" src=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-25.png\" alt=\"\" class=\"wp-image-792\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-25.png 605w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-25-300x161.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-25-500x269.png 500w\" sizes=\"(max-width: 605px) 100vw, 605px\" \/><figcaption><strong>Cgeck that you only grant the required permissions!<\/strong><\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"605\" height=\"208\" src=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-26.png\" alt=\"\" class=\"wp-image-793\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-26.png 605w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-26-300x103.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-26-500x172.png 500w\" sizes=\"(max-width: 605px) 100vw, 605px\" \/><figcaption><strong>you must grant the permissions to your tenant!<\/strong><\/figcaption><\/figure>\n\n\n\n<p>After that, you must give the app registration user adin access to the workspace:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"605\" height=\"238\" src=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-22.png\" alt=\"\" class=\"wp-image-789\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-22.png 605w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-22-300x118.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-22-500x197.png 500w\" sizes=\"(max-width: 605px) 100vw, 605px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"531\" height=\"277\" src=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-23.png\" alt=\"\" class=\"wp-image-790\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-23.png 531w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-23-300x156.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-23-500x261.png 500w\" sizes=\"(max-width: 531px) 100vw, 531px\" \/><\/figure>\n\n\n\n<p>Now you must setup the web.config:<\/p>\n\n\n\n<ol type=\"1\"><li>Setup the Authentication Type to \u201cService Principal\u201d<\/li><li>Set the application Id, you will get it from the overview page of the created service principal<\/li><li>Setup the workspace and report id (step 3 and 4)<\/li><li>Paste here the secret<\/li><li>Setup your tenant id, you will also get the id from the overview page of the service principal<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"605\" height=\"370\" src=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-27.png\" alt=\"\" class=\"wp-image-794\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-27.png 605w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-27-300x183.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-27-491x300.png 491w\" sizes=\"(max-width: 605px) 100vw, 605px\" \/><\/figure>\n\n\n\n<p>Finally we can run our app by using the principal<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"605\" height=\"309\" src=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-28.png\" alt=\"\" class=\"wp-image-795\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-28.png 605w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-28-300x153.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/12\/image-28-500x255.png 500w\" sizes=\"(max-width: 605px) 100vw, 605px\" \/><\/figure>\n\n\n\n<p>That&#8217;s it! Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With the Power BI Embedded OnBoarding Tool you can easily embed applications. But the standard mode uses an users with a password. This users requires a Power BI Pro license and normally this users stands under some organizational standards, such &hellip; <a href=\"https:\/\/www.flip-design.de\/?p=783\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/posts\/783"}],"collection":[{"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=783"}],"version-history":[{"count":10,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/posts\/783\/revisions"}],"predecessor-version":[{"id":809,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/posts\/783\/revisions\/809"}],"wp:attachment":[{"href":"https:\/\/www.flip-design.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=783"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=783"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}