{"id":730,"date":"2020-11-28T16:08:34","date_gmt":"2020-11-28T14:08:34","guid":{"rendered":"http:\/\/www.flip-design.de\/?p=730"},"modified":"2020-11-30T19:52:40","modified_gmt":"2020-11-30T17:52:40","slug":"azure-runbooks-and-pausing-power-bi-a-skus","status":"publish","type":"post","link":"https:\/\/www.flip-design.de\/?p=730","title":{"rendered":"Azure Runbooks and pausing Power BI A-SKU&#8217;s"},"content":{"rendered":"\n<p>If you have A-SKU&#8217;s deployed on Azure to run Power BI Embedded Resources for your developers, it is good to save money at non-working times, when you pause your capacity. This also applies when you have an application which is only used on your business hours.<\/p>\n\n\n\n<p>So you can use Azure Automation to trigger a start and stop event on appreciated times..<\/p>\n\n\n\n<p>Okay, this is the ressource:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"428\" src=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image-1024x428.png\" alt=\"\" class=\"wp-image-732\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image-1024x428.png 1024w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image-300x125.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image-768x321.png 768w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image-500x209.png 500w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image.png 1315w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>When we want to implement a Azure Automation Runbook to automate to start\/stop the resource, we need an Azure Automation Account in our tenant:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"354\" src=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image-1-1024x354.png\" alt=\"\" class=\"wp-image-733\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image-1-1024x354.png 1024w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image-1-300x104.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image-1-768x265.png 768w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image-1-1536x531.png 1536w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image-1-500x173.png 500w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image-1.png 1574w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Now we can create a runbooks (type: Power Shell)<\/p>\n\n\n\n<p>The Script documentation can be found here:<br><a href=\"https:\/\/docs.microsoft.com\/en-us\/rest\/api\/power-bi-embedded\/capacities\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/docs.microsoft.com\/en-us\/rest\/api\/power-bi-embedded\/capacities<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"238\" src=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/1-1024x238.png\" alt=\"\" class=\"wp-image-734\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/1-1024x238.png 1024w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/1-300x70.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/1-768x179.png 768w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/1-500x116.png 500w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/1.png 1435w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>If you have multiple subscription in your tenant, you must set the default subscription at your runbook with following command. Otherwise you will receive following error:<br><strong><span style=\"color:#a30012\" class=\"has-inline-color\">Select-AzureSubscription : The subscription name MVP doesn&#8217;t exist.<\/span><\/strong><br><br>Code for selecting the default subscription:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$connectionName = \"AzureRunAsConnection\"\ntry\n{\n# Get the connection \"AzureRunAsConnection \"\n$servicePrincipalConnection=Get-AutomationConnection -Name $connectionName\n\n \n\n\"Logging in to Azure...\"\nAdd-AzureRmAccount `\n-ServicePrincipal `\n-TenantId $servicePrincipalConnection.TenantId `\n-ApplicationId $servicePrincipalConnection.ApplicationId `\n-CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint\n}\ncatch {\nif (!$servicePrincipalConnection)\n{\n$ErrorMessage = \"Connection $connectionName not found.\"\nthrow $ErrorMessage\n} else{\nWrite-Error -Message $_.Exception\nthrow $_.Exception\n}\n}<\/code><\/pre>\n\n\n\n<p>Okay, this command is for starting:<br><code>Resume-AzureRmPowerBIEmbeddedCapacity -Name \"pbiem001\" -ResourceGroupName \"PBI\" -PassThru<\/code><\/p>\n\n\n\n<p>This one is for stopping the resource:<br><code>Stop-AzureRmPowerBIEmbeddedCapacity -Name \"pbiem001\" -ResourceGroupName \"PBI\" -PassThru<\/code><\/p>\n\n\n\n<p>Now you can add schedules to every runbook to trigger the code to your appreciated time to start or stop the ressource.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"761\" height=\"346\" src=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image-2.png\" alt=\"\" class=\"wp-image-735\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image-2.png 761w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image-2-300x136.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2020\/11\/image-2-500x227.png 500w\" sizes=\"(max-width: 761px) 100vw, 761px\" \/><\/figure>\n\n\n\n<p>That\u2019s it, now you can safe money &#x1f60a;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you have A-SKU&#8217;s deployed on Azure to run Power BI Embedded Resources for your developers, it is good to save money at non-working times, when you pause your capacity. This also applies when you have an application which is &hellip; <a href=\"https:\/\/www.flip-design.de\/?p=730\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[1,30,27,41],"tags":[],"_links":{"self":[{"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/posts\/730"}],"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=730"}],"version-history":[{"count":3,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/posts\/730\/revisions"}],"predecessor-version":[{"id":737,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/posts\/730\/revisions\/737"}],"wp:attachment":[{"href":"https:\/\/www.flip-design.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=730"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=730"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=730"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}