Skip to content

Conversation

@Matt-Westphal
Copy link
Contributor

This command will get the usage data for a subscription.

Also added a script to verify the module works as expected

The test is marked as skipped since I can get the test framework to start after working at it for 4 days.

@azurecla
Copy link

Hi @Matt-Westphal, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.azure.com.

TTYL, AZPRBOT;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not check in files with hardcoded paths

@markcowl
Copy link
Member

This PR should also include: (1) Updated installer that includes your files (use the BuildInstaller script in the Tools folder); (2) dll help file; (3) Changes to changelog.txt describing your new cmdlet

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ReportedStartTime and ReportedEndTime and not just StartTime and EndTime?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With usage data there is multiple uses of DateTime. Reported vs when the usage was consumed. which is a critical distinction to make sure they consumers have all the data they need. Also this is consistent with output of the billing data from the Azure system

@markcowl
Copy link
Member

@azuresdkci retest this please

@Matt-Westphal
Copy link
Contributor Author

Where can I find some documentation or any idea where/how to do these? Would have included them if I had known they needed to be done.

From: Mark Cowlishaw [mailto:[email protected]]
Sent: Friday, June 19, 2015 1:47 PM
To: Azure/azure-powershell
Cc: Matt Westphal
Subject: Re: [azure-powershell] New CmdLet to get UsageAggregates (#517)

This PR should also include: (1) Updated installer that includes your files (use the BuildInstaller script in the Tools folder); (2) dll help file; (3) Changes to changelog.txt describing your new cmdlet


Reply to this email directly or view it on GitHubhttps://github.com//pull/517#issuecomment-113638458.

@hovsepm
Copy link
Contributor

hovsepm commented Jun 20, 2015

please pull from upstream and resolve conflicts.

hovsepm pushed a commit that referenced this pull request Jun 20, 2015
New CmdLet to get UsageAggregates
@hovsepm hovsepm merged commit bd685f0 into Azure:dev Jun 20, 2015
@pmsousa
Copy link

pmsousa commented Sep 11, 2015

Hi,
I think I might have found a bug. When calling the cmdlet Get-UsageAggregates I get a error message:

Get-UsageAggregates -ReportedStartTime "2015-08-20" -ReportedEndTime "2015-08-21" -Debug

Get-UsageAggregates : The request is invalid.
At line:1 char:1
+ Get-UsageAggregates -ReportedStartTime "2015-08-20" -ReportedEndTime  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-UsageAggregates], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.UsageAggregates.GetUsageAggregatesCommand

I thought the problem could have been with the date format,so I've tried several different ways: dd/mm/yyyy, yyyy/mm/dd, etc. Always the same result.

Finally, I've used the -debug flag and these were my findings:

DEBUG: [Common.Authentication]: Checking token expiration, token expires '09/11/2015 16:00:27 +00:00' Comparing to '09/11/2015 15:04:10 +00:
00' With threshold '00:05:00', calculated time until token expiry: '00:56:16.8425779'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/{SUBSCRIPTIONID}/providers/Microsoft.Commerce/UsageAggregates?api-version=201
5-06-01-preview&reportedstartTime=20%2F08%2F2015 00:00:00&reportedEndTime=21%2F08%2F2015 00:00:00,&showDetails=true&aggregationGranularity=D
aily

Headers:

Body:



DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Pragma                        : no-cache
x-ms-ratelimit-remaining-subscription-reads: 14998
x-ms-request-id               : e5e62bf5-d2a3-4604-aa59-23652c33613c
x-ms-correlation-request-id   : e5e62bf5-d2a3-4604-aa59-23652c33613c
x-ms-routing-request-id       : NORTHEUROPE:20150911T150411Z:e5e62bf5-d2a3-4604-aa59-23652c33613c
Strict-Transport-Security     : max-age=31536000; includeSubDomains
Cache-Control                 : no-cache
Date                          : Fri, 11 Sep 2015 15:04:11 GMT
Server                        : Microsoft-IIS/8.0
X-AspNet-Version              : 4.0.30319
X-Powered-By                  : ASP.NET

Body:
{
  "message": "The request is invalid."
}

If you note the URI, the reportedstartTime and reportedEndTime fields have spaces between the date and time; I think theses should be URL Encoded or set to ShortDate format!

PS: I've replaced my subscription ID with the text {SUBSCRIPTIONID}

huangpf added a commit to AzureRT/azure-powershell that referenced this pull request Apr 28, 2016
HPF PR: dev <- Azure:dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants