-
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
Pre-Release - Az.Storage is no longer working for Get-AzStorageAccount in VSCode #21811
Comments
Thank you for your feedback. This has been routed to the support team for assistance. |
@wrharper-AASP Thanks for reaching out to us and reporting this issue. We are looking into this issue and we will provide an update. |
I tried to run Get-AzStorageAccount in VS code, but can't repro this issue. I have installed https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell (tried both pre-release version and release version), so the
Not sure how you get the PS version as 5.1 in VS code. Could you share the detail steps to repro this issue include how to setup Powershell in VS code? |
Is there any known issue with Azure Powershell on pre-release version of PowerShell in VS Code? |
@wrharper-AASP could you go to the command palette of vscode, look for "PowerShell: Show Session Menu" and "Switch to: PowerShell (x64)"? |
I'm getting this problem, first occurred for me approx Weds 10th May, in a fresh VM deployed as an Azure Automation Hybrid Worker running hybrid runbooks. Doens't seem specific to pre-release or for VS Code. But yes definitely a problem, caught it in dev though so its okay (at the moment). Seeing this release note about a possible breaking change in
Repros everytime in a runbook, can't seem to repro on the same machine interactively via WinRM, using exactly the same script, in different variations of Connect-AzAccount, and confirming its the same version of Powershell as reported by the runbook. I'm going to redeploy with Using this base image: source_image_reference {
publisher = "MicrosoftWindowsServer"
offer = "WindowsServer"
sku = "2022-datacenter-core-g2"
version = "latest"
}
Configuration DomainHybridWorkerDsc {
param(
[Parameter(Mandatory)]
[string] $StageName
)
Import-DscResource -Name PSRepository, PSModule -Module PowerShellGet -ModuleVersion "2.2.5"
$domainCredential = Get-AutomationPSCredential -Name "AD-Service-Account"
# ... note other resources are also deployed but this is the minimal example ...
Node $StageName {
Script PSGalleryPrereq {
GetScript = {
$repository = Get-PSRepository | Where-Object Name -like PSGallery
if ($repository)
{
return @{ Result = $repository.Name }
}
return @{ Result = "Unavailable" }
}
TestScript = {
$requiredRepository = Get-PSRepository | Where-Object Name -like PSGallery
return [bool]$requiredRepository
}
SetScript = {
Register-PSRepository -Default
}
PsDscRunAsCredential = $domainCredential
}
PSModule AzPowershell
{
DependsOn = "[Script]PSGalleryPrereq"
Name = "Az"
MinimumVersion = "8.3.0"
Repository = "PSGallery"
InstallationPolicy = "Trusted"
Force = $True
PsDscRunAsCredential = $domainCredential
}
}
} Example failing runbook script, using user assigned identity (have varied $ErrorActionPreference = "Continue"
$PSVersionTable
$SubscriptionId = "x-x-x-x"
$hybridsIdentity = Get-AutomationPSCredential -Name "Hybrid-Worker"
Connect-AzAccount -Identity -Subscription $SubscriptionId -AccountId $hybridsIdentity.UserName
Get-AzStorageAccount # Exception here
Get-Module | Select ModuleType, Version, Name | Format-Table -AutoSize
Resolve-AzError Modules loaded in runspace after failure (
Detailed exception:
|
|
@wrharper-AASP I wanted to do quick follow-up to check if you had a chance to look at the above suggestions. Please let us know if you had any updates on this. Awaiting your reply. |
I had recently reinstalled Az module and now I'm getting this error with Az 9.7.1 (Az.Storage is 5.6.0). Are you suggesting a version rollback? |
@badbob001 I couldn't get |
well, the main thing is...will it be fixed though? hopefully they fix it instead of just say rollback to everyone and never fix it. it's always scary when this is the one and only answer to problems. |
Do I need to uninstall all my Az modules to downgrade to Az 9.6.0? Or can I just uninstall Az.Storagage 5.6.0 and then install an earlier version (not sure which)? |
As I see, Az.Storage doesn't do any change could cause this issue from 5.5.0-5.6.0. So do you have any idea why this issue not happen on Az 9.6.0, but happen on Az9.7.1? |
UPDATE: uninstalled az.storage 5.6 and installed 5.5 and issues is fixed so far. |
@isra-fel Any suggestions on this ? |
I have never understood why any language allows you to install libraries with one's that will not work. Maybe more people can learn from c# nuget. It handles things perfectly. Also, PowerShell is half there for intellisense. Both of these are critical to get right. These problems wouldn't even exist. |
We believe this was due to an assembly conflict between the Az.Accounts module and the PowerShellEditorServices module that comes with Vscode PowerShell extension. Besides, except for downgrade, I've verified that switching to a PowerShell 7 session can also work-around this issue - go to the command palette of vscode, look for "PowerShell: Show Session Menu" and "Switch to: PowerShell (x64)". |
@isra-fel Thanks for your reply. @wrharper-AASP Please follow the above suggestion and let us know if you have any other follow-up question. |
This has been resolved for me for a long time. I'm just mentioning a root cause problem with PowerShell itself. These types of issues would be impossible if structured correctly. |
@wrharper-AASP Thanks for the update. I am glad that the issue is resolved. Regarding your feedback about the assembly conflict, we have shared that with Vscode PowerShell extension. So that it can be addressed in future. |
Description
I was referred to here by: PowerShell/PowerShell#19646
After doing more testing, I have found that this is an issue in the pre-release version of PowerShell in VS Code.
Github said the body was too long due to the debug output so i had to remove some of it....
Issue script & Debug output
Environment data
Module versions
Error output
The text was updated successfully, but these errors were encountered: