Description
Edit 2025-02-23:
- PowerShell v7.4 is available inside Automation Account -> Runbook Environments, even though it's not announced yet.
Edit 2024-01-03:
- PowerShell 7.2 is GA in Automation Account and works great with the newest Az modules.
- If still using 5.1: See temp workaround if you are affected.
Description
Tried three times to import Az.Resources
v6.6.1 to an Azure Automation Account, but it fails.
I imported/updated Az.Accounts
to v2.12.2 prior to this.
This is using the built in "Browse gallery" method.
Issue script & Debug output
None.
Environment data
5.1 in Azure Automation Account
Module versions
Az.Accounts v2.12.2
Az.Resources v6.6.1
Error output
Error importing the module Az.Resources. Import failed with the following error: Orchestrator.Shared.AsyncModuleImport.ModuleImportException: An error occurred when trying to import the module to an internal PowerShell session. Either the module dependencies are not imported correctly or the module is unsupported. Internal Error Message: The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception. The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception. . at Orchestrator.Activities.SetModuleVersion.GetPsModuleVersion(String moduleName, String moduleFullPath, Guid accountId, Guid moduleVersionId, InitialSessionState defaultSessionState) at Orchestrator.Activities.SetModuleVersion.InsertModuleVersion(String moduleName, ModuleLanguage moduleLanguage, String pythonModuleVersion, String moduleFullyQualifiedName, ActivitiesMetadataWorkflowExtension activitiesMetadataWorkflowExtension, Guid accountId, Guid moduleVersionId, Int64 moduleContentByteSize, ContentUriInfo contentUri, String storageUri, Int32 moduleVersion) at Orchestrator.Activities.SetModuleVersion.ExecuteInternal(CodeActivityContext context, String moduleName, ModuleLanguage moduleLanguage, String pythonModuleVersion, String modulePath, Guid accountId, Guid moduleVersionId, Int64 moduleContentByteSize, String storageUri, Int32 moduleVersion) at Orchestrator.Activities.SetModuleVersion.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)