-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Connect-AzAccount : Method 'get_SerializationSettings' in type #22903
Comments
Thanks for reporting! I cannot reproduce this issue. |
Yes, I did it. Get-Module Az* -ListAvailable: empty. Reinstall modules. Same issue. |
Could you run the function defined here to get a list of Newtonsoft.Json dlls imported in the PS session? https://gist.github.com/isra-fel/f3b94f56775df8ba56aa3c0444f484c6 You need to copy-paste the definition of the function then run it like this: |
Hello,
Thank you for this answer.
The function returns the results below:
FullName : Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
Location : C:\windows\Microsoft.Net\assembly\GAC_MSIL\Newtonsoft.Json\v4.0_10.0.0.0__30ad4fe6b2a6aeed\Newtonsoft.Json.dll
FullName : Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
Location : C:\windows\Microsoft.Net\assembly\GAC_MSIL\Newtonsoft.Json\v4.0_13.0.0.0__30ad4fe6b2a6aeed\Newtonsoft.Json.dll
FullName : System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
Location : C:\Program Files\WindowsPowerShell\Modules\az.accounts\2.13.1\lib\netstandard2.0\System.Text.Json.dll
I do not know how to manage this.
Thank you.
De : Yeming Liu ***@***.***>
Envoyé : jeudi 2 novembre 2023 10:47
À : Azure/azure-powershell ***@***.***>
Cc : GUILAIN Frank ***@***.***>; Author ***@***.***>
Objet : Re: [Azure/azure-powershell] Connect-AzAccount : Method 'get_SerializationSettings' in type (Issue #22903)
Attention, message externe. Soyez vigilant avant d'ouvrir les pieces jointes ou de cliquer sur un lien (en cas de doute cliquez sur le bouton "Alerte Phishing").
Could you run the function defined here to get a list of Newtonsoft.Json dlls imported in the PS session? https://gist.github.com/isra-fel/f3b94f56775df8ba56aa3c0444f484c6
You need to copy-paste the definition of the function then run it like this: asm json.
The result may help us locate the older version of Newtonsoft.JSON.
—
Reply to this email directly, view it on GitHub<#22903 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIX7D4OX2UUAZVGZYJUHR33YCNT23AVCNFSM6AAAAAA5UABNM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJQGM4TMNJTG4>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
I'm having the same issue when using PowerShell from VS Code. `
` I ran the am function in VSC PowerShell and I get : ` FullName : Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed FullName : OmniSharp.Extensions.JsonRpc, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022 FullName : System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 when I run it in ISE PowerShell I get FullName : System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 Any suggests to resolve this ? |
Also affected by this, VSCode not working with the same error but Powershell ISE ok
VSCode
Powershell
Module Imports
|
Are there any plans to ever fix this or is PowerShell not a supported tool for Azure anymore? |
Same issue as here: #21960 -- a conflict on the assembly NewtonSoft.Json due to modules loading 2 different versions and Windows PowerShell (aka 5.1 and older) do not know what to do when there are multiple versions of the same assembly loaded, causing this error. I posted a work-around and script to implement it in that same thread here: #21960 (comment) I have been leveraging this solution in 2 production automation platforms that use PowerShell in sandboxed processes (1 being AzureAutomation w/ HybridWorkers) without issue for nearly 6 months now. The only quirk is some modules have to be imported in a specific order to be happy if more than 1 is used in your script: 1) Az.* 2) Graph.* 3) ExchangeOnline I have only had to re-apply the bindingRedirect once when the app was updated and it was overwritten |
Description
Hello,
I'm on a windows 2026 server.
I installed the az.storage 5.10.0 module (which installs the az.accounts module 2.13.1).
The command "connect-azaccount" fails with the error "Method 'get_SerializationSettings' in type..".
Articles say that I should use the older version of az.accounts 2.12.1. I uninstalled the 2.13.1? install the 2.12.1. It's OK :-).
But later in my script I need the command "get-AZStorageaccount..". It's not OK:
import-module az.storage gives the error
"C:\Program Files\WindowsPowerShell\Modules\Az.Storage\5.10.1\Az.Storage.psm1 : This module requires Az.Accounts
version 2.13.1. An earlier version of Az.Accounts is imported in the current PowerShell session"
OK, I tried to
remove-module az.accounts -Force
Install-Module -Name Az.Accounts # it's ok, installing the 2.13.1 module sid by side with 2.12.1
import-module az.storage
-->
Import-Module : Could not load type
'Microsoft.WindowsAzure.Commands.Common.CustomAttributes.GenericBreakingChangeWithVersionAttribute' from assembly
'Microsoft.Azure.PowerShell.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
At C:\Program Files\WindowsPowerShell\Modules\az.storage\5.10.1\Az.Storage.psm1:99 char:1
On an other wn2016 server, with the same .Net framework version installed (the highest possible one is 4.8 on this OS), and the same powershell modules az.storage 5.10.0 module (which installs the az.accounts module 2.13.1), all my commands are OK.
I do not understand.
Any other idea ?
Thank you.
Script or Debug output
No response
Environment data
Module versions
Error output
The text was updated successfully, but these errors were encountered: