Closed cutecycle closed 3 years ago
Additional note:
reference: it may be that the task does not branch based on managed identity?
@N-Usha can you check this enhancement request?
I've opened a PR to fix this: https://github.com/microsoft/azure-pipelines-tasks/pull/14533
These changes are already merged closing this issue
Required Information
Entering this information will route you directly to the right team and expedite traction.
Question, Bug, or Feature? Bug Type: Bug
Enter Task Name: AzurePowerShell
list here (V# not needed): 4,5 https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks
Environment
Server - Azure Pipelines or TFS on-premises?
If using TFS on-premises, provide the version:
If using Azure Pipelines, provide the account name, team project name, build definition name/build number: Microsoft, redacted, redacted, redacted (internal)
Agent - Hosted or Private:
If using Hosted agent, provide agent queue name: Not entirely sure of policy regarding publicly sharing agent queue names
If using private agent, provide the OS of the machine running the agent and the agent version: Windows Server 2019 Datacenter 17763.1637, VSTS Agent 2.179, AzureUSGovernment
Issue Description
We have a system in our Azure Pipelines (YAML) deployment that conditionally splits powershell tasks that reference Azure resources between
AzureCloud
and USGov, because we are having issues using anAzurePowerShell
task when:1) AzureCloud has a service principal-based service connection to a microsoft-hosted agent 2) USGov has a managed identity-on-VM-agent-based service connection.
work with the USGov service connection,
but the
AzurePowerShell@5
task doesn't.It does seem to correctly realize that the Service Connection is a USGov one based on
$endpointObject.environment
:But eventually fails to login:
As a result, we and others in related teams are using conditional branches and split stages where an environment using
AzureUSGovernment
executes a similar task, but withPowerShell@2
withConnect-AzAccount
:AzureCloud:
AzureUSGovernment:
Troubleshooting
Checkout how to troubleshoot failures and collect debug logs: https://docs.microsoft.com/en-us/vsts/build-release/actions/troubleshooting
Error logs