Skip to content
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

Azure Automation errors #361

Open
oliphanj-bsd opened this issue Jul 17, 2024 · 4 comments
Open

Azure Automation errors #361

oliphanj-bsd opened this issue Jul 17, 2024 · 4 comments

Comments

@oliphanj-bsd
Copy link

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?"

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.

Invoke-MgGraphRequest: C:\usr\src\PSModules\Maester\public\Send-MtMail.ps1:150 Line | 150 | Invoke-MgGraphRequest -Method POST -Uri $sendMailUri -Body $mailR …

@janegilring
Copy link

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).

@checkso
Copy link

checkso commented Sep 3, 2024

It should be fixed if you add the following packages to the Runtime Environment:

  • Nuget
  • PackageManagement

@magnusjak
Copy link

magnusjak commented Sep 13, 2024

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

@BurgerhoutJ
Copy link
Contributor

Created a pull request to add this to the documentation #479

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants