Only SPN credential auth scheme is supported for non windows agent
Description
When I create an Azure Pipeline to run an Azure Powershell task v5 using a self-hosted and managed Ubuntu 18.04 server in an Agent pool I get the error "Only SPN credential auth scheme is supported for non windows agent"
Steps to reproduce
I initially created a post HERE
I have created a Ubuntu 18.04 server in Azure. I created an Agent pool using docs HERE
I manually installed PowerShell using docs HERE
I have since then updated the module with the command Update-Module -Name Az to 4.4.0 and I get the same error
I created a classic pipeline to run a Powershell script to test the AZ module from the agent pool can be used
$ExistingVms = Get-AzVM -ResourceGroupName "some_resource_rg" | select Name
Write-Host $ExistingVms.Name
When this runs I get the above-mentioned error with no indication how I can resolve the issue. Only SPN credential auth scheme is supported for non windows agent
Environment data
$PSVersionTable
Name Value
---- -----
PSVersion 7.0.2
PSEdition Core
GitCommitId 7.0.2
OS Linux 5.3.0-1031-azure #32~18.04.1-Ubuntu SMP Mon Jun 22 15:27:23 UTC 2020
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0``
## Module versions
<!-- Please run (Get-Module -ListAvailable) and paste the output in the below code block -->
```powershell
Get-Module -ListAvailable
Directory: /home/aauckland/.local/share/powershell/Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 4.4.0 Az Core,Desk
Script 1.9.1 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzD…
Script 1.1.1 Az.Advisor Core,Desk {Get-AzAdvisorRecommendation, Enable-AzAdvisorRecommendation, Di…
Script 1.1.3 Az.Aks Core,Desk {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCredential…}
Script 1.1.4 Az.AnalysisServices Core,Desk {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServ…
Script 2.0.1 Az.ApiManagement Core,Desk {Add-AzApiManagementApiToProduct, Add-AzApiManagementProductToGr…
Script 1.1.0 Az.ApplicationInsights Core,Desk {Get-AzApplicationInsights, New-AzApplicationInsights, Remove-Az…
Script 1.3.7 Az.Automation Core,Desk {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWor…
Script 3.1.0 Az.Batch Core,Desk {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAccountKe…
Script 1.0.3 Az.Billing Core,Desk {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollmentAcco…
Script 1.4.3 Az.Cdn Core,Desk {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, Rem…
Script 1.5.0 Az.CognitiveServices Core,Desk {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountK…
Script 4.2.1 Az.Compute Core,Desk {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabi…
Script 1.0.3 Az.ContainerInstance Core,Desk {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzContainerG…
Script 1.1.1 Az.ContainerRegistry Core,Desk {New-AzContainerRegistry, Get-AzContainerRegistry, Update-AzCont…
Script 1.1.0 Az.DataBoxEdge Core,Desk {Get-AzDataBoxEdgeJob, Get-AzDataBoxEdgeDevice, Invoke-AzDataBox…
Script 1.9.0 Az.DataFactory Core,Desk {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFactoryV…
Script 1.0.2 Az.DataLakeAnalytics Core,Desk {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalyticsCatal…
Script 1.2.8 Az.DataLakeStore Core,Desk {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTru…
Script 1.0.0 Az.DataShare Core,Desk {New-AzDataShareAccount, Get-AzDataShareAccount, Remove-AzDataSh…
Script 1.1.0 Az.DeploymentManager Core,Desk {Get-AzDeploymentManagerArtifactSource, New-AzDeploymentManagerA…
Script 1.0.0 Az.DesktopVirtualization Core,Desk {Disconnect-AzWvdUserSession, Get-AzWvdApplication, Get-AzWvdApp…
Script 1.0.2 Az.DevTestLabs Core,Desk {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolicy, Get…
Script 1.1.2 Az.Dns Core,Desk {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRecordSe…
Script 1.3.0 Az.EventGrid Core,Desk {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGridTopi…
Script 1.5.0 Az.EventHub Core,Desk {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventHu…
Script 1.6.0 Az.FrontDoor Core,Desk {New-AzFrontDoor, Get-AzFrontDoor, Set-AzFrontDoor, Remove-AzFro…
Script 1.0.1 Az.Functions Core,Desk {Get-AzFunctionApp, Get-AzFunctionAppAvailableLocation, Get-AzFu…
Script 3.3.1 Az.HDInsight Core,Desk {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wait-AzH…
Script 1.1.0 Az.HealthcareApis Core,Desk {New-AzHealthcareApisService, Remove-AzHealthcareApisService, Se…
Script 2.5.0 Az.IotHub Core,Desk {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-AzIotHu…
Script 2.0.0 Az.KeyVault Core,Desk {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-A…
Script 1.3.2 Az.LogicApp Core,Desk {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountAsse…
Script 1.1.3 Az.MachineLearning Core,Desk {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssociation, …
Script 1.0.0 Az.Maintenance Core,Desk {Get-AzApplyUpdate, Get-AzConfigurationAssignment, Get-AzMainten…
Script 1.0.2 Az.ManagedServices Core,Desk {Get-AzManagedServicesAssignment, New-AzManagedServicesAssignmen…
Script 1.0.2 Az.MarketplaceOrdering Core,Desk {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script 1.1.1 Az.Media Core,Desk {Sync-AzMediaServiceStorageKey, Set-AzMediaServiceKey, Get-AzMed…
Script 2.0.2 Az.Monitor Core,Desk {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-…
Script 3.2.0 Az.Network Core,Desk {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplic…
Script 1.1.1 Az.NotificationHubs Core,Desk {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRule, …
Script 2.2.0 Az.OperationalInsights Core,Desk {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOper…
Script 1.3.1 Az.PolicyInsights Core,Desk {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSummary,…
Script 1.1.2 Az.PowerBIEmbedded Core,Desk {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceColl…
Script 1.0.3 Az.PrivateDns Core,Desk {Get-AzPrivateDnsZone, Remove-AzPrivateDnsZone, Set-AzPrivateDns…
Script 2.11.0 Az.RecoveryServices Core,Desk {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVau…
Script 1.2.1 Az.RedisCache Core,Desk {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheScheduleEntry…
Script 1.0.3 Az.Relay Core,Desk {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNamespac…
Script 2.3.0 Az.Resources Core,Desk {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAss…
Script 1.4.1 Az.ServiceBus Core,Desk {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set-AzSer…
Script 2.1.0 Az.ServiceFabric Core,Desk {Add-AzServiceFabricClientCertificate, Add-AzServiceFabricCluste…
Script 1.1.1 Az.SignalR Core,Desk {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSignalRKe…
Script 2.9.0 Az.Sql Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTr…
Script 1.1.0 Az.SqlVirtualMachine Core,Desk {New-AzSqlVM, Get-AzSqlVM, Update-AzSqlVM, Remove-AzSqlVM…}
Script 2.3.0 Az.Storage Core,Desk {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAcc…
Script 1.3.0 Az.StorageSync Core,Desk {Invoke-AzStorageSyncCompatibilityCheck, New-AzStorageSyncServic…
Script 1.0.1 Az.StreamAnalytics Core,Desk {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefaultFunc…
Script 1.0.0 Az.Support Core,Desk {Get-AzSupportService, Get-AzSupportProblemClassification, Get-A…
Script 1.0.4 Az.TrafficManager Core,Desk {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTrafficMan…
Script 1.11.0 Az.Websites Core,Desk {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePla…
Script 1.4.7 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSour…
Script 2.2.4.1 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapabilit…
Directory: /usr/local/share/powershell/Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 4.3.0 Az Core,Desk
Script 1.9.0 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzD…
Script 1.1.1 Az.Advisor Core,Desk {Get-AzAdvisorRecommendation, Enable-AzAdvisorRecommendation, Di…
Script 1.1.2 Az.Aks Core,Desk {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCredential…}
Script 1.1.3 Az.AnalysisServices Core,Desk {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServ…
Script 2.0.1 Az.ApiManagement Core,Desk {Add-AzApiManagementApiToProduct, Add-AzApiManagementProductToGr…
Script 1.1.0 Az.ApplicationInsights Core,Desk {Get-AzApplicationInsights, New-AzApplicationInsights, Remove-Az…
Script 1.3.6 Az.Automation Core,Desk {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWor…
Script 3.1.0 Az.Batch Core,Desk {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAccountKe…
Script 1.0.3 Az.Billing Core,Desk {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollmentAcco…
Script 1.4.3 Az.Cdn Core,Desk {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, Rem…
Script 1.5.0 Az.CognitiveServices Core,Desk {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountK…
Script 4.2.0 Az.Compute Core,Desk {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabi…
Script 1.0.3 Az.ContainerInstance Core,Desk {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzContainerG…
Script 1.1.1 Az.ContainerRegistry Core,Desk {New-AzContainerRegistry, Get-AzContainerRegistry, Update-AzCont…
Script 1.1.0 Az.DataBoxEdge Core,Desk {Get-AzDataBoxEdgeJob, Get-AzDataBoxEdgeDevice, Invoke-AzDataBox…
Script 1.8.2 Az.DataFactory Core,Desk {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFactoryV…
Script 1.0.2 Az.DataLakeAnalytics Core,Desk {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalyticsCatal…
Script 1.2.8 Az.DataLakeStore Core,Desk {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTru…
Script 1.0.0 Az.DataShare Core,Desk {New-AzDataShareAccount, Get-AzDataShareAccount, Remove-AzDataSh…
Script 1.1.0 Az.DeploymentManager Core,Desk {Get-AzDeploymentManagerArtifactSource, New-AzDeploymentManagerA…
Script 1.0.0 Az.DesktopVirtualization Core,Desk {Disconnect-AzWvdUserSession, Get-AzWvdApplication, Get-AzWvdApp…
Script 1.0.2 Az.DevTestLabs Core,Desk {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolicy, Get…
Script 1.1.2 Az.Dns Core,Desk {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRecordSe…
Script 1.2.3 Az.EventGrid Core,Desk {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGridTopi…
Script 1.5.0 Az.EventHub Core,Desk {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventHu…
Script 1.5.0 Az.FrontDoor Core,Desk {New-AzFrontDoor, Get-AzFrontDoor, Set-AzFrontDoor, Remove-AzFro…
Script 1.0.1 Az.Functions Core,Desk {Get-AzFunctionApp, Get-AzFunctionAppAvailableLocation, Get-AzFu…
Script 3.3.0 Az.HDInsight Core,Desk {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wait-AzH…
Script 1.1.0 Az.HealthcareApis Core,Desk {New-AzHealthcareApisService, Remove-AzHealthcareApisService, Se…
Script 2.5.0 Az.IotHub Core,Desk {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-AzIotHu…
Script 2.0.0 Az.KeyVault Core,Desk {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-A…
Script 1.3.2 Az.LogicApp Core,Desk {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountAsse…
Script 1.1.3 Az.MachineLearning Core,Desk {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssociation, …
Script 1.0.0 Az.Maintenance Core,Desk {Get-AzApplyUpdate, Get-AzConfigurationAssignment, Get-AzMainten…
Script 1.0.2 Az.ManagedServices Core,Desk {Get-AzManagedServicesAssignment, New-AzManagedServicesAssignmen…
Script 1.0.2 Az.MarketplaceOrdering Core,Desk {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script 1.1.1 Az.Media Core,Desk {Sync-AzMediaServiceStorageKey, Set-AzMediaServiceKey, Get-AzMed…
Script 2.0.1 Az.Monitor Core,Desk {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-…
Script 3.1.0 Az.Network Core,Desk {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplic…
Script 1.1.1 Az.NotificationHubs Core,Desk {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRule, …
Script 2.2.0 Az.OperationalInsights Core,Desk {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOper…
Script 1.3.1 Az.PolicyInsights Core,Desk {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSummary,…
Script 1.1.2 Az.PowerBIEmbedded Core,Desk {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceColl…
Script 1.0.3 Az.PrivateDns Core,Desk {Get-AzPrivateDnsZone, Remove-AzPrivateDnsZone, Set-AzPrivateDns…
Script 2.10.0 Az.RecoveryServices Core,Desk {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVau…
Script 1.2.1 Az.RedisCache Core,Desk {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheScheduleEntry…
Script 1.0.3 Az.Relay Core,Desk {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNamespac…
Script 2.2.0 Az.Resources Core,Desk {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAss…
Script 1.4.1 Az.ServiceBus Core,Desk {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set-AzSer…
Script 2.1.0 Az.ServiceFabric Core,Desk {Add-AzServiceFabricClientCertificate, Add-AzServiceFabricCluste…
Script 1.1.1 Az.SignalR Core,Desk {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSignalRKe…
Script 2.8.0 Az.Sql Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTr…
Script 1.1.0 Az.SqlVirtualMachine Core,Desk {New-AzSqlVM, Get-AzSqlVM, Update-AzSqlVM, Remove-AzSqlVM…}
Script 2.2.0 Az.Storage Core,Desk {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAcc…
Script 1.2.3 Az.StorageSync Core,Desk {Invoke-AzStorageSyncCompatibilityCheck, New-AzStorageSyncServic…
Script 1.0.1 Az.StreamAnalytics Core,Desk {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefaultFunc…
Script 1.0.0 Az.Support Core,Desk {Get-AzSupportService, Get-AzSupportProblemClassification, Get-A…
Script 1.0.4 Az.TrafficManager Core,Desk {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTrafficMan…
Script 1.10.0 Az.Websites Core,Desk {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePla…
Directory: /snap/powershell/132/opt/powershell/Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Manifest 1.2.5 Microsoft.PowerShell.Archive Desk {Compress-Archive, Expand-Archive}
Manifest 7.0.0.0 Microsoft.PowerShell.Host Core {Start-Transcript, Stop-Transcript}
Manifest 7.0.0.0 Microsoft.PowerShell.Management Core {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path…}
Manifest 7.0.0.0 Microsoft.PowerShell.Security Core {Get-Credential, Get-ExecutionPolicy, Set-ExecutionPolicy, Conve…
Manifest 7.0.0.0 Microsoft.PowerShell.Utility Core {Export-Alias, Get-Alias, Import-Alias, New-Alias…}
Script 1.4.6 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSour…
Script 2.2.4 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapabilit…
Script 2.0.5 PSDesiredStateConfiguration Core {Configuration, New-DscChecksum, Get-DscResource, Invoke-DscReso…
Script 2.0.0 PSReadLine Desk {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSRe…
Binary 2.0.3 ThreadJob Desk Start-ThreadJob
Debug output
I am assuming this is the pipeline output
2020-07-15T08:31:34.9562282Z ##[section]Starting: Azure PowerShell script: FilePath
2020-07-15T08:31:34.9760248Z ==============================================================================
2020-07-15T08:31:34.9761380Z Task : Azure PowerShell
2020-07-15T08:31:34.9762061Z Description : Run a PowerShell script within an Azure environment
2020-07-15T08:31:34.9762385Z Version : 5.171.1
2020-07-15T08:31:34.9763270Z Author : Microsoft Corporation
2020-07-15T08:31:34.9763869Z Help : https://aka.ms/azurepowershelltroubleshooting
2020-07-15T08:31:34.9764217Z ==============================================================================
2020-07-15T08:31:35.5657752Z Generating script.
2020-07-15T08:31:35.5659027Z Formatted command: . '/home/redacted-user/build-agent/_work/r2/a/repo/get-vm-list.ps1' null
2020-07-15T08:31:35.5670455Z [command]/snap/bin/pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command . '/home/user/build-agent/_work/_temp/redacted.ps1'
2020-07-15T08:31:35.9994610Z ##[command]Import-Module -Name /home/redacted-user/.local/share/powershell/Modules/Az.Accounts/1.9.1/Az.Accounts.psd1 -Global
2020-07-15T08:31:36.4473536Z ##[command]Clear-AzContext -Scope Process
2020-07-15T08:31:37.4714756Z ##[command]Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue
2020-07-15T08:31:38.0094523Z Exception is : Only SPN credential auth scheme is supported for non windows agent.
2020-07-15T08:31:38.1496059Z [91mOperationStopped: [0m/home/redactecd-sure/build-agent/_work/_tasks/AzurePowerShell_72a1931b-effb-4d2e-8fd8-f8472a07cb62/5.171.1/InitializeAz.ps1:91
2020-07-15T08:31:38.1508445Z [96mLine |
2020-07-15T08:31:38.1552034Z [96m 91 | [0m [96mthrow (New-Object System.Exception("There was an error with t[0m …
2020-07-15T08:31:38.1555289Z [96m | [91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-07-15T08:31:38.1559576Z [91m[96m | [91mThere was an error with the service principal used for the
2020-07-15T08:31:38.1560994Z [96m | [91mdeployment.
2020-07-15T08:31:38.1562082Z [0m
2020-07-15T08:31:38.1740752Z ##[error]PowerShell exited with code '1'.
2020-07-15T08:31:38.1774588Z ##[section]Finishing: Azure PowerShell script: FilePath
Error output
Resolve-AzError
DEBUG: Sought all Az modules and got latest version 4.4.0
DEBUG: 08:24:47 - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 08:24:47 - using account id 'xxxxxxxxx-REDACTED-xxxxxxxxxxxx'...
WARNING: Breaking changes in the cmdlet 'Resolve-AzError' :
WARNING: - The `Resolve-Error` alias will be removed in a future release. Please change any scripts that use this alias to use `Resolve-AzError` instead.
WARNING: NOTE : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.
HistoryId: 7
Message : The term 'repro' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
StackTrace : at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchReso
lutionOptions searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)
at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandOrigin commandOrigin, Executio
nContext context)
at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandOrigin commandOrigin)
at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nul
lable`1 useLocalScope)
at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, C
ommandBaseAst commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] p
ipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.CommandNotFoundException
InvocationInfo : {}
Line : repro
Position : At line:1 char:1
+ repro
+ ~~~~~
HistoryId : 7
The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.
DEBUG: AzureQoSEvent: CommandName - Resolve-AzError; IsSuccess - True; Duration - 00:00:00.0413772;
DEBUG: Finish sending metric.
DEBUG: 08:24:47 - ResolveError end processing.
``
@alanauckland86 Thanks for reporting this issue with the ADO agent. It looks like your agent has two versions of Az installed (4.4.0 and 4.3.0 in this case) and this is likely caused by the manual installation which you should not do with this task.
Can you use the settings azurePowerShellVersion: latestVersion in the task configuration to specify the agent to use the latest version of the Az module and let me know the result?
Hello Dcaro,
Please see the attached screenshot that shows the setting is already set.
I have also tried to use a different task version and get the same result up to about version 3 then the error changes but I think that is irrelevant here.

However, I think from what you are saying I do not need to install the AZ module on the Self-hosted Linux agent server for this task to run.
Correct, installing Az will conflict with the installation that the task is doing in the preparation steps. Please try without the manual installation.
Hello Dcaro, I removed both of the Az modules from the managed VM. When I run the Azure Powershell task in the classic pipeline, I got an error saying that the Az.Accounts module was not found.
I installed it using the command
Install-Module -Name Az.Accounts
I re-ran the pipeline and I got the following error again:
Only SPN credential auth scheme is supported for non windows agent
Please see output of Get-Module -ListAvailable below as the current state of my Managed Linux Pipeline agent
Directory: /home/some-place/.local/share/powershell/Modules
ModuleType Version PreRelease Name PSEdition
---------- ------- ---------- ---- ---------
Script 1.9.1 Az.Accounts Core,Desk
Script 1.4.7 PackageManagement Desk
Script 2.2.4.1 PowerShellGet Desk
Directory: /snap/powershell/137/opt/powershell/Modules
ModuleType Version PreRelease Name PSEdition
---------- ------- ---------- ---- ---------
Manifest 1.2.5 Microsoft.PowerShell.Archive Desk
Manifest 7.0.0.0 Microsoft.PowerShell.Host Core
Manifest 7.0.0.0 Microsoft.PowerShell.Management Core
Manifest 7.0.0.0 Microsoft.PowerShell.Security Core
Manifest 7.0.0.0 Microsoft.PowerShell.Utility Core
Script 1.4.7 PackageManagement Desk
Script 2.2.4.1 PowerShellGet Desk
Script 2.0.5 PSDesiredStateConfiguration Core
Script 2.0.2 PSReadLine Desk
Binary 2.0.3 ThreadJob Desk
@alanauckland86 This issue is caused by the Azure DevOps PowerShell task. A similar issue has been logged: https://github.com/microsoft/azure-pipelines-tasks/issues/13372
Any progress on this? I'm facing the same issue as well.
Any progress on this? I'm facing the same issue as well.
Ah yes sorry, I got passed it the other day.
So in Azure you have different service connections Classic and AzureRM.
I was using an AzureRM service connection
But in my power shell script was using the AZ module command lets. So it was trying to find a classic connection but I was in fact using an RM connections.
This uses the classic service connection and not AzureRM
I installed AZ module again and then changed the service principle I was using to a classic one.
If I didn't install AZ module I would have had to install rm modules which are legacy and deprecated and then ensure my power shell script used RM commands and not AZ commands.
Long and short 2 modules AZ uses classic service connections AzureRM uses AzureRm service connections.
You can see this when you create a service connections :)
I hope this makes some sense. Harder to explain.
@alanauckland86 I assume you used this solution outside of Azure Devops, just any normal Azure Powershell module script? On AZDO it doesn't let you select the classic connections, only RM based ones.
I did have success adding a new service connection, Azure RM, and using the Service Principal (Manual) option with an SPN from one of my registered AAD apps. But that feels.. kludgy.
Is someone able to provide info on what the limitation is here ?
- "Only SPN credential auth scheme is supported for non windows agent."
I have a few layers, so not sure which layer this error is coming from ?
- The ADO Azure RM Service connection using Managed Identity.
- The Azure PowerShell Task (using above Subscription connection).
- The Linux image that I am using for the Deployment Agent/Pool.
Windows agent works fine with the combination of those 3 above.
@alanauckland86 This issue is caused by the Azure DevOps PowerShell task. A similar issue has been logged: microsoft/azure-pipelines-tasks#13372
I see this comment. so it appears to be options 2 above.
The refererenced issue there is however closed.
Is there any workaround besides creating a classic serviceConnection? We're using azure MSI with Linux Agents at a client and they'd very much to not have to use classic service connections with service principals.
Any chance this will be looked at? Its only been over 3 years.
I'm having the same issue. Is anyone actually working on this?
I think everyone knows that the issue is that it isn't supported at this point. The question is how do we get it supported? When identity federation is the recommended path forward, why aren't things supporting it?
On Tue, Sep 24, 2024, 20:09 mdulgheru @.***> wrote:
This is not a powershell issue. In your pipeline definition, in the task you have: imputs: azureSubscription: 'someDevOpsServiceConnectionHere'
Here you're probably using a service connection that uses federated credentials, which is supported only by windows agents. In AzureDevOps, create a new ARM service connection and, on authentication method, select "Service principal" instead of "Workload Identity federation".
This will cause the identity created in AAD to authenticate using a secret instead of federated credentials. The ugly thing about this is that the secret expires after some time and, when this happens, the pipeline tasks using that connection will stop working. You can automate the renewal of that secret + update on the service connections to get rid of this "secret expire" problem.
The service connection using federated identity doesn't expire but is not supported on non-windows agents (hoping it will at some point).
— Reply to this email directly, view it on GitHub https://github.com/Azure/azure-powershell/issues/12401#issuecomment-2371088482, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVIZ4SWJ3L6V6AGHILXT5A3ZYFI57AVCNFSM4O2J4XWKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMZXGEYDQOBUHAZA . You are receiving this because you commented.Message ID: @.***>
I wrote that before i went through all the comments, that`s why i deleted it once i saw the rest. "When identity federation is the recommended path forward, why aren't things supporting it?" - i am here because i also want to find out the answer to this question :D
Sorry. I was wondering why I couldn't see it once I clicked the link :P