<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Use PowerShell to automate Power Bi dataflow refresh without login POPUP. in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Use-PowerShell-to-automate-Power-Bi-dataflow-refresh-without/m-p/2640417#M37363</link>
    <description>&lt;P&gt;Hi!&lt;BR /&gt;Thanks for the reply.&lt;BR /&gt;Yeah, I read on the documentation that we need to input application ID and secret as credentials for using Power Bi APIs. Since app registration in AzureAD is blocked for us, so we cannot obtain the app ID and secret.&lt;/P&gt;&lt;P&gt;If I understand correctly, getting a certificate thumbprint also requires app registration in AzureAD. Correct me, if I am wrong.&lt;BR /&gt;In that case, we are stuck as well.&lt;/P&gt;&lt;P&gt;Let's see, if I can ask my client's IT team if they can allow us temporarily to register an app once at least.&lt;BR /&gt;&lt;BR /&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;sdm&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jul 2022 06:56:55 GMT</pubDate>
    <dc:creator>SDM_1997</dc:creator>
    <dc:date>2022-07-15T06:56:55Z</dc:date>
    <item>
      <title>Use PowerShell to automate Power Bi dataflow refresh without login POPUP.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-PowerShell-to-automate-Power-Bi-dataflow-refresh-without/m-p/2630271#M37275</link>
      <description>&lt;P&gt;Hi All,&lt;BR /&gt;&lt;SPAN&gt;I have this requirement where I need to automate my dataflow refreshes.&amp;nbsp;Now, using a simple scheduled refresh does not solve the issue because, if one dataflow fails, then the remaining dataflows should not refresh.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;For context, 1.) Power Automate Dataflow connectors are blocked by the client's IT team.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2.) App registrations in Azure AD are also blocked, so we cannot obtain&amp;nbsp;&lt;STRONG&gt;Client ID and Client secret&amp;nbsp;&lt;/STRONG&gt;to use programmatically in C# or any other language.&lt;/P&gt;&lt;P&gt;Now, I found that using PowerShell, it is possible to invoke Power BI REST API without any app registration.&lt;BR /&gt;I was following this link for reference. ( &lt;A href="https://stackoverflow.com/questions/54621283/login-to-power-bi-service-online-silently-i-e-without-the-popup-using-powersh" target="_blank" rel="noopener"&gt;powerbi - Login to power bi service online (silently i.e. without the popup) using powershell - Stack Overflow&lt;/A&gt; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the actual test code that I wrote for this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Import-Module MicrosoftPowerBIMgmt
Import-Module MicrosoftPowerBIMgmt.Profile

$password = "MicrosoftAccountPassword" | ConvertTo-SecureString -AsPlainText -Force
$username = "MyUserName@OrgName.onmicrosoft.com" 
$credential = New-Object System.Management.Automation.PSCredential($username, $password)

#Connect-PowerBIServiceAccount  (LINE 6)

Connect-PowerBIServiceAccount -Credential $credential (LINE 7)

$body = '{
  "notifyOption": "MailOnFailure"
}'
Invoke-PowerBIRestMethod -Url "https://api.powerbi.com/v1.0/myorg/groups/42dcdcb4-abc8-4116-bf3f-5e4dd80e2f8d/dataflows/fedc505d-edfc-474c-af53-e5ba735f4dd0/refreshes" -Method POST -Body $body

while($true)
{
    $data = Invoke-PowerBIRestMethod -Url "https://api.powerbi.com/v1.0/myorg/groups/42dcdcb4-abc8-4116-bf3f-5e4dd80e2f8d/dataflows/fedc505d-edfc-474c-af53-e5ba735f4dd0/transactions" -Method GET

    $newdata = $data | ConvertFrom-Json

    $flowStatus = $newdata.value.status[0]

    if($flowStatus -eq "Success")
    {
        Write-Host "Completed"
        break;
    }
    else
    {
        Write-Host "Running..."
        continue;
    }
}

Disconnect-PowerBIServiceAccount&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Now, this works perfectly fine, if I am using the 6th line of code. Here, I am getting a popup, where I manually login into my account and the rest of the API invoke works perfectly fine. But to automate this, I wanted to achieve the same thing without the PopUp.&lt;BR /&gt;For that, I tried using the 7th line of code. But it is unable to login into the account and I am getting an error.&lt;BR /&gt;Below is the error screenshot.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SDM_1997_0-1657527772617.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/746004iE86190F3109B5215/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SDM_1997_0-1657527772617.png" alt="SDM_1997_0-1657527772617.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is there something am I missing or is it really not possible to achieve this without the popup?&lt;BR /&gt;As I mentioned earlier, we are not allowed to register an app in Azure AD, so I cannot use the service principal method to log in via PowerShell. So, the only thing that I have is my Microsoft Account Username and Password.&lt;BR /&gt;Please let me know any workarounds, if possible.&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance!!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 08:32:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-PowerShell-to-automate-Power-Bi-dataflow-refresh-without/m-p/2630271#M37275</guid>
      <dc:creator>SDM_1997</dc:creator>
      <dc:date>2022-07-11T08:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: Use PowerShell to automate Power Bi dataflow refresh without login POPUP.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-PowerShell-to-automate-Power-Bi-dataflow-refresh-without/m-p/2637436#M37334</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;HI&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/357742"&gt;@SDM_1997&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&amp;nbsp;As the document mentions, the '-Credential' parameter works for 'Service&amp;nbsp;Principal', you can't directly use it without adding the '-ServicePrincipal' parameter:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="https://docs.microsoft.com/en-us/powershell/module/microsoftpowerbimgmt.profile/connect-powerbiserviceaccount?view=powerbi-ps" target="_blank" rel="noopener"&gt;Connect-PowerBIServiceAccount (MicrosoftPowerBIMgmt.Profile) | Microsoft Docs&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;-Credential&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;P&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;PSCredential representing the Azure Active Directory (AAD) application client ID (username) and application secret key (password) to authenticate with a service principal account (-ServicePrincipal).&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN&gt;Perhaps you can try to add '-CertificateThumbprint' to use the local certificate to verify the connection account steps.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;-CertificateThumbprint&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;P&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Certificate thumbprint of an installed certificate associated to an Azure Active Directory (AAD) application. Certificate must be installed in either the CurrentUser or LocalMachine personal certificate stores (LocalMachine requires an administrator prompt to access) with a private key installed.&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 01:38:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-PowerShell-to-automate-Power-Bi-dataflow-refresh-without/m-p/2637436#M37334</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-14T01:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: Use PowerShell to automate Power Bi dataflow refresh without login POPUP.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-PowerShell-to-automate-Power-Bi-dataflow-refresh-without/m-p/2640417#M37363</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;Thanks for the reply.&lt;BR /&gt;Yeah, I read on the documentation that we need to input application ID and secret as credentials for using Power Bi APIs. Since app registration in AzureAD is blocked for us, so we cannot obtain the app ID and secret.&lt;/P&gt;&lt;P&gt;If I understand correctly, getting a certificate thumbprint also requires app registration in AzureAD. Correct me, if I am wrong.&lt;BR /&gt;In that case, we are stuck as well.&lt;/P&gt;&lt;P&gt;Let's see, if I can ask my client's IT team if they can allow us temporarily to register an app once at least.&lt;BR /&gt;&lt;BR /&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;sdm&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 06:56:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-PowerShell-to-automate-Power-Bi-dataflow-refresh-without/m-p/2640417#M37363</guid>
      <dc:creator>SDM_1997</dc:creator>
      <dc:date>2022-07-15T06:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: Use PowerShell to automate Power Bi dataflow refresh without login POPUP.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-PowerShell-to-automate-Power-Bi-dataflow-refresh-without/m-p/2641611#M37372</link>
      <description>&lt;P&gt;The userID credentials you are using may have 2 Factor authentication on, thats why its forcing Pop Up.&lt;/P&gt;&lt;P&gt;If you dont want that pop up the USER credentials you are going to use should be like system account without 2 factor authentication and only username and password.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 14:25:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-PowerShell-to-automate-Power-Bi-dataflow-refresh-without/m-p/2641611#M37372</guid>
      <dc:creator>vasudevp</dc:creator>
      <dc:date>2022-07-15T14:25:59Z</dc:date>
    </item>
  </channel>
</rss>

