Closed ravikatrenikona closed 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?
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.
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'
_- 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)
powershell: | $PackageDirectory = Get-Item $(System.DefaultWorkingDirectory)\tools\PackageDeployment.PowerShell $PackageName = Get-Item $(System.DefaultWorkingDirectory)\Lesson-1\packedSolution\SimpleSurvey.dll $connection=Get-CrmConnection -ConnectionString "AuthType=Office365;ServiceUri=https://xxx.crm8.dynamics.com/XRMServices/2011/Organization.svc?wsdl;Username=xxxx@xxxx.onmicrosoft.com;Password=xxxxxx;Organization=xxxx"
Import-CrmPackage –CrmConnection $CRMConn1
–PackageDirectory $(System.DefaultWorkingDirectory)\tools\PackageDeployment.PowerShell –PackageName $(System.DefaultWorkingDirectory)\Lesson-1\packedSolution\SimpleSurvey.dll -Verbose
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
+ CategoryInfo : ObjectNotFound: (Import-CrmPackage:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : CommandNotFoundException
@ravikatrenikona
Glad you resolved this. Thx for sharing the solution.
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:
script: md tools displayName: 'Create tools directory'
powershell: | Invoke-WebRequest
-Uri https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
-OutFile tools\nuget.exe displayName: 'Download nuget.exe'powershell: | tools\nuget.exe install Microsoft.CrmSdk.CoreTools -O tools md "tools\CoreTools" $coreToolsFolder = Get-ChildItem tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.CoreTools.'} move "tools\$coreToolsFolder\content\bin\coretools\." "tools\CoreTools" Remove-Item "tools\$coreToolsFolder" -Force -Recurse displayName: 'Install CoreTools'
powershell: | Start-Process tools/CoreTools/SolutionPackager.exe
-ArgumentList
"/action: Pack","/zipfile: $(Build.ArtifactStagingDirectory)\packedSolution\$env:SolutionName.zip",
"/folder: $env:SolutionPath","/packagetype: Both"
-Wait ` -NoNewWindow env: SolutionPath: $(solution.path) SolutionName: $(solution.name) displayName: 'Solution Packager: pack solution'Download Package Deployer PowerShell module
powershell : | tools\nuget.exe install Microsoft.CrmSdk.XrmTooling.PackageDeployment.PowerShell -O .\Tools $pdPoshFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.PackageDeployment.PowerShell.'} move .\Tools\$pdPoshFolder\tools*.* .\Tools\PackageDeployment.PowerShell Remove-Item .\Tools\$pdPoshFolder -Force -Recurse
task: PublishBuildArtifacts@1 inputs: pathtoPublish: $(Build.ArtifactStagingDirectory) artifactName: drop displayName: 'Publish build artifacts'
download packages
use connection string defined VSTS variables
powershell: |
$connection = Get-CrmConnection
-ConnectionString
("AuthType = Office365;" +"Username = $env:ServiceAccountUpn;" +
"Password = $env:ServiceAccountPassword;" + ` "Url = https://$env:EnvironmentName.crm.dynamics.com")Import-CrmSolution
-conn $connection
-SolutionFilePath $(Build.ArtifactStagingDirectory)\packedSolution\$($env:SolutionName)_managed.zip env: EnvironmentName: $(environment.name) SolutionName: $(solution.name) ServiceAccountUpn: $(serviceAccount.upn) ServiceAccountPassword: $(serviceAccount.password) displayName: 'Import solution'powershell: | $PackageDirectory = Get-Item $(System.DefaultWorkingDirectory)\tools\PackageDeployment.PowerShell $PackageName = Get-Item $(System.DefaultWorkingDirectory)\Lesson-1\packedSolution\SimpleSurvey.dll Import-CrmPackage
–CrmConnection $CRMConn1
–PackageDirectory $(System.DefaultWorkingDirectory)\tools\PackageDeployment.PowerShell–PackageName $(System.DefaultWorkingDirectory)\Lesson-1\packedSolution\SimpleSurvey.dll -Verbose
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