Skip to content

[BUG]: Consistent output suppression in AzurePowershellV5 #19672

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

Closed
7 tasks done
mortenlerudjordet opened this issue Mar 22, 2024 · 2 comments
Closed
7 tasks done

[BUG]: Consistent output suppression in AzurePowershellV5 #19672

mortenlerudjordet opened this issue Mar 22, 2024 · 2 comments
Labels

Comments

@mortenlerudjordet
Copy link
Contributor

New issue checklist

Task name

AzurePowershellV5

Task version

v5

Issue Description

New code addition in V5 does not follow same supression pattern as older versions.

Example old pattern in InitializeAz.ps1:
$null = Connect-AzAccount
$null = Set-AzContext

New code that does not follow this pattern (no $null):

elseif ($endpointObject.scheme -eq 'WorkloadIdentityFederation') {
    Write-Verbose "Using WorkloadIdentityFederation authentication scheme"

    $logStr = "##[command] Connect-AzAccount -ServicePrincipal -Tenant $($endpointObject.tenantId) -ApplicationId $($endpointObject.servicePrincipalClientID)"
    $logStr += " -FederatedToken ***** -Environment $environmentName -Scope Process"
    Write-Host $logStr
    Connect-AzAccount -ServicePrincipal -Tenant $endpointObject.tenantId -ApplicationId $endpointObject.servicePrincipalClientID `
        -FederatedToken $clientAssertionJwt -Environment $environmentName -Scope 'Process'

    if ($scopeLevel -ne "ManagementGroup") {
        Write-Host "##[command] Set-AzContext -SubscriptionId $($endpointObject.subscriptionID) -TenantId $($endpointObject.tenantId)"
        Set-AzContext -SubscriptionId $endpointObject.subscriptionID -TenantId $endpointObject.tenantId
    }
}

Please add supression as output often leaks into output from user code in pipeline output.
Output to terminal from task is often delayed and will show up in the middle of executing user code, and pollute output pipeline logs.

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows

Relevant log output

Also output logs does not log as expected from task:

Connect-AzAccount System.Collections.Hashtable
VERBOSE: Command [Connect-AzAccount] succeeded.

Example of output pollution:
        (\__/) ||                    |( 王ノ〈         
        (•ㅅ•) ||                    /ミー―彡\        
        /    づ                     / ╰   ╯  \       
Account                              SubscriptionName TenantId                             Environment
-------                              ---------------- --------                             -----------
*** Company-core-mgm XXXXXX-XXXX-XXXX-XXXX-XXXXXXX AzureCloud

Startup tasks
[+] finding & importing configuration files

Full task logs with system.debug enabled

 [REPLACE THIS WITH YOUR INFORMATION] 

Repro steps

No response

@v-mohithgc v-mohithgc added Area:RM RM task team and removed Area: Release labels Mar 22, 2024
@mortenlerudjordet mortenlerudjordet changed the title [BUG]: Consistent output supression in AzurePowershellV5 [BUG]: Consistent output suppression in AzurePowershellV5 Mar 27, 2024
@mortenlerudjordet
Copy link
Contributor Author

New PR: #19694 without changes to helper function so make approval easier.

@mortenlerudjordet
Copy link
Contributor Author

PR merged and issue will be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants