How can I fix the error: "Add-AzureAccount: Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'."?

MikeOtown 26 Reputation points
2023-10-19T15:25:42.83+00:00

I am trying to follow this article:

Migrate an Azure Virtual Network from classic to Resource Manager using Azure PowerShell

https://aka.ms/AAflak0

I'm able to get to "Retrieve the virtual network name to be migrated".

When I execute Add-AzureAccount, I get this error message:

PowerShell 7.3.8 PS C:\Users\micha> Add-AzureAccount WARNING: Because the Az modules have all the capabilities of AzureRM modules and more, we will retire the AzureRM modules on 29 February 2024. Learn more about the migration to Az: http://aka.ms/azpsmigrate. Add-AzureAccount: Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,497 questions
{count} vote

1 answer

Sort by: Most helpful
  1. JimmySalian-2011 42,146 Reputation points
    2023-10-19T17:38:42.7966667+00:00

    Hi,

    There is incompatibility issue here and you will need to run via the GraphAPI, known issue and check this article for this similar issue https://www.cloudpartner.fi/?p=10494

    Hope this helps.

    JS

    ==

    Please Accept the answer if the information helped you. This will help us and others in the community as well.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.