Getting strange error when trying to connect ADF to dataverse using SPN

Justin Adan 6 Reputation points
2022-04-14T13:58:49.81+00:00

Im trying to connect ADF to Dataverse using a SPN. The SPN works properly, and is currently in use for pipelines. However when trying to connect using ADF is get the below error.

Any ideas what I am doing wrong?

Error code23604
DetailsFailed to connect to Dynamics: Unable to Login to Dynamics CRM: Invalid Login Information : The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Bearer authorization_uri=https://login.microsoftonline.com/366b8d18-99ea-436a-824b-1ca89c369476/oauth2/authorize, resource_id=REDACTED BUT CORRECT/'. The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Bearer authorization_uri=https://login.microsoftonline.com/366b8d18-99ea-436a-824b-1ca89c369476/oauth2/authorize, resource_id=https://REDACTED BUT CORRECT/'. => The remote server returned an error: (401) Unauthorized.Unable to Login to Dynamics CRM Unable to Login to Dynamics CRM The creator of this fault did not specify a Reason. Activity ID: 833ddfbf-6d40-46da-81af-a2554f3d3b82.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,257 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. KranthiPakala-MSFT 46,602 Reputation points Microsoft Employee
    2022-04-18T21:18:56.363+00:00

    Hello @Justin Adan ,

    Thanks for the question and using MS Q&A platform.

    From the error message, it seems like your SPN doesn't have permission to your Dynamics CRM. Could you please make sure that the Service Principal permission to Dynamics of was configured correctly?

    In order to grant the permissions, you may need a “tenant administrator” to run the below commands to add your application (SP) into the service.
    Therefore, please work with your dynamics tenant administrator to grant the app access by running the following command in PowerShell (run as administrator):

    1. Find-Module Microsoft.PowerApps.Administration.PowerShell
    2. Install-Module Microsoft.PowerApps.Administration.PowerShell
    3. Select A (Yes to all)
    4. Import-Module Microsoft.PowerApps.Administration.PowerShell
    5. Add-PowerAppsAccount -Endpoint prod -TenantID <Your APP Tenant ID>
    6. New-PowerAppManagementApp -ApplicationId <Your APP Application ID>
    7. Add-PowerAppsAccount -Endpoint prod -TenantID <Your APP Tenant ID> -ApplicationID <Your APP Application ID> -ClientSecret <Your APP Secret Value> -Verbose

    In addition to above, also please refer to the prerequisites mentioned in the ADF connector documentation: Prerequisites

    193996-image.png

    Hope this helps. Do let us know how it goes.


  2. Hammed Abdulazeez 0 Reputation points MVP
    2024-11-16T14:08:41.62+00:00

    I am having the same issue but different error. I have enabled the MFA but still thrown the error.

    See below:

    Failed to connect to Dataverse

    ExternalTokenManagement Authentication Requested but not configured correctly. 003

    AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access '00000007-0000-0000-c000-000000000000'. Trace ID: 2a845c3d-3c24-4958-a9fd-cdb400060600 Correlation ID: c07f2122-5ba1-4988-b252-1b68a7b6da0c Timestamp: 2024-11-16 14:05:32Z

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.