PowerShell in Azure Function App: Microsoft.CrmSdk.CoreTools

The Microsoft.CrmSdk.CoreTools package is a collection of essential utilities for working with Microsoft Dataverse and Power Platform solutions. These tools are designed to help developers and administrators automate common tasks such as solution management, schema handling, and deployment processes.

One of the most powerful utilities included in this package is the Solution Packager, which allows you to unpack a solution ZIP into individual files for editing and then repack it for deployment. This capability is invaluable when you need to customize components like Power Automate flows or forms as part of an automated pipeline.

In this post, we’ll focus on how to install and use Solution Packager in an Azure Function App, so you can integrate it into your serverless workflows for Power Platform automation.

How to install the Microsoft crmsdk coretools

How to use the Solution Packager

  • Set up the following variables.
  • $toolPath → Path to the Solution Packager executable.
  • $inputZip → The original solution ZIP you want to unpack.
  • $outputFolder → Where the unpacked files will be stored.
  • $outputSolutionZip → The new ZIP after repacking.
$toolPath = "c:/home/site/wwwroot/microsoft.crmsdk.coretools.9.1.0.179/content/bin/coretools/SolutionPackager.exe"
$inputZip = "c:/home/site/wwwroot/MySolution.zip"
$outputFolder = "c:/home/site/wwwroot/UnpackedSolution"
$outputSolutionZip = "c:/home/site/wwwroot/PackedSolution/PackedSolution.zip"
  • Invoke Solution Packager using & followed by the action type:
  • For unpacking use /action:Extract.
  • For repacking use /action:Pack.
& $toolPath /action:Extract /zipfile:$inputZip /folder:$outputFolder
& $toolPath /action:Pack /zipfile:$outputSolutionZip /folder:$outputFolder
  • Here’s the complete PowerShell snippet for unpacking and repacking a solution:
# Define paths
$toolPath = "c:/home/site/wwwroot/microsoft.crmsdk.coretools.9.1.0.179/content/bin/coretools/SolutionPackager.exe"
$inputZip = "c:/home/site/wwwroot/MySolution.zip"
$outputFolder = "c:/home/site/wwwroot/UnpackedSolution"
$outputSolutionZip = "c:/home/site/wwwroot/PackedSolution/PackedSolution.zip"

# Unpack the solution
& $toolPath /action:Extract /zipfile:$inputZip /folder:$outputFolder

# Make your changes to the unpacked solution

# Repack the solution
& $toolPath /action:Pack /zipfile:$outputSolutionZip /folder:$outputFolder

Leave a Reply

Your email address will not be published. Required fields are marked *