Azure / Azure/AzureStack-Tools

Usagesummary.ps1 does not properly handle [DateTime] variants for StartTime/EndTime

未关闭
#609 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
PowerShell
星标
260
派生
283
平均合并
2 小时 11 分钟
30 天内合并 PR
1

描述

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

```
PS C:\Users\vmadmin\Documents> .\usagesummary.ps1
cmdlet usagesummary.ps1 at command pipeline position 1
Supply values for the following parameters:
StartTime: 2021-05-20
EndTime: 2021-06-01
Get-AzsSubscriberUsage : The reported date time '2021-05-20T00:00:00.0000000 00:00' is not in ISO 8601 format(YYYY-MM-DDTHH:mm:ss.sssZ).
At C:\Users\vmadmin\Documents\usagesummary.ps1:129 char:1
+ $result = Get-AzsSubscriberUsage -ReportedStartTime ("{0:yyyy-MM-ddT0 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ({ SubscriptionI...ationToken = }:<>f__AnonymousType0`6) [Get-AzsSubscriberUsage_List], UndeclaredResponseException
+ FullyQualifiedErrorId : BadRequest,Microsoft.Azure.PowerShell.Cmdlets.CommerceAdmin.Cmdlets.GetAzsSubscriberUsage_List
```

Switching line 129 to this and it works:
```
$result = Get-AzsSubscriberUsage -ReportedStartTime $StartTime -ReportedEndTime $EndTime -AggregationGranularity $Granularity
```

贡献指南

打开贡献指南

调研方向

Start with Usage/Usagesummary.ps1, especially line 129, and reproduce the report using the supplied StartTime and EndTime values on stamp versions greater than 2002. Compare the DateTime values passed to Get-AzsSubscriberUsage with the ISO 8601 error; done means the usage report generates without that validation failure.

由索引模型根据 Issue 内容生成。

评估

技术栈
powershell
领域
cloud, tooling
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。