Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.26k stars 3.86k forks source link

Serialization error on Select-AzureRmSubscription #8946

Closed axorth closed 5 years ago

axorth commented 5 years ago

After just installing the AzureRM, I am unable to change subscriptions with following error: Select-AzureRmSubscription : Method 'get_SerializationSettings' in type 'Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient' from assembly 'Microsoft.Azure.Commands.ResourceManager.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation. At line:1 char:1

axorth commented 5 years ago

PS C:\Users\adc09> Get-InstalledModule -Name Az -AllVersions | select Name,Version

Name Version


Az 1.6.0

axorth commented 5 years ago

Any relation to having installed Visual Studio 2019?

maddieclayton commented 5 years ago

@axorth Please run Get-Module directly after getting your error so we can see what is currently loaded on your machine. Please also fill out the issue template found here: https://github.com/Azure/azure-powershell/issues/new?assignees=&labels=&template=azurerm-module-bug-report.md&title=, so we can use that information to diagnose your issue.

maddieclayton commented 5 years ago

@axorth Ping on the questions above

axorth commented 5 years ago

Sorry out sick, I will take a look at it when I get back into the office

On Mon, Apr 15, 2019, 1:00 PM Maddie Clayton notifications@github.com wrote:

@axorth https://github.com/axorth Ping on the questions above

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Azure/azure-powershell/issues/8946#issuecomment-483355404, or mute the thread https://github.com/notifications/unsubscribe-auth/AMJVkn4dZ5_QvLoXYIVhPFWcRf5eo1mgks5vhL4ngaJpZM4cdsEf .

markcowl commented 5 years ago

@axorth to reiterate the template, we need the following pieces of information

axorth commented 5 years ago

Modules:

Version    Name                                Repository           Description                                        
-------    ----                                ----------           -----------                                        
1.6.0      Az                                  PSGallery            Microsoft Azure PowerShell - Cmdlets to manage r...
1.4.0      Az.Accounts                         PSGallery            Microsoft Azure PowerShell - Accounts credential...
1.0.1      Az.Aks                              PSGallery            Microsoft Azure PowerShell - Azure managed Kuber...
1.0.2      Az.AnalysisServices                 PSGallery            Microsoft Azure PowerShell - Analysis Services c...
1.0.0      Az.ApiManagement                    PSGallery            Microsoft Azure PowerShell - Api Management serv...
1.0.0      Az.ApplicationInsights              PSGallery            Microsoft Azure PowerShell - Application Insight...
1.2.0      Az.Automation                       PSGallery            Microsoft Azure PowerShell - Automation service ...
1.0.0      Az.Batch                            PSGallery            Microsoft Azure PowerShell - Batch service cmdle...
1.0.0      Az.Billing                          PSGallery            Microsoft Azure PowerShell - Billing service cmd...
1.1.0      Az.Cdn                              PSGallery            Microsoft Azure PowerShell - CDN service cmdlets...
1.0.1      Az.CognitiveServices                PSGallery            Microsoft Azure PowerShell - Cognitive Services ...
1.6.0      Az.Compute                          PSGallery            Microsoft Azure PowerShell - Compute service cmd...
1.0.0      Az.ContainerInstance                PSGallery            Microsoft Azure PowerShell - Container Instance ...
1.0.1      Az.ContainerRegistry                PSGallery            Microsoft Azure PowerShell - Container Registry ...
1.0.2      Az.DataFactory                      PSGallery            Microsoft Azure PowerShell - Data Factory servic...
1.0.0      Az.DataLakeAnalytics                PSGallery            Microsoft Azure PowerShell - Data Lake Analytics...
1.1.0      Az.DataLakeStore                    PSGallery            Microsoft Azure PowerShell - Azure Data Lake Sto...
1.0.0      Az.DevTestLabs                      PSGallery            Microsoft Azure PowerShell - DevTest Labs servic...
1.0.0      Az.Dns                              PSGallery            Microsoft Azure PowerShell - DNS service cmdlets...
1.1.0      Az.EventGrid                        PSGallery            Microsoft Azure PowerShell - Event Grid service ...
1.0.1      Az.EventHub                         PSGallery            Microsoft Azure PowerShell - Event Hubs service ...
1.0.0      Az.HDInsight                        PSGallery            Microsoft Azure PowerShell - HDInsight service c...
1.0.2      Az.IotHub                           PSGallery            Microsoft Azure PowerShell - IoT Hub service cmd...
1.1.0      Az.KeyVault                         PSGallery            Microsoft Azure PowerShell - Key Vault service c...
1.2.1      Az.LogicApp                         PSGallery            Microsoft Azure PowerShell - Logic Apps cmdlets ...
1.0.0      Az.MachineLearning                  PSGallery            Microsoft Azure PowerShell - Machine Learning We...
1.0.0      Az.MarketplaceOrdering              PSGallery            Microsoft Azure PowerShell - Marketplace Orderin...
1.0.0      Az.Media                            PSGallery            Microsoft Azure PowerShell - Media service cmdle...
1.0.1      Az.Monitor                          PSGallery            Microsoft Azure PowerShell - Monitor service cmd...
1.6.0      Az.Network                          PSGallery            Microsoft Azure PowerShell - Networking service ...
1.0.0      Az.NotificationHubs                 PSGallery            Microsoft Azure PowerShell - Notification Hubs c...
1.1.0      Az.OperationalInsights              PSGallery            Microsoft Azure PowerShell - Operational Insight...
1.0.0      Az.PolicyInsights                   PSGallery            Microsoft Azure PowerShell - Azure Policy Insigh...
1.0.0      Az.PowerBIEmbedded                  PSGallery            Microsoft Azure PowerShell - Power BI Embedded s...
1.2.0      Az.RecoveryServices                 PSGallery            Microsoft Azure PowerShell - Recovery Services c...
1.0.0      Az.RedisCache                       PSGallery            Microsoft Azure PowerShell - Redis Cache service...
1.0.0      Az.Relay                            PSGallery            Microsoft Azure PowerShell - Relay service cmdle...
1.2.1      Az.Resources                        PSGallery            Microsoft Azure PowerShell - Azure Resource Mana...
1.0.0      Az.ServiceBus                       PSGallery            Microsoft Azure PowerShell - Service Bus service...
1.0.1      Az.ServiceFabric                    PSGallery            Microsoft Azure PowerShell - Service Fabric cmdl...
1.0.2      Az.SignalR                          PSGallery            Microsoft Azure PowerShell - Azure SignalR servi...
1.7.0      Az.Sql                              PSGallery            Microsoft Azure PowerShell - SQL service cmdlets...
1.1.0      Az.Storage                          PSGallery            Microsoft Azure PowerShell - Storage service dat...
1.0.0      Az.StreamAnalytics                  PSGallery            Microsoft Azure PowerShell - Stream Analytics se...
1.0.1      Az.TrafficManager                   PSGallery            Microsoft Azure PowerShell - Traffic Manager ser...
1.1.2      Az.Websites                         PSGallery            Microsoft Azure PowerShell - App Service (Web Ap...
5.1.2      Azure                               https://www.power... Microsoft Azure PowerShell - Service Management    
0.5.4      Azure.AnalysisServices              PSGallery            Microsoft Azure PowerShell - Analysis Services s...
4.6.1      Azure.Storage                       PSGallery            Microsoft Azure PowerShell - Storage service cmd...
0.6.14     AzureRM.AnalysisServices            PSGallery            Microsoft Azure PowerShell - Analysis Services     
6.1.7      AzureRM.ApiManagement               PSGallery            Microsoft Azure PowerShell - Api Management serv...
0.1.8      AzureRM.ApplicationInsights         PSGallery            Microsoft Azure PowerShell - Application Insight...
6.1.1      AzureRM.Automation                  PSGallery            Microsoft Azure PowerShell - Automation service ...
4.0.11     AzureRM.Backup                      PSGallery            Microsoft Azure PowerShell - Azure Backup servic...
4.1.5      AzureRM.Batch                       PSGallery            Microsoft Azure PowerShell - Batch service cmdle...
0.14.6     AzureRM.Billing                     PSGallery            Microsoft Azure PowerShell - Billing service cmd...
5.0.6      AzureRM.Cdn                         PSGallery            Microsoft Azure PowerShell - CDN service cmdlets...
0.9.12     AzureRM.CognitiveServices           PSGallery            Microsoft Azure PowerShell - Cognitive Services ...
5.9.1      AzureRM.Compute                     PSGallery            Microsoft Azure PowerShell - Compute service cmd...
0.3.7      AzureRM.Consumption                 PSGallery            Microsoft Azure PowerShell - Consumption service...
0.2.12     AzureRM.ContainerInstance           PSGallery            Microsoft Azure PowerShell - Container Instance ...
1.0.10     AzureRM.ContainerRegistry           PSGallery            Microsoft Azure PowerShell - ContainerRegistry s...
5.0.3      AzureRM.DataFactories               PSGallery            Microsoft Azure PowerShell - DataFactories servi...
0.5.11     AzureRM.DataFactoryV2               PSGallery            Microsoft Azure PowerShell - DataFactories servi...
5.1.4      AzureRM.DataLakeAnalytics           PSGallery            Microsoft Azure PowerShell - Data Lake Analytics   
6.2.1      AzureRM.DataLakeStore               PSGallery            Microsoft Azure PowerShell - Data Lake Store       
4.0.9      AzureRM.DevTestLabs                 PSGallery            Microsoft Azure PowerShell - DevTestLabs service...
5.1.0      AzureRM.Dns                         PSGallery            Microsoft Azure PowerShell - Dns service cmdlets...
0.3.7      AzureRM.EventGrid                   PSGallery            Microsoft Azure PowerShell - EventGrid service c...
0.7.0      AzureRM.EventHub                    PSGallery            Microsoft Azure PowerShell - EventHubs service c...
4.1.8      AzureRM.HDInsight                   PSGallery            Microsoft Azure PowerShell - HDInsight service c...
5.1.5      AzureRM.Insights                    PSGallery            Microsoft Azure PowerShell - Insights service cm...
3.1.8      AzureRM.IotHub                      PSGallery            Microsoft Azure PowerShell - IotHub service cmdl...
5.2.1      AzureRM.KeyVault                    PSGallery            Microsoft Azure PowerShell - KeyVault service cm...
4.1.4      AzureRM.LogicApp                    PSGallery            Microsoft Azure PowerShell - LogicApp cmdlets fo...
0.18.5     AzureRM.MachineLearning             PSGallery            Microsoft Azure PowerShell - Machine Learning We...
0.4.8      AzureRM.MachineLearningCompute      PSGallery            Microsoft Azure PowerShell - Machine Learning Co...
0.2.7      AzureRM.MarketplaceOrdering         PSGallery            Microsoft Azure PowerShell - MarketplaceOrdering...
0.10.4     AzureRM.Media                       PSGallery            Microsoft Azure PowerShell - Media service cmdle...
6.11.1     AzureRM.Network                     PSGallery            Microsoft Azure PowerShell - Network service cmd...
5.0.3      AzureRM.NotificationHubs            PSGallery            Microsoft Azure PowerShell - NotificationHubs      
5.0.6      AzureRM.OperationalInsights         PSGallery            Microsoft Azure PowerShell - OperationalInsights...
1.1.0      AzureRM.PolicyInsights              PSGallery            Microsoft Azure PowerShell - Azure Policy Insigh...
4.1.10     AzureRM.PowerBIEmbedded             PSGallery            Microsoft Azure PowerShell - Power BI Embedded s...
4.6.0      AzureRM.Profile                     https://www.power... Microsoft Azure PowerShell - Profile credential ...
5.8.2      AzureRM.profile                     PSGallery            Microsoft Azure PowerShell - Profile credential ...
4.1.9      AzureRM.RecoveryServices            PSGallery            Microsoft Azure PowerShell - RecoveryServices cm...
4.5.2      AzureRM.RecoveryServices.Backup     PSGallery            Microsoft Azure PowerShell - Azure Backup servic...
0.2.12     AzureRM.RecoveryServices.SiteRec... PSGallery            Microsoft Azure PowerShell - SiteRecovery servic...
5.1.0      AzureRM.RedisCache                  PSGallery            Microsoft Azure PowerShell - RedisCache service ...
0.3.12     AzureRM.Relay                       PSGallery            Microsoft Azure PowerShell - Relay service cmdle...
6.7.3      AzureRM.Resources                   PSGallery            Microsoft Azure PowerShell - Azure Resource Mana...
0.16.10    AzureRM.Scheduler                   PSGallery            Microsoft Azure PowerShell - Scheduler cmdlets f...
4.1.2      AzureRM.ServerManagement            https://www.power... Microsoft Azure PowerShell - ServerManagement cm...
0.6.13     AzureRM.ServiceBus                  PSGallery            Microsoft Azure PowerShell - ServiceBus service ...
0.3.15     AzureRM.ServiceFabric               PSGallery            Microsoft Azure PowerShell - Service Fabric cmdl...
1.0.0      AzureRM.SignalR                     PSGallery            Microsoft Azure PowerShell - Azure SignalR servi...
5.0.6      AzureRM.SiteRecovery                https://www.power... Microsoft Azure PowerShell - SiteRecovery servic...
4.12.1     AzureRM.Sql                         PSGallery            Microsoft Azure PowerShell - Sql service cmdlets...
5.2.0      AzureRM.Storage                     PSGallery            Microsoft Azure PowerShell - Storage service man...
4.0.10     AzureRM.StreamAnalytics             PSGallery            Microsoft Azure PowerShell - StreamAnalytics ser...
4.0.5      AzureRM.Tags                        PSGallery            Microsoft Azure PowerShell - Tags service cmdlet...
4.1.3      AzureRM.TrafficManager              PSGallery            Microsoft Azure PowerShell - TrafficManager serv...
4.0.5      AzureRM.UsageAggregates             PSGallery            Microsoft Azure PowerShell - UsageAggregates ser...
5.2.0      AzureRM.Websites                    PSGallery            Microsoft Azure PowerShell - Websites service cm...
2.0.2      Posh-SSH                            PSGallery            Provide SSH and SCP functionality for executing ...
axorth commented 5 years ago

Version:

Name                           Value                                                                                   
----                           -----                                                                                   
PSVersion                      5.1.17134.590                                                                           
PSEdition                      Desktop                                                                                 
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                 
BuildVersion                   10.0.17134.590                                                                          
CLRVersion                     4.0.30319.42000                                                                         
WSManStackVersion              3.0                                                                                     
PSRemotingProtocolVersion      2.3                                                                                     
SerializationVersion           1.1.0.1       
axorth commented 5 years ago

Error:

   HistoryId: 7

Message        : Method 'get_SerializationSettings' in type 
                 'Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient' from assembly 
                 'Microsoft.Azure.Commands.ResourceManager.Common, Version=4.0.0.0, Culture=neutral, 
                 PublicKeyToken=31bf3856ad364e35' does not have an implementation.
StackTrace     :    at Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet.BeginProcessing()
                    at System.Management.Automation.Cmdlet.DoBeginProcessing()
                    at System.Management.Automation.CommandProcessorBase.DoBegin()
Exception      : System.TypeLoadException
InvocationInfo : {Set-AzureRmContext}
Line           : Select-AzureRmSubscription "7c765d0b-c100-441e-97fd-17c2f45e70ce"
Position       : At line:1 char:1
                 + Select-AzureRmSubscription "7c765d0b-c100-441e-97fd-17c2f45e70ce"
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 7

   HistoryId: -1

Message        : Unable to find type [Microsoft.PowerShell.Commands.PowerShellGet.Telemetry].
StackTrace     :    at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext 
                 funcContext, Exception exception)
                    at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame 
                 frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame 
                 frame)
Exception      : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line           :     $telemetryMethods = ([Microsoft.PowerShell.Commands.PowerShellGet.Telemetry] | Get-Member 
                 -Static).Name

Position       : At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:715 char:26
                 + ... yMethods = ([Microsoft.PowerShell.Commands.PowerShellGet.Telemetry] | ...
                 +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : -1

   HistoryId: 2

Message        : Method 'get_SerializationSettings' in type 
                 'Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient' from assembly 
                 'Microsoft.Azure.Commands.ResourceManager.Common, Version=4.0.0.0, Culture=neutral, 
                 PublicKeyToken=31bf3856ad364e35' does not have an implementation.
StackTrace     :    at Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet.BeginProcessing()
                    at System.Management.Automation.Cmdlet.DoBeginProcessing()
                    at System.Management.Automation.CommandProcessorBase.DoBegin()
Exception      : System.TypeLoadException
InvocationInfo : {Set-AzureRmContext}
Line           : Select-AzureRmSubscription "7c765d0b-c100-441e-97fd-17c2f45e70ce"
Position       : At line:1 char:1
                 + Select-AzureRmSubscription "7c765d0b-c100-441e-97fd-17c2f45e70ce"
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 2
axorth commented 5 years ago

I am also getting the following error when trying to publish an Azure Function from VS2019

4/24/2019 9:40:44 AM
System.AggregateException: One or more errors occurred. ---> System.Exception: Publishing failed.
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Microsoft.Publish.Framework.Model.DefaultPublishSteps.<>c__DisplayClass26_0.<IsBuildCompletedSuccessfully>b__2()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Publish.Framework.Model.DefaultPublishSteps.<DefaultCorePublishStep>d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Publish.Framework.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__183.MoveNext()
---> (Inner Exception #0) System.Exception: Publishing failed.<---

===================

Not sure if this is related or not. Perhaps the installation of the latest version of Visual Studio corrupted everything.

markcowl commented 5 years ago

@axorth The issue is most likely that you have Az and AzureRM modules installed side-by-side, and that the AzureRM module is loaded when you are tryign to use Az.

I would have to see the VS deployment scripts you are using, but most likely, you cna fix this by removing AzureRM and then turning on the AzureRM aliases in Az:

Enable-AzureRmAlias -Scope CurrentUser
markcowl commented 5 years ago

@axorth Does this advice work for you?

axorth commented 5 years ago

Yes, thank you. You can close this issue.

On Mon, May 6, 2019, 11:56 AM Mark Cowlishaw notifications@github.com wrote:

@axorth https://github.com/axorth Does this advice work for you?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Azure/azure-powershell/issues/8946#issuecomment-489733466, or mute the thread https://github.com/notifications/unsubscribe-auth/ADBFLES6FT27GWFRCL6JZXLPUB5PRANCNFSM4HDWYEPQ .

LunatikDev commented 4 years ago

Awesome, this fixed my issue.

I disapprove that Microsoft change the name of commands (or anything like name of products) just because they put on new socks that morning and they feel like:

-Eh! Why not change the name of that command or thing that everyone use and love so they get new problems with their scripts/program along the road?

-Common sense (from normal people): Don't touch that, it work's perfectly 👌 -Common sense (from Microsoft): Lets do that for ALL our products !!! 🤦‍♂️

🤣🤣🤣