Azure / Azure/AzureStack-Tools
Usagesummary.ps1 does not properly handle [DateTime] variants for StartTime/EndTime
- Lingua principale
- PowerShell
- Stelle
- 260
- Fork
- 283
- Merge medio
- 2h 11m
- PR unite (30g)
- 1
Descrizione
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
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con Usage/Usagesummary.ps1, in particolare dalla riga 129, e riproduci il report utilizzando i valori StartTime e EndTime forniti su versioni di stamp successive al 2002. Confronta i valori DateTime passati a Get-AzsSubscriberUsage con l'errore ISO 8601; il lavoro è completato quando il report di utilizzo viene generato senza questo errore di convalida.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- powershell
- Ambito
- cloud, tooling
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100