<?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 Azure Monitor Rest API Authentication Data Factory in Pipelines</title>
    <link>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Monitor-Rest-API-Authentication-Data-Factory/m-p/4041097#M4546</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am calling the same API in Power BI desktop and Fabric Data Factory. It works ok with Power BI desktop&amp;nbsp;(and service) but I am facing an authentication error in Data Factory. In desktop and service it is Oauth2but data factory does not have this option so I used basic authentication. I am new to working with APIs and API authentication.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to use the same authentication I am using for power bi desktop (just my org username) with data factory? Or I have to create a Service Principal for this API?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;API:&lt;/STRONG&gt;&amp;nbsp;&lt;A href="https://management.azure.com/subscriptions/{subscriptionID}/resourceGroups/{resourceGroupID}/providers/microsoft.insights/metrics?timespan=2024-04-01T22:20:00.000Z/2024-06-30T23:45:00.000Z&amp;amp;interval=PT30M&amp;amp;metricnames=Percentage" target="_blank" rel="noopener"&gt;https://management.azure.com/subscriptions/{subscriptionID}/resourceGroups/{resourceGroupID}/providers/microsoft.insights/metrics?timespan=2024-04-01T22:20:00.000Z/2024-06-30T23:45:00.000Z&amp;amp;interval=PT30M&amp;amp;metricnames=Percentage&lt;/A&gt; CPU&amp;amp;top=100&amp;amp;aggregation=average&amp;amp;api-version=2023-10-01&amp;amp;region={region}&amp;amp;metricNamespace=microsoft.compute/virtualmachines&amp;amp;$filter=Microsoft.ResourceId eq '*'"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data Factory Error:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Rest call failed with client error, status code 401 Unauthorized, please check your activity settings.&lt;BR /&gt;Response: {"error":{"code":"AuthenticationFailedInvalidHeader","message":"Authentication failed. The 'Authorization' header is provided in an invalid format."}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried getting a token by loging in here but I am getting an error:&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;returns error: The request body must contain the following parameter: 'client_id'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I have to register theAPP like below or there is an easier way?&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/azure-monitor/logs/api/register-app-for-token?tabs=portal" target="_blank" rel="noopener"&gt;Register an App to request authorization tokens and work with APIs - Azure Monitor | Microsoft Learn&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Sam&lt;/P&gt;</description>
    <pubDate>Sun, 14 Jul 2024 13:42:59 GMT</pubDate>
    <dc:creator>Samco23</dc:creator>
    <dc:date>2024-07-14T13:42:59Z</dc:date>
    <item>
      <title>Azure Monitor Rest API Authentication Data Factory</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Monitor-Rest-API-Authentication-Data-Factory/m-p/4041097#M4546</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am calling the same API in Power BI desktop and Fabric Data Factory. It works ok with Power BI desktop&amp;nbsp;(and service) but I am facing an authentication error in Data Factory. In desktop and service it is Oauth2but data factory does not have this option so I used basic authentication. I am new to working with APIs and API authentication.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to use the same authentication I am using for power bi desktop (just my org username) with data factory? Or I have to create a Service Principal for this API?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;API:&lt;/STRONG&gt;&amp;nbsp;&lt;A href="https://management.azure.com/subscriptions/{subscriptionID}/resourceGroups/{resourceGroupID}/providers/microsoft.insights/metrics?timespan=2024-04-01T22:20:00.000Z/2024-06-30T23:45:00.000Z&amp;amp;interval=PT30M&amp;amp;metricnames=Percentage" target="_blank" rel="noopener"&gt;https://management.azure.com/subscriptions/{subscriptionID}/resourceGroups/{resourceGroupID}/providers/microsoft.insights/metrics?timespan=2024-04-01T22:20:00.000Z/2024-06-30T23:45:00.000Z&amp;amp;interval=PT30M&amp;amp;metricnames=Percentage&lt;/A&gt; CPU&amp;amp;top=100&amp;amp;aggregation=average&amp;amp;api-version=2023-10-01&amp;amp;region={region}&amp;amp;metricNamespace=microsoft.compute/virtualmachines&amp;amp;$filter=Microsoft.ResourceId eq '*'"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data Factory Error:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Rest call failed with client error, status code 401 Unauthorized, please check your activity settings.&lt;BR /&gt;Response: {"error":{"code":"AuthenticationFailedInvalidHeader","message":"Authentication failed. The 'Authorization' header is provided in an invalid format."}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried getting a token by loging in here but I am getting an error:&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;returns error: The request body must contain the following parameter: 'client_id'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I have to register theAPP like below or there is an easier way?&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/azure-monitor/logs/api/register-app-for-token?tabs=portal" target="_blank" rel="noopener"&gt;Register an App to request authorization tokens and work with APIs - Azure Monitor | Microsoft Learn&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Sam&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jul 2024 13:42:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Monitor-Rest-API-Authentication-Data-Factory/m-p/4041097#M4546</guid>
      <dc:creator>Samco23</dc:creator>
      <dc:date>2024-07-14T13:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Azure Monitor Rest API Authentication Data Factory</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Monitor-Rest-API-Authentication-Data-Factory/m-p/4041760#M4561</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="612954" data-lia-user-login="Samco23" class="lia-mention lia-mention-user"&gt;Samco23&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I think you firstly need to Navigate to the Azure portal -&amp;gt; Subscription -&amp;gt; add your service principal as a Contributor/Owner role in the subscription like below.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then I think i&lt;SPAN&gt;n the linked service, configure it like below, fix them with the values.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally I t&lt;SPAN&gt;est the linked service with a copy activity, it works fine.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also look at this document for a further study:&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/entra/identity-platform/howto-create-service-principal-portal#register-an-application-with-azure-ad-and-create-a-service-principal" target="_blank"&gt;Register a Microsoft Entra app and create a service principal - Microsoft identity platform | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;Yilong Zhou&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 06:21:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Azure-Monitor-Rest-API-Authentication-Data-Factory/m-p/4041760#M4561</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-15T06:21:34Z</dc:date>
    </item>
  </channel>
</rss>

