Open Agazoth opened 3 years ago
I guess this is the reason: Version 2.1.0 [Breaking Change] Removed Get-AzProfile and Select-AzProfile Replaced Azure Directory Authentication Library with Microsoft Authentication Library(MSAL)
Update Az module, then try to load PartnerCenter before Az.accounts I'm running latest Az PS at all times and haven't had the issue since.
I had the same issue which got fixed, and I've been running this at the start of my profile.ps1:
#
Write-Output "Begin profile.ps1"
Write-Output "Importing PartnerCenter"
Import-module PartnerCenter 4>$null
Write-Output "Importing az.accounts"
Import-module Az.Accounts -ErrorAction Stop
PowerShell 7.1.2
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
Type 'help' to get help.
PS C:\Users\cblack> Import-module PartnerCenter 4>$null
PS C:\Users\cblack>
PS C:\Users\cblack> Write-Output "Importing az.accounts"
Importing az.accounts
PS C:\Users\cblack> Import-module Az.Accounts -ErrorAction Stop
PS C:\Users\cblack> Get-Module
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.2.5 Az.Accounts {Add-AzEnvironment, Clear-AzContext, Clear-AzDefa…
Manifest 7.0.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-Item, Clear-It…
Manifest 7.0.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Ob…
Script 3.0.6 PartnerCenter {Add-PartnerCustomerCartLineItem, Add-PartnerCust…
Script 2.1.0 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, …
PS C:\Users\cblack> Connect-AzAccount
WARNING: INITIALIZATION: Fallback context save mode to process because of error during checking token cache persistence: Could not load file or assembly 'Microsoft.Identity.Client.Extensions.Msal, Version=2.16.2.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'. The system cannot find the file specified..
WARNING: Unable to acquire token for tenant 'organizations'
Connect-AzAccount: Could not load file or assembly 'Microsoft.Identity.Client, Version=4.21.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'. The system cannot find the file specified.
Hello, I'm running into this same issue. PS 7.2 PartnerCenter 3.0.10 Az.Accounts 2.6.2
Is the only workaround to downgrade az.accounts?
Update: I installed az.accounts 1.9.5 side-by-side with az.accounts 2.6.2 and I installed az.compute 4.5.0 side-by-side with az.compute 4.17.0 and by importing those explicit, older az modules I was able to get my stuff working.
I'm running into this issue as well. I can install Az.Accounts 1.9.5 to get around the issue, but my script also requires Az.KeyVault to run, which automatically installs a more recent version of Az.Accounts.
I'm running into this issue as well. I can install Az.Accounts 1.9.5 to get around the issue, but my script also requires Az.KeyVault to run, which automatically installs a more recent version of Az.Accounts.
I had to start using explicit import-module
statements with -RequiredVersion
parameter to get it to work. YMMV
Steps to reproduce
Please see this error report: https://github.com/Azure/azure-powershell/issues/14288
With Az.Accounts 2.1.0 or higher installed run:
After login run
Expected behavior
Module gets imported silently
Actual behavior
Diagnostic logs
Environment