<?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: Error while authenticating using registered App. in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Error-while-authenticating-using-registered-App/m-p/2263018#M33703</link>
    <description>&lt;P&gt;Hi @Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The resource must be either the client ID of the app or if you want to specify the resource parameter in form of URL, you need to Expose an API on the application and add required scopes. The Resource URL in the request must match with the Application ID URI. Please refer to the highlighted sections in the screenshot below:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="test.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/650247i2B4B2FF3DC4C4E6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="test.png" alt="test.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Once this is done, you need to add permissions for that API under API permissions section of the application and grant admin consent.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Liang&lt;BR /&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jan 2022 02:10:37 GMT</pubDate>
    <dc:creator>V-lianl-msft</dc:creator>
    <dc:date>2022-01-03T02:10:37Z</dc:date>
    <item>
      <title>Error while authenticating using registered App.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-while-authenticating-using-registered-App/m-p/2259319#M33649</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I am new to powershell coding, so I need your help in below topic :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While writing the below piece of powershell code to get the list of workspaces in my organization I am getting the below error :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PowerShell Code :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;#Remember to import Exchange Online module and connect.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;#$Username = "MY_USERNAME"&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;#$Password = ConvertTo-SecureString -String "MY_PASSWORD" -AsPlainText -Force&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;#$UserCredential =New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $Username, $Password&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;#Connect-MsolService -credential $UserCredential&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;#Define $info array&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;#$info = @()&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;#To edit the permission of app please access portal.azure.com in AAD&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;$clientId = "FILL ME IN"&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;# Calls the Active Directory Authentication Library (ADAL) to authenticate against AAD&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;function GetAuthToken&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $adal = "${env:ProgramFiles}\WindowsPowerShell\Modules\AzureRM.profile\5.8.4\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $adalforms = "${env:ProgramFiles}\WindowsPowerShell\Modules\AzureRM.profile\5.8.4\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll"&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [System.Reflection.Assembly]::LoadFrom($adal) | Out-Null&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [System.Reflection.Assembly]::LoadFrom($adalforms) | Out-Null&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $redirectUri = "&lt;A href="https://oauth.powerbi.com/PBIAPIExplorer" target="_blank" rel="noopener"&gt;https://oauth.powerbi.com/PBIAPIExplorer&lt;/A&gt;"&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $resourceAppIdURI = "&lt;A href="https://analysis.windows.net/powerbi/api" target="_blank" rel="noopener"&gt;https://analysis.windows.net/powerbi/api&lt;/A&gt;"&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $authority = "&lt;A href="https://login.microsoftonline.com/common/oauth2/authorize" target="_blank" rel="noopener"&gt;https://login.microsoftonline.com/common/oauth2/authorize&lt;/A&gt;";&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $authContext = New-Object "Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext" -ArgumentList $authority&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $authResult = $authContext.AcquireToken( $resourceAppIdURI, $clientId, $redirectUri, "Auto")&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return $authResult&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;# Get the auth token from AAD&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;$token = GetAuthToken&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;# Building Rest API header with authorization token&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;$authHeader = @{&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; 'Content-Type'='application/json'&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; 'Authorization'=$token.CreateAuthorizationHeader()&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;#Lets get all Groups&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;$uri = "&lt;A href="https://api.powerbi.com/v1.0/myorg/groups" target="_blank" rel="noopener"&gt;https://api.powerbi.com/v1.0/myorg/groups&lt;/A&gt;"&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;$groups = Invoke-RestMethod -Uri $uri -Headers $authHeader -Method GET -Verbose&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;$groups.value&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Error Message while running the script :&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Error.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/649332iF0A72EDBC452DCE0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Error.png" alt="Error.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Although, in app settings redirect URI and resource APP ID uri are pointing to the respective links.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also, I am following the below links as reference:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A title="https://docs.microsoft.com/en-us/power-bi/developer/embedded/register-app?tabs=organization%2cazure" href="https://docs.microsoft.com/en-us/power-bi/developer/embedded/register-app?tabs=organization%2CAzure" target="_blank" rel="noopener noreferrer"&gt;Register an app to embed Power BI content in a Power BI embedded analytics application - Power BI | Microsoft Docs&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A title="https://docs.microsoft.com/en-us/rest/api/power-bi/?redirectedfrom=msdn" href="https://docs.microsoft.com/en-us/rest/api/power-bi/?redirectedfrom=MSDN" target="_blank" rel="noopener noreferrer"&gt;Power BI REST APIs for embedded analytics and automation - Power BI REST API | Microsoft Docs&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A title="https://www.fourmoo.com/2018/06/05/using-the-power-bi-api-with-powershell-scripts-refreshing-your-dataset/" href="https://www.fourmoo.com/2018/06/05/using-the-power-bi-api-with-powershell-scripts-refreshing-your-dataset/" target="_blank" rel="noopener noreferrer"&gt;Using the Power BI API with PowerShell scripts - Refreshing your dataset - Reporting/Analytics Made easy with FourMoo and Power BI&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you in advance&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Dec 2021 08:38:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-while-authenticating-using-registered-App/m-p/2259319#M33649</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-29T08:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Error while authenticating using registered App.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-while-authenticating-using-registered-App/m-p/2263018#M33703</link>
      <description>&lt;P&gt;Hi @Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The resource must be either the client ID of the app or if you want to specify the resource parameter in form of URL, you need to Expose an API on the application and add required scopes. The Resource URL in the request must match with the Application ID URI. Please refer to the highlighted sections in the screenshot below:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="test.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/650247i2B4B2FF3DC4C4E6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="test.png" alt="test.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Once this is done, you need to add permissions for that API under API permissions section of the application and grant admin consent.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Liang&lt;BR /&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 02:10:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-while-authenticating-using-registered-App/m-p/2263018#M33703</guid>
      <dc:creator>V-lianl-msft</dc:creator>
      <dc:date>2022-01-03T02:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Error while authenticating using registered App.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-while-authenticating-using-registered-App/m-p/2263266#M33710</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/182446"&gt;@V-lianl-msft&lt;/a&gt;&amp;nbsp; for providing the solution.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 07:41:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-while-authenticating-using-registered-App/m-p/2263266#M33710</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-03T07:41:33Z</dc:date>
    </item>
  </channel>
</rss>

