https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/AzurePowerShellV5/InitializeAz.ps1 is missing support for "$endpointObject.authenticationType -ieq 'SPNCertificate'"
See original GitHub issueNote
Issues in this repo are for tracking bugs, feature requests and questions for the tasks in this repo
For a list:
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks
If you have an issue or request for the Azure Pipelines service, use developer community instead:
https://developercommunity.visualstudio.com/spaces/21/index.html )
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: here
AzurePowerShell@4
AzurePowerShell@5
list here (V# not needed):
https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/AzurePowerShellV4/InitializeAz.ps1
https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/AzurePowerShellV5/InitializeAz.ps1
Environment
-
Server - Azure Pipelines
-
Agent - Hosted
Issue Description
For service endpoints we are using "authorization": {"scheme": "ServicePrincipal"
and "authenticationType": "spnCertificate"
. When using AzurePowerShell@4
or AzurePowerShell@5
on anything other then windows-latest
it seems support is missing for this authenticationtype, since it throws "Only SPN credential auth scheme is supported for non windows agent."
. Looking at InitializeAz.ps1 it only seems to try SPNKey;
try {
if ($endpointObject.authenticationType -ieq 'SPNKey') {
Task logs
2020-07-29T22:55:24.8405693Z ##[section]Starting: AzurePowerShell 2020-07-29T22:55:24.8414947Z ============================================================================== 2020-07-29T22:55:24.8415311Z Task : Azure PowerShell 2020-07-29T22:55:24.8415623Z Description : Run a PowerShell script within an Azure environment 2020-07-29T22:55:24.8415914Z Version : 4.173.1 2020-07-29T22:55:24.8416177Z Author : Microsoft Corporation 2020-07-29T22:55:24.8416500Z Help : https://aka.ms/azurepowershelltroubleshooting 2020-07-29T22:55:24.8416840Z ============================================================================== 2020-07-29T22:55:25.0002949Z ## Validating Inputs 2020-07-29T22:55:25.0068398Z ## Validating Inputs Complete 2020-07-29T22:55:25.0068607Z ## Initializing Az module 2020-07-29T22:55:25.0080295Z Generating script. 2020-07-29T22:55:25.0094224Z ## Az module initialization Complete 2020-07-29T22:55:25.0094776Z ## Beginning Script Execution 2020-07-29T22:55:25.0114361Z [command]/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command . '/home/vsts/work/_temp/8af16c39-ee29-44b6-8743-ee2da781b177.ps1' 2020-07-29T22:55:25.6483461Z ##[command]Import-Module -Name /usr/share/az_4.3.0/Az.Accounts/1.9.1/Az.Accounts.psd1 -Global 2020-07-29T22:55:26.0522176Z ##[command]Clear-AzContext -Scope Process 2020-07-29T22:55:26.9380706Z ##[command]Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue 2020-07-29T22:55:27.5543805Z Exception is : Only SPN credential auth scheme is supported for non windows agent. 2020-07-29T22:55:27.6778213Z [91mOperationStopped: [0m/home/vsts/work/_tasks/AzurePowerShell_72a1931b-effb-4d2e-8fd8-f8472a07cb62/4.173.1/InitializeAz.ps1:91 2020-07-29T22:55:27.6779895Z [96mLine | 2020-07-29T22:55:27.6780952Z [96m 91 | [0m [96mthrow (New-Object System.Exception("There was an error with t[0m … 2020-07-29T22:55:27.6782082Z [96m | [91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2020-07-29T22:55:27.6783134Z [91m[96m | [91mThere was an error with the service principal used for the 2020-07-29T22:55:27.6784199Z [96m | [91mdeployment. 2020-07-29T22:55:27.6785072Z [0m 2020-07-29T22:55:27.6942396Z ##[error]PowerShell exited with code '1'. 2020-07-29T22:55:27.6951601Z ## Script Execution Complete 2020-07-29T22:55:27.6954308Z ##[section]Finishing: AzurePowerShell
Troubleshooting
Checkout how to troubleshoot failures and collect debug logs: https://docs.microsoft.com/en-us/vsts/build-release/actions/troubleshooting
Error logs
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Has anyone looked at this issue at any point? Not being able to run any PSCore task in Azure on non-windows machines is quite a limit.
The only workaround i found is creating a new Service Connection using the “Azure RM > Service Principal (Manual) > Service Principal Key” configuration, which supposedly excludes certs. Maybe the automatic one uses those and thus fails as mentioned here.
any progress with this? Still i am facing the same issue for linux machine.