Azure / Azure/azure-powershell

[Feature]: Include module path in Publish-AzVMDscConfiguration DSC archive

Open
#28,153 2 comments 0 reactions 0 assignees View on GitHub
Compute - Managed Disks customer-reported feature-request Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description of the new feature

When running the `Publish-AzVMDscConfiguration` cmdlet without the `-SkipDependencyDetection` parameter, the cmdlet creates an archive that contains the DSC configuration and any resource modules that it imports.

When the archive is created, the required modules are copied from their module path to a temporary directory. Although the source module includes the module's version in its path, the copy of the module in the temporary directory does not.

Later, when the Azure VM DSC extension attempts to bootstrap the required modules from the archive, it extracts them to `$env:ProgramFiles\WindowsPowerShell\Modules`. Because the module's path in the archive does not include a module version, the DSC extension completely replaces the required module's directory and subdirectories with the contents of the required module's directory from the DSC configuration archive. Any versions of the module that may already exist in the destination directory will be completely removed.

For example, if you import PackageManagement v1.0.0.1 (a built-in cmdlet included with Windows PowerShell 5.1) in your DSC configuration and then create the configuration archive with `Publish-AzVMDscConfiguration`, it will remove the pre-installed PackageManagement v1.0.0.1 directory (`$env:ProgramFiles\WindowsPowerShell\Modules\PackageManagement\1.0.0.1`) and place the contents of the version included in the archive at `$env:ProgramFiles\WindowsPowerShell\Modules\PackageManagement` (note: no version).

### Proposed implementation details (optional)

Update the logic of the `Publish-AzVMDscConfiguration` cmdlet to copy the local module to a temporary directory **that includes the module's version** when the `-SkipDependencyDetection` parameter is not passed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.