Converting Chocolatey Packages to Intune Packages

Converting Chocolatey Packages to Intune Packages

:choco-info: NOTE

The Chocolatey Intune integration shipped as part of v3.0.0 of the Chocolatey Licensed Extension.

:choco-info: NOTE

The Chocolatey Intune integration requires a valid Chocolatey for Business or Chocolatey for Business Trial license.

Summary

Converting from Chocolatey packages to Intune packages that can be later pushed using choco push has been added to a new command called convert. This command allows the file path of a single package to be passed and Chocolatey will then convert it, and its dependencies, to Chocolatey Intune packages.

Usage

Prerequisites

Ensure that the Chocolatey package you want to convert, and it's depedencies, are present in the current directory before running the convert command. You can do this with choco download <PACKAGE NAME> --internalize.

Command Line

choco convert <path to chocolatey pkg> [<options/switches>]

Provide the path to the Chocolatey package file (.nupkg) you want to convert to a Chocolatey Intune package.

Context Menu

For convenience, a new context menu entry Convert Chocolatey Package has been added when you right-click a file with the extension of .nupkg.

Dependency Resolving

When Chocolatey looks to resolve dependencies, it will look in the folder that the package being converted is in (e.g. Chocolatey will look in c:\packages if you run choco convert c:\packages\mypackage.1.0.0.nupkg). It will find and convert the highest version found that satisfies the version criteria specified in the converted package .nuspec metadata file.

:choco-warning: WARNING

If a child package is found in the dependency chain, that has a more restrictive dependency version criteria than the Chocolatey package you want to convert, then this more restrictive version criteria will be used when the Chocolatey Intune package is created.

Examples

To start converting Chocolatey packages to the Chocolatey Intune package format, you first need to download the packages. The location can be your own internal repository, or any other valid Chocolatey source. You can also use the Chocolatey Community Repository but be aware of organizational use recommendations and limitations. As an example, to download version 86.0 of the firefox Chocolatey package and convert it to a Chocolatey Intune package along with its dependencies:

choco download firefox --version 86.0 --internalize
choco convert firefox.86.0.nupkg --to-format=intune

If you do not want to convert the dependencies of the firefox Chocolatey package, you can run the following:

choco download firefox --version 86.0 --internalize --ignore-dependencies
choco convert firefox.86.0.nupkg --to-format=intune --ignore-dependencies

:choco-warning: WARNING

By specifying the path to a pre-release package, pre-release support will be enabled for the package and its dependencies. However, while the package you are converting can be a pre-release, you cannot have a dependency on a pre-release package if the Chocolatey package you are converting is a stable release. This is the same behaviour as the push command.

:choco-info: NOTE

If the Chocolatey product packages do not exist in the same directory as the Chocolatey package you are converting, a warning about chocolatey and chocolatey.extension being 'missing' will be shown. This warning can be safely ignored if these two packages are already available in your Intune tenant. If these are not available in your Intune tenant, you may use one of these download commands, depending on your license:

  • If you are using an Architect license, run choco download chocolatey chocolatey.extension chocolateygui --ignore-dependencies
  • If you are using a Business license, run choco download chocolatey chocolatey.extension chocolateygui chocolateygui.extension chocolatey-agent --ignore-dependencies

FAQ

See the frequently asked questions about the convert command.