Repository navigation
Get StorageCost
Retrieves the Azure costs for one or more billing months for one or more storage accounts.
Get-StorageCost [[-AccountName] <String[]>] [[-BillingMonth] <DateTime>] [[-PreviousMonths] <Int32>]
[[-SparkLineSize] <Int32>] [-ComparePrevious] [[-ComparePreviousOffset] <Int32>] [-ExcludeSparklines] [-Raw]
[-EaSubscription] [[-EaSubscriptionKind] <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
Invokes the Get-AzConsumptionUsageDetail cmdlet against one or more storage accounts to return billing data for a specified number of months. If you are interested to see how costs have changed since the previous mont use the -ComparePrevious switch to return additional properties that contain the cost data for the previous month and properties that calculate the cost difference.
Get-StorageCost
Returns costs for the current billing month for all Storage accounts in the current Azure context.
Get-StorageCost -AccountName 'MyStorageAccount'
Returns costs for the current billing month for the specified Storage Account name.
Get-StorageCost -AccountName 'MyStorageAccountA','MyStorageAccountB'
Returns costs for the current billing month for the specified Storage Account names.
Get-StorageCost -BillingMonth 01/2024 -PreviousMonths 3
Returns costs from October 2023 to January 2024 for all Storage Accounts in the current Azure context.
Get-StorageCost -BillingMonth 01/2024 -PreviousMonths 3 -ComparePrevious
Returns costs from October 2023 to January 2024 for all Storage Accounts in the current Azure context and includes properties for comparing each month with the one prior.
Get-StorageCost -BillingMonth 01/2024 -PreviousMonths 3 -ComparePrevious -ComparePreviousOffset 12
Returns costs from October 2023 to January 2024 for all Storage Accounts in the current Azure context and includes properties for comparing each month with the one 12 months prior
The name or name/s of the Storage Account/s to query. If not specified all subscriptions available in the current context will be used.
Type: String[]
Parameter Sets: (All)
Aliases: Name, Account
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe billing month to query for cost data, specified as a [datetime] object. You can specify just month/year, e.g 10/2023. If not specified uses the current date.
Type: DateTime
Parameter Sets: (All)
Aliases: Month
Required: False
Position: 2
Default value: (Get-Date)
Accept pipeline input: False
Accept wildcard characters: FalseThe number of previous billing months to query. Default: 0.
Type: Int32
Parameter Sets: (All)
Aliases: PrevMonths
Required: False
Position: 3
Default value: 0
Accept pipeline input: False
Accept wildcard characters: FalseThe row height of sparklines to generate (requires PSparkines module). Default: 1.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: 1
Accept pipeline input: False
Accept wildcard characters: FalseSwitch: Include values for the previous billing month and adds additional properties that compare the current month to the previous.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: ComparePrev
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseThe number of months prior you want to compare the current billing month to, when using -ComparePrevious, e.g set to 3 to compare to 3 months prior.
Type: Int32
Parameter Sets: (All)
Aliases: ComparePrevOffset
Required: False
Position: 5
Default value: 0
Accept pipeline input: False
Accept wildcard characters: FalseSwitch: Do not generate/include Sparklines in the output.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSwitch: Include the raw cost consumption data as a property on the returned object.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSwitch: Force use of alternative consumption collection script for Enterprise Agreement subscriptions.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSpecify the kind of Enterprise Agreement, modern or legacy. Default: modern.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: Modern
Accept pipeline input: False
Accept wildcard characters: False{{Fill ProgressAction Description}}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).