<?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: Can't get API token from Azure machines... in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Can-t-get-API-token-from-Azure-machines/m-p/3976645#M53176</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/706642"&gt;@JECp&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It sounds like there may be an issue with the authentication process when trying to acquire the API token. The possible solution could be to check if the Azure VMs have the sufficient permissions to access the Power BI API. You may also want to check if the client ID and credentials being used are still valid and have not expired or been revoked.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://stackoverflow.com/questions/77939584/how-to-do-the-authentication-to-run-power-bi-rest-api-in-an-azure-function-powe" target="_blank"&gt;How to do the authentication to run Power Bi Rest Api in an Azure Function (PowerShell)? - Stack Overflow&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://stackoverflow.com/questions/76059090/how-to-generate-access-token-for-azure-with-grant-type-password-powerbi-rest-ap" target="_blank"&gt;How to generate Access Token for Azure with grant type password? PowerBI REST API - Stack Overflow&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/role-based-access-control/quickstart-assign-role-user-portal" target="_blank"&gt;Tutorial: Grant a user access to Azure resources using the Azure portal - Azure RBAC | Microsoft Learn&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://techcommunity.microsoft.com/t5/azure-infrastructure-blog/azure-permissions-101-how-to-manage-azure-access-effectively/ba-p/4067468" target="_blank"&gt;Azure Permissions 101: How to manage Azure access effectively&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jun 2024 09:21:16 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-06-06T09:21:16Z</dc:date>
    <item>
      <title>Can't get API token from Azure machines...</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Can-t-get-API-token-from-Azure-machines/m-p/3975443#M53156</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a program that uses the Power BI API and has been running just fine for years. We recently moved some machines from on-prem to Azure VMs and suddenly this program no longer works. The error occurs when I run:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Using tsk As Tasks.Task(Of AuthenticationResult) = ctxt.AcquireTokenAsync("https://analysis.windows.net/powerbi/api", sClientID, cred)
                tsk.Wait()
End Using&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The StackTrace is:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JECp_0-1717624378867.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1111926i41DFCCDFBBDCE3C6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JECp_0-1717624378867.png" alt="JECp_0-1717624378867.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, the error message is an incredibly helpful "One or more errors occurred".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At first, we thought it was a firewall issue, but we can access sites using https, so we know Port 443 is open and working, and the documentation says that the Power BI API only uses 443.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any ideas on what could possibly cause this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 22:00:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Can-t-get-API-token-from-Azure-machines/m-p/3975443#M53156</guid>
      <dc:creator>JECp</dc:creator>
      <dc:date>2024-06-05T22:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get API token from Azure machines...</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Can-t-get-API-token-from-Azure-machines/m-p/3976645#M53176</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/706642"&gt;@JECp&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It sounds like there may be an issue with the authentication process when trying to acquire the API token. The possible solution could be to check if the Azure VMs have the sufficient permissions to access the Power BI API. You may also want to check if the client ID and credentials being used are still valid and have not expired or been revoked.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://stackoverflow.com/questions/77939584/how-to-do-the-authentication-to-run-power-bi-rest-api-in-an-azure-function-powe" target="_blank"&gt;How to do the authentication to run Power Bi Rest Api in an Azure Function (PowerShell)? - Stack Overflow&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://stackoverflow.com/questions/76059090/how-to-generate-access-token-for-azure-with-grant-type-password-powerbi-rest-ap" target="_blank"&gt;How to generate Access Token for Azure with grant type password? PowerBI REST API - Stack Overflow&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/role-based-access-control/quickstart-assign-role-user-portal" target="_blank"&gt;Tutorial: Grant a user access to Azure resources using the Azure portal - Azure RBAC | Microsoft Learn&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://techcommunity.microsoft.com/t5/azure-infrastructure-blog/azure-permissions-101-how-to-manage-azure-access-effectively/ba-p/4067468" target="_blank"&gt;Azure Permissions 101: How to manage Azure access effectively&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 09:21:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Can-t-get-API-token-from-Azure-machines/m-p/3976645#M53176</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-06T09:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get API token from Azure machines...</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Can-t-get-API-token-from-Azure-machines/m-p/3977740#M53194</link>
      <description>&lt;P&gt;We looked into firewall and DNS issues, but everything was clear on that front. I was able to get more info about the error though, and it shows this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JECp_1-1717695743559.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1112501i404570FCA9582F43/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JECp_1-1717695743559.png" alt="JECp_1-1717695743559.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't understand why I'm getting this, as this is the same App Reg, same user being used for authentication, same network. It's just that the machines I run this from (when it fails) are all Azure VMs. Any on-prem machine works just fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it seeing Azure VMs as being at a different "location"? If so, how do I address this? I need this code to run from both locations.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 17:42:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Can-t-get-API-token-from-Azure-machines/m-p/3977740#M53194</guid>
      <dc:creator>JECp</dc:creator>
      <dc:date>2024-06-06T17:42:37Z</dc:date>
    </item>
  </channel>
</rss>

