Open oliphanj-bsd opened 1 month ago
I hit the same issue and found that it is related to what PowerShell runtime version is used for the runbook.
The issue is present when using PowerShell 7.2, but not in 5.1.
I think this could be resolved by using Find-PSResource instead of Find-Module to avoid having to install the Nuget provider on the sandbox workers in Azure Automation.
The PSResourceGet module would need to be added as a prerequisite for this to work (it will be included by default in PowerShell 7.4, but as of now Azure Automation supports 7.2).
It should be fixed if you add the following packages to the Runtime Environment:
Also managed to get everything to work after installing both NuGet and PackageManagement as modules in the Azure Automation Account. So this should at least be added to the documentation. Another thing I am wondering is how we add/save custom-tests to Azure Automation. Do we have to fetch these from somewhere every run?
One solution for this is using a HybridVM to run the Azure Automation with saved custom-tests. But it would be nice to have a good way of doing this out of the box
I followed the instructions for configuring Maester in Azure Automation and these are the 3 errors I got. 1. MethodInvocationException: Exception calling "ShouldContinue" with "2" argument(s): "A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or 'C:\Users\ContainerUser\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and import the NuGet provider now?"
2. Find-Module: C:\usr\src\PSModules\Maester\internal\ConvertTo-MtMaesterResults.ps1:44 Line | 44 | $latestVersion = (Find-Module -Name Maester).Version |
~~~~~| NuGet provider is required to interact with NuGet-based repositories. Please ensure that '2.8.5.201' or newer version of NuGet provider is installed.3. Invoke-MgGraphRequest: C:\usr\src\PSModules\Maester\public\Send-MtMail.ps1:150 Line | 150 | Invoke-MgGraphRequest -Method POST -Uri $sendMailUri -Body $mailR …