Description
Required Information
Entering this information will route you directly to the right team and expedite traction.
Question, Bug, or Feature?
Type: Bug
Enter Task Name: Azure Powershell
Environment
-
Server - Azure Pipelines or TFS on-premises?
Azure Pipelines
- If using Azure Pipelines, provide the account name, team project name, build definition name/build number:
Account: amcsgroup
Project: Routing
Release definition name: routing_qa3_f0
ReleaseId: 4612
- If using Azure Pipelines, provide the account name, team project name, build definition name/build number:
-
Agent - Hosted or Private:
Hosted- If using Hosted agent, provide agent queue name:
Azure Pipelines
- If using Hosted agent, provide agent queue name:
Issue Description
Since yesterday, 23rd of July, Azure Powershell tasks started failing with an error "Your Azure credentials have not been set up or have expired, please run Connect-AzAccount to set up your Azure credentials." when passing AzContext to a background job.
Task logs
[Enable debug logging and please provide the zip file containing all the logs for a speedy resolution]
Troubleshooting
Checkout how to troubleshoot failures and collect debug logs: https://docs.microsoft.com/en-us/vsts/build-release/actions/troubleshooting
Error logs
Reproduction steps:
-
Create a release with Azure PowerShell V4 or V5 task using the following params:
-
Use the following reproduction script
$Context = Get-AzContext
$ScriptBlock = {
param($Azcontext)
$ErrorActionPreference = "Stop"
try {
Get-AzKeyVault -VaultName %somename% -ResourceGroupName %some-rg% -AzureRMContext $Azcontext | Out-Null
Write-Output "Done."
}
catch
{
Write-Error $_
}
}
@(1, 2, 3) | ForEach-Object {
Start-Job -Name $_ -ScriptBlock $ScriptBlock -ArgumentList $Context | Out-Null
}
Start-Sleep -Seconds 5
@(1, 2, 3) | ForEach-Object {
Get-Job -Name $_ | Receive-Job
}