WaelHamze / dyn365-ce-vsts-tasks

VSTS Extension for Dynamics 365 Customer Engagement
https://marketplace.visualstudio.com/items?itemName=WaelHamze.xrm-ci-framework-build-tasks
GNU General Public License v3.0
115 stars 54 forks source link

Ping/Import Solution Task Failed to Connect to Powerplatform using OAuth2 Connection due to MetaData URL not Resolved #254

Closed lheng18 closed 2 years ago

lheng18 commented 2 years ago

2022-01-27T19:35:12.3951491Z ##[section]Starting: Import Solution 2022-01-27T19:35:12.4184335Z ============================================================================== 2022-01-27T19:35:12.4184915Z Task : Import Solution 2022-01-27T19:35:12.4185292Z Description : Import a Solution into a PowerApps/CDS/Dynamics 365 environment 2022-01-27T19:35:12.4185831Z Version : 12.0.5 2022-01-27T19:35:12.4186073Z Author : Wael Hamze 2022-01-27T19:35:12.4186623Z Help : This task invokes ImportSolutionRequest 2022-01-27T19:35:12.4187963Z ============================================================================== Unable to login to Dynamics CRM, Error was : Metadata contains a reference that cannot be resolved: 'https://testCRM.crm.dynamics.com/testCRM/XRMServices/2011/Organization.svc?wsdl&sdkversion=9'. Metadata contains a reference that cannot be resolved: 'https://testCRM.crm.dynamics.com/testCRM/XRMServices/2011/Organization.svc?wsdl&sdkversion=9'. => The remote server returned an error: (404) Not Found.Unable to Login to Dynamics CRM Unable to Login to Dynamics CRM

Here is the connection string being used. AuthType=OAuth;Username=$(svc-account);Password=$(svc-credential);Url=$(dyn365TargetURL); ClientId=2ad88395-b77d-4561-9441-d0e40824f9bc; RedirectUri=app://5d3e90d6-aa8e-48a8-8f2c-58b45cc67315;

It adds environment name, testCRM in the in the organization service URL. If I remove it, the url https://testCRM.crm.dynamics.com/XRMServices/2011/Organization.svc?wsdl&sdkversion=9' works fine. @WaelHamze do you know why it adds environment name in the URL?

By the way I have an another pipeline using the older version of the tool, v11 using the same OAuth connection string. It works fine. Here is an import solution task running history.

2022-01-28T09:35:17.7347843Z ##[section]Starting: MSCRM Import Solution 2022-01-28T09:35:17.7547529Z ============================================================================== 2022-01-28T09:35:17.7548092Z Task : MSCRM Import Solution 2022-01-28T09:35:17.7548383Z Description : Import a Dynamics CRM Solution package 2022-01-28T09:35:17.7548612Z Version : 11.0.4 2022-01-28T09:35:17.7548832Z Author : Wael Hamze 2022-01-28T09:35:17.7549116Z Help : This task invokes ImportSolutionRequest in Async mode 2022-01-28T09:35:17.7549448Z ============================================================================== 2022-01-28T09:35:24.7523340Z Importing Solution: D:\a\r1\a_Export Chevron PowerApps Solution\drop\UserView_managed.zip 2022-01-28T09:35:24.7539077Z Solution Zip Size: 8.63 KB 2022-01-28T09:35:24.8069631Z Solution Unique Name: MySolution, Version: 1.0.0.4 2022-01-28T09:35:25.0253511Z MySolution not currently installed. 2022-01-28T09:36:56.9278316Z Async Operation completed with status: Succeeded 2022-01-28T09:36:56.9282057Z Async Operation completed with message: 2022-01-28T09:36:57.1022489Z Completed Progress: 100 2022-01-28T09:36:57.1029555Z Completed On: 1/28/2022 9:36:51 AM 2022-01-28T09:36:57.1057165Z Import Result: success 2022-01-28T09:36:57.1066158Z Import Error: 2022-01-28T09:36:57.1964069Z ##[warning]Total number of unprocessed components: 4 2022-01-28T09:36:57.6195600Z Import Job Log successfully saved to: D:\a\r1\a\ImportLog_MySolution_managed2022_01_28__09_35.xml 2022-01-28T09:36:57.6196863Z Solution Import Completed Successfully 2022-01-28T09:36:57.6652742Z ##[section]Finishing: MSCRM Import Solution

Not sure what the new version changes that adds the environment name in the meta data URL.

You quick help would very appreciated.

Thanks!

Henry

lheng18 commented 2 years ago

@WaelHamze did you see this issue? Thanks!

lheng18 commented 2 years ago

@WaelHamze need your help.

MscrmTools commented 2 years ago

@lheng18, your connectionstring must be wrong. I had the same issue. if you write AuthType=OAuth with the wrong case for the term "OAuth", then it is not recognised and default to OnPremise connection.

lheng18 commented 2 years ago

@MscrmTools Thanks for your response. If you search in my post, I did use the correct case for OAuth. I pasted it below image I think the issue was fixed. It automatically worked last time. Thanks for getting back to me.