Open ricohomewood opened 1 year ago
The PSDscResources WindowsFeature resource does not work as a guest configuration on any version of Windows, server or not, because it needs the ServerManager module. The built-in Windows PowerShell module ServerManager is .Net based. When you run normal PS7 it can make use of this module and its commands through its compatibility features. However, a guest configuration task runs in an isolated instance of PS7 that can't touch these modules (at least I haven't found a way). Nobody has migrated ServerManager to be .Net Core based so it can work natively in PS7, or least I haven't seen yet.
Edit: A solution.
MS gives the answer on how to mitigate this issue, by modifying the PowerShell Core PSModulePath at runtime to allow PS Core to see the Windows modules.
Details of the scenario you tried and the problem that is occurring
When using the new Guest Configuration feature in Azure Guest Configuration to apply DSC config via Azure Policy. I am getting an error when trying to configure a Windows Feature on Windows Server 2022 Azure Edition Core see below
That may not be related to the fact i'm using Guest Configuration but note GuestConfiguration uses Powershell 7.
The VM SKU is:
Verbose logs showing the problem
Suggested solution to the issue
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
Version and build of PowerShell the target node is running
PS Version (bundled with Guest Configuration)
Version of the DSC module that was used ('dev' if using current dev branch)
2.12.0.0
PSDscResources