In my previous post I introduced the Adoxio.Dynamics.DevOps PowerShell module and gave some history and purpose for Adoxio creating it. In this post I’ll cover how to install it and its dependencies so that it can be used to author and run import and export scripts for Dynamics 365 solutions and data.
These installation instructions apply to Dynamics 365 v8.x. Refer to the Adoxio.Dynamics.DevOps README file for newer versions of Dynamics 365.
First, we’ll handle installing the dependencies the module uses but doesn’t install itself. This includes:
- PowerShell 5.0 or above
- Dynamics 365 SDK (Configuration Migration tool, PackageDeployer tool, SolutionPackager tool)
Recent versions of Windows will already have PowerShell installed on them. To check which version is installed, run this command in a PowerShell console or PowerShell ISE window:
If you’re never opened PowerShell before and aren’t sure how to do so, refer to Installing PowerShell for instructions.
If the ‘Major’ version is 5.0 or above, you’re all set and can skip to the next section. If it’s below 5.0 and you’re using Windows 10, installing the most recent operating system update that’s available through Windows Update will upgrade PowerShell. Older desktop and server operating systems should refer to Windows PowerShell System Requirements and install the Windows Management Framework 5.0 version listed beside your operating system version.
Dynamics 365 SDK
The Dynamics 365 SDK can be downloaded from the Microsoft Download Center. There are 2 files shown to choose from when clicking the download button, choose the file MicrosoftDynamics365SDK.exe and save it to your hard drive.
MicrosoftDynamics365SDK.exe is a self-extracting file that when opened prompts to choose where to save the extracted files on the hard drive. The choice is yours where to store the files – my preference is to extract to a folder where it can be stored alongside other versions of the SDK.
At the time of writing, the SDK version was 184.108.40.206. I added the version number shown on the download center page to the end of the folder name extracted to. Microsoft periodically releases new versions of the SDK and it can be helpful to install new ones side-by-side with older versions.
Next, we’ll install the Adoxio.Dynamics.DevOps PowerShell module, which will also install one other PowerShell module dependency, Microsoft.Xrm.Data.PowerShell.
Microsoft.Xrm.Data.PowerShell is an open source project run by some Microsoft employees with contributions by the community, including a few from yours truly.
PowerShell modules are distributed through the PowerShell Gallery run by Microsoft. It is similar to other package managers like nuget and npm, but for PowerShell. To install Adoxio.Dynamics.DevOps, run this PowerShell command:
Install-Module -Name Adoxio.Dynamics.DevOps -Scope CurrentUser
You will likely be prompted when running this command to grant permission to install modules from the PowerShell Gallery. Click yes to do so.
One last thing to check before the installation is finished to ensure the newly installed PowerShell modules can be used without any issue. Older versions of PowerShell and their operating systems have a very restrictive default execution policy for running PowerShell modules. The PowerShell team has since changed newer versions to have a more relaxed setting. To see what your execution policy is, run the command:
If the returned value is not RemoteSigned, it is advisable to change the policy to that value by running this command:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
CRM_SDK_PATH Environment Variable
This is the last step. The Dynamics 365 SDK is installed to a user-specified location, and the module needs to know where the Dynamics 365 SDK has been installed so that it can invoke the SolutionPackager and PackageDeployer tools when importing solutions and data into a Dynamics 365 instance. This is done by creating an environment variable named CRM_SDK_PATH and pointing it to the root folder of the extracted SDK.
The file path to use for this environment variable is the folder that contains the top level folders Bin, Resources, SampleCode, Schemas, Templates, and Tools. Here is an example on my computer where the path is C:\My\CrmSdk365-v220.127.116.11\SDK.
Using this path as an example, run this PowerShell command to create the environment variable:
[Environment]::SetEnvironmentVariable("CRM_SDK_PATH", "C:\My\CrmSdk365-v18.104.22.168\SDK", "User")
We have now finished installing the module and its dependencies. Upcoming blog posts will cover more information about the module’s features and authoring export and import scripts.