-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running M365 DSC commands in CI pipeline with firewall blocking access to PowerShell Gallery #5740
Comments
@RosalindHook The required modules with their versions for the current version of Microsoft365DSC can be found here: Modules/Microsoft365DSC/Dependencies/Manifest.psd1. If you install the modules in the system context before running any other commands of the Microsoft365DSC module, you should be fine. |
Thank you @FabienTschanz this is really helpful. I am having a related issue with the dependency PSDesiredStateConfiguration. If I run the command to update all dependencies, everything updates to the versions in the manifest with the exception of PnP.PowerShell. I get this warning: WARNING: The dependency {PSDesiredStateConfiguration} requires PowerShell Core. Please run Update-M365DSCDependencies But I thought the recommendation was to use PowerShell 5.x with DSC? Therefore what should I do about this one dependency requiring a different version? |
If you were to use PowerShell 7, you would need to install that module in the PowerShell 7 shell. If you don't use that, you can safely ignore the message. Current suggestion is, as you wrote, PS 5.1. |
Was about to close this issue but actually I have one more related question. Given that the recommendation is to use PowerShell 5.1, how should I download this for use in a CI pipeline... looking at the Microsoft PowerShell installation instructions, all these versions appear to be 7+ here |
The installation instructions are for the "new" PowerShell, meaning PowerShell 7. If you want to use Microsoft365DSC in a CI pipeline, you need to register a Windows machine with PowerShell 5.1. as your CI/CD pipeline runner and schedule the jobs to be run on that machine. You can find a whitepaper for GitHub on how it's done here: Microsoft365DSC Whitepaper |
Thank you.... |
PnP.PowerShell is another. Manifest statesr 1.12.0 but updating dependencies gives me 2.12.0 |
@RosalindHook The intended way to use Microsoft365DSC is to install the main module in PS 5.1, run
There shouldn't be any discrepancy between what |
Thank you - at the moment I am just trying to use the export capability (which I have succeeded in doing for some workloads locally, but I am now trying to automate and move to a pipeline), so that works for my purposes for the time being. On the discrepancy point, I ran the cmdlet 'Update-M365DSCModule' in Powershell 5. Below is a full list of the modules that installed as a result of this command. Many of these are slightly higher versions than in the manifest here by the looks of things? (e.g. all these Microsoft.Graph modules are version 2.26.1 whereas the manifest states version 2.25.0, ReverseDSC is 2.0.0.27 but the manifest states 2.0.0.22) Installed versions: (and it also uninstalled older versions of the above). I then ran the command 'Update-M365DSCModule' in PS7 and here I got the following messages: WARNING: The dependency {ExchangeOnlineManagement} does not support PowerShell Core. Please run Update-M365DSCDependencies in Windows PowerShell. I have since run Update-M365DSCDependencies in Windows PowerShell but still getting the above messages in PS7 when I run 'Update-M365DSCModule' |
The manifest you are referring to is a little bit older than what was just released yesterday. You'll always find the latest released manifest on the master branch of this repository. Did you restart the PS7 session after installing in PS5.1? I don't receive the messages you mentioned. Don't worry about the warnings, they're just there so that you won't be installing those modules in the PS7 environment. Otherwise, it won't work again if you use e.g. Installing the latest version and uninstalling older modules is part of the |
I am attempting to run Microsoft 365 DSC (M365 DSC) commands within a CI pipeline in GitLab. However, my organization has blocked access to the PowerShell Gallery due to network security policies, and I am unable to set up a proxy to access it.
As a workaround, I downloaded the required DSC modules and pushed them to Artifactory (a remote repository). In the pipeline, I am downloading and unzipping the modules, and then running the following command to import the module:
After successfully importing the module, I attempt to execute the Export-M365DSCConfiguration command using secret credentials. However, I encounter the following error:
When running the script locally, I would typically use the Update-M365DSCDependencies command to ensure all required dependencies are installed and updated, but this is not possible in my current CI pipeline setup due to the lack of PowerShell Gallery access. I understand that M365DSC relies on several other modules for its functionality, which are likely out of date in my current environment.
Questions/Clarifications:
The text was updated successfully, but these errors were encountered: