Module gives error when creating New-PSDrive
When trying to create a new PSDrive I get an error:
New-PSDrive : The following error occurred while loading the extended type data file: Error in TypeData
...
InvalidOperation: (:) [New-PSDrive], RuntimeException
Both depended modules are up to date:
ModuleType Version Name
---------- ------- ----
Script 5.6.0 AzureRM.Profile
Script 6.9.0 AzureRM
Any ideas how to solve this?
@bjtukker The dependencies for AzurePSDrive are the Az modules (not AzureRM). https://github.com/PowerShell/AzurePSDrive/blob/9e2ba713ea7236a1fb7e1b51c19827f0ec899c75/AzurePSDrive.psd1#L50
- What version of AzurePSDrive & Az is installed on the machine?
Get-Module -Name AzurePSDrive -ListAvailable
Get-Module -Name Az -ListAvailable
Get-Module -Name AzurePSDrive -ListAvailable|Select Version, Name
Get-Module -Name @('Az.Profile', 'Az.Resources', 'Az.Compute', 'Az.Storage','SHiPS') -ListAvailable|Select Version, Name
Version Name
------- ----
0.9.2 AzurePSDrive
0.4.0 Az.Compute
0.4.0 Az.Profile
0.4.0 Az.Resources
0.4.0 Az.Storage
0.8.1 SHiPS
The Az modules I was missing, but I still get errors:
New-PSDrive -Name Az -PSProvider SHiPS -root 'AzurePSDrive#Azure'
New-PSDrive : Cannot find a provider with the name 'SHiPS'.
At line:1 char:1
+ New-PSDrive -Name Az -PSProvider SHiPS -root 'AzurePSDrive'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (SHiPS:String) [New-PSDrive], ProviderNotFoundException
+ FullyQualifiedErrorId : ProviderNotFound,Microsoft.PowerShell.Commands.NewPSDriveCommand
When trying to do a new import of the module AzurePSDrive I also receive an error:
Import-Module AzurePSDrive -Verbose -Force
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\AzurePSDrive\0.9.2\AzurePSDrive.psd1'.
Import-Module : The following error occurred while loading the extended type data file: Error in TypeData
"Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContextContainer": The TypeConverter was ignored because it already occurs.
Error in TypeData "Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContextContainer": The member SerializationDepth is already present.
Error in TypeData "Microsoft.Azure.Commands.Common.Authentication.ProtectedFileTokenCache": The member PropertySerializationSet is already present.
Error in TypeData "Microsoft.Azure.Commands.Common.Authentication.ProtectedFileTokenCache": The member SerializationMethod is already present.
Error in TypeData "Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache": The member PropertySerializationSet is already present.
Error in TypeData "Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache": The member SerializationMethod is already present.
Error in TypeData "Microsoft.Azure.Commands.Profile.Models.PSAzureContext": The member SerializationDepth is already present.
Error in TypeData "Microsoft.Azure.Commands.Profile.Models.PSAzureProfile": The member SerializationDepth is already present.
At line:1 char:1
+ Import-Module AzurePSDrive -Verbose -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Import-Module], RuntimeException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
@markcowl This looks like the case when both AzureRM and Az modules are loaded in the same session.
@bjtukker Workaround is to ensure AzureRM modules are either removed from the system / not loaded in the session