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.
10,196 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. KranthiPakala-MSFT 46,442 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.