Skip to content

Invoke-AzCostManagementQuery adds two empty lines to terminal before output #27640

Open
@o-l-a-v

Description

@o-l-a-v

Description

Invoke-AzCostManagementQuery from Az.Billing v2.2.0 adds two empty lines to terminal before showing the output. This even happens if assigning output to a variable.

This messes up script output.

Expected behavior (no empty lines):

PS > $ConsumptionLastWeek = $(
    Invoke-AzCostManagementQuery -DatasetAggregation @{
        'totalCost' = @{
            'name'     = [string] 'Cost'
            'function' = [string] 'SUM'
        }
    } -Type 'ActualCost' -Timeframe 'Custom' `
        -Scope ('/subscriptions/{0}' -f $Subscription.'Id') `
        -TimePeriodFrom $EndOfTwoWeeksAgo.ToString('o') `
        -TimePeriodTo  $EndOfLastWeek.ToString('o')
)
PS >

Actual behavior (two empty lines):

PS > $ConsumptionLastWeek = $(
    Invoke-AzCostManagementQuery -DatasetAggregation @{
        'totalCost' = @{
            'name'     = [string] 'Cost'
            'function' = [string] 'SUM'
        }
    } -Type 'ActualCost' -Timeframe 'Custom' `
        -Scope ('/subscriptions/{0}' -f $Subscription.'Id') `
        -TimePeriodFrom $EndOfTwoWeeksAgo.ToString('o') `
        -TimePeriodTo  $EndOfLastWeek.ToString('o')
)


PS >

Issue script & Debug output

There are no errors.

Environment data

Windows 11 24H2 x64
PowerShell v7.5.0 x64
Az.Billing v2.2.0

Module versions

Az.Billing v2.2.0

Error output

There are no errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedneeds-triageThis is a new issue that needs to be triaged to the appropriate team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions