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

On Azure Automation, Import-Module -Name Az.Resources is on error #21680

Closed
sebfantini opened this issue May 1, 2023 · 3 comments
Closed

On Azure Automation, Import-Module -Name Az.Resources is on error #21680

sebfantini opened this issue May 1, 2023 · 3 comments
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported

Comments

@sebfantini
Copy link

Description

Step 1 : I create a new Azure Automation
Step 2 : I create a simple Runbook on Azure Automation with this script :
import-Module -Name Az.Resources
import-Module -Name Az.Websites

Execution Result
When this Runbook run, the import instructions are on error.
1/
Register-AzModule : The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception. At C:\Modules\Global\Az.Resources\MSGraph.Autorest\Az.MSGraph.psm1:49 char:13 + $VTable = Register-AzModule + ~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Register-AzModule], TypeInitializationException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Common.RegisterAzModule

2/
Register-AzModule : The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception. At C:\Modules\Global\Az.Resources\Authorization.Autorest\Az.Authorization.psm1:49 char:13 + $VTable = Register-AzModule + ~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Register-AzModule], TypeInitializationException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Common.RegisterAzModule

3/
Register-AzModule : The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception. At C:\Modules\Global\Az.Websites\Websites.Autorest\Az.Websites.psm1:49 char:13 + $VTable = Register-AzModule + ~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Register-AzModule], TypeInitializationException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Common.RegisterAzModule

The module version are :
Az.Resources : 6.0.0
Az.WebSites : 2.11.2

Finally, we noticed that it was impossible to update these modules with a higher or lower version.

Issue script & Debug output

import-Module -Name Az.Resources
import-Module -Name Az.Websites

Environment data

Azure.Automation

Module versions

Az.Resources : 6.0.0
Az.WebSites : 2.11.2

Error output

**1/**
Register-AzModule : The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception. At C:\Modules\Global\Az.Resources\MSGraph.Autorest\Az.MSGraph.psm1:49 char:13 + $VTable = Register-AzModule + ~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Register-AzModule], TypeInitializationException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Common.RegisterAzModule

**2/** 
Register-AzModule : The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception. At C:\Modules\Global\Az.Resources\Authorization.Autorest\Az.Authorization.psm1:49 char:13 + $VTable = Register-AzModule + ~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Register-AzModule], TypeInitializationException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Common.RegisterAzModule

**3/**
Register-AzModule : The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception. At C:\Modules\Global\Az.Websites\Websites.Autorest\Az.Websites.psm1:49 char:13 + $VTable = Register-AzModule + ~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Register-AzModule], TypeInitializationException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Common.RegisterAzModule
@sebfantini sebfantini added bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels May 1, 2023
@ghost ghost added customer-reported and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels May 1, 2023
@Steeve13011
Copy link

I have exactly the same problem. On another Azure Automation resource with the same module versions, I don't have a crash.

@mortenlerudjordet
Copy link

The new version of the Az-module broke something running on 5.1 (as AA does).
Will need to downgrade all modules having a dependency on new Az.Accounts, and also downgrade Accounts.

More here:
#21647

@isra-fel
Copy link
Member

isra-fel commented May 3, 2023

Thanks for reporting. This issue is duplicated with #21647 . I'll close it and please track that one. Thanks.

@isra-fel isra-fel closed this as completed May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported
Projects
None yet
Development

No branches or pull requests

4 participants