-
Notifications
You must be signed in to change notification settings - Fork 273
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
Usagesummary.ps1 does not properly handle [DateTime] variants for StartTime/EndTime #609
Comments
To me the error is correct, as it requires a certain format :-) the format provided does not match :-) but maybe I am missing something? |
@cblackuk I have added more context above. |
I just realised that I use a completely custom version of all this and for 129 we run for example Get-AzsSubscriberUsage -ReportedStartTime (Get-Date (Get-Date).AddDays(-1) -Format "MM/dd/yyyy") -ReportedEndTime (Get-Date -Format "MM/dd/yyyy") |
The cmdlet itself only validates on [DateTime] [OutputType([Microsoft.AzureStack.Management.Commerce.Admin.Models.UsageAggregate])]
[CmdletBinding()]
param(
[Parameter(Mandatory = $false)]
[System.String]
$SubscriberId,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.DateTime]
$ReportedStartTime,
[Parameter(Mandatory = $false)]
[System.String]
[ValidateSet("Daily", "Hourly")]
$AggregationGranularity,
[Parameter(Mandatory = $false)]
[int]
$Skip = -1,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.DateTime]
$ReportedEndTime,
[Parameter(Mandatory = $false)]
[System.String]
$ContinuationToken,
[Parameter(Mandatory = $false)]
[int]
$Top = -1
) Or to be more accurate on [DateTime] and not being empty and being provided: [Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.DateTime]
$ReportedStartTime,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.DateTime]
$ReportedEndTime,
So if one works and the other one does not - it must be something to do with ARM post update? |
@easyveazie For laughs... what if you pass to it this instead? 2021-20-05 |
Issue was reported on stamp version 2005, however the report generates on 2002 stamp properly with the same inputs.
Ask: Validate Usagesummary.ps1 on stamp versions > 2002. I have not tested this yet.
https://github.com/Azure/AzureStack-Tools/blob/master/Usage/Usagesummary.ps1
Switching line 129 to this and it works:
The text was updated successfully, but these errors were encountered: