WaelHamze / xrm-ci-framework

xRM CI Framework provides you with the tools automate the build and deployment of your CRM Solution. Using the framework to implement a fully automated DevOps pipeline will allow you to deploy more frequently with added consistency and quality.
MIT License
186 stars 117 forks source link

Issue on CRM package Deployer in Azure DevOps yaml script #256

Closed ravikatrenikona closed 4 years ago

ravikatrenikona commented 4 years ago

Hi , I am facing issue on powershell script (import-crmconnection) by using below YAML script name: $(BuildDefinitionName)-$(Date:yyyyMMdd).$(Rev:.r)

trigger:

pool:

Agent is my local private agent

name: Default

steps:

Download Package Deployer PowerShell module

download packages

use connection string defined VSTS variables

issue is: ##[command]"C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C:\Users\Ravi.k\agent_work_temp\7a645cb0-3e17-469b-ad4c-4039bce3cb04.ps1'" Get-CrmConnection : Failed to connect to CRM: Unable to connect to CRM: The remote name could not be resolved: 'veripark130.crm.dynamics.com' Metadata contains a reference that cannot be resolved: 'https://xxxxxx/XRMServices/2011/Organization.svc?wsdl&sdkversion=9'. => The remote name could not be resolved: 'xxxxx.crm.dynamics.com'Unable to Login to Dynamics CRM Unable to Login to Dynamics CRM At C:\Users\Ravi.k\agent_work_temp\7a645cb0-3e17-469b-ad4c-4039bce3cb04.ps1:2 char:13

[error]PowerShell exited with code '1'.

could you help me any give me any valuable suggestions on this

WaelHamze commented 4 years ago

@ravikatrenikona looks like you may be facing an connectivity issue there. Looks like you are trying to access an online instance. Where is the agent?

ravikatrenikona commented 4 years ago

Hi WaekHamze,

Thanks for responding, i have used my private agent in my azure devops server(on-premise version 2019).

Let me know if any queries

Regards Ravikumar K Release Manager


From: WaelHamze notifications@github.com Sent: 12 February 2020 01:36:59 To: WaelHamze/xrm-ci-framework xrm-ci-framework@noreply.github.com Cc: Ravikumar KATRENONA Ravi.K@veripark.com; Mention mention@noreply.github.com Subject: Re: [WaelHamze/xrm-ci-framework] Issue on CRM package Deployer in Azure DevOps yaml script (#256)

@ravikatrenikonahttps://github.com/ravikatrenikona looks like you may be facing an connectivity issue there. Looks like you are trying to access an online instance. Where is the agent?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/WaelHamze/xrm-ci-framework/issues/256?email_source=notifications&email_token=ANVPKUUAWSS6HCSF6XHABWDRCMAOHA5CNFSM4KKRBGWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELN34PQ#issuecomment-584826430, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANVPKUSMGC4JNALWFGK6MATRCMAOHANCNFSM4KKRBGWA.

ravikatrenikona commented 4 years ago

issue resolved. i have updated below format in the Yaml script(Azure devops pipelines).

**- powershell: Install-Module Microsoft.Xrm.Data.Powershell -Force -AllowClobber displayName: 'Install Microsoft.Xrm.Data.PowerShell'

use connection string defined VSTS variables

_- powershell: | $connection=Get-CrmConnection -ConnectionString "AuthType=Office365;Domain=veripark22;UserName=$env:ServiceAccountUpn;Password=$env:ServiceAccountPassword;Url=https://$env:EnvironmentName.crm.dynamics.com" $connection = Get-CrmConnection `**

  -ConnectionString `
   ("AuthType = Office365;" + `
   "Username = $env:ServiceAccountUpn;" + `
    "Password = $env:ServiceAccountPassword;" + `
    "Url = https://$env:EnvironmentName.crm.dynamics.com")_**

Then i have successfully uploaded(imported solution) into my target CRM environment.

But getting error and facing issues on below task in the yaml script(t(Azure devops pipelines)

Error: Import-CrmPackage : The term 'Import-CrmPackage' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\Users\Ravi.k\agent_work_temp\0bc7a11d-26fb-4996-ac70-026c682de884.ps1:6 char:1

[error]PowerShell exited with code '1'.

WaelHamze commented 4 years ago

@ravikatrenikona

Glad you resolved this. Thx for sharing the solution.