Giter VIP home page Giter VIP logo

azureusageandbillingportal's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azureusageandbillingportal's Issues

Values from API differs from CSV from EA Portal

Hi,
I have a customer (EA) using this solution. He is having an issue where the consumed quantity and the cost does not match the ones that he downloads from the ea portal (CSV) now he does not know witch source is the truth.

01/01/2017 /subscriptions/0ac189eb-cc05-44d0-98e8-b3551ebe323b/resourceGroups/BRAZU1VALERS008/providers/Microsoft.Web/serverfarms/BRAZU1VALEAP002CPlan
Extended Cost Consumed Quantity
API Azure 6,8317 27,998599
CSV Customer Portal 4,775138585 27,998599

26/01/2017 /subscriptions/aa5cf01a-b37b-4f48-8a1f-6712ba6511a2/resourceGroups/POC_TELEMETRIA/providers/microsoft.documentdb/databaseaccounts/docdbtelemetriaveiculo
Extended Cost Consumed Quantity
API Azure 40,32 5040
CSV Customer Portal 21,26738879 2520

26/01/2017 /subscriptions/4f3a3475-f736-43a2-9195-88ccfbd3db07/resourceGroups/BRAZU1VALERS036/providers/Microsoft.Compute/virtualMachines/BRAZU1VALEAS046
Extended Cost Consumed Quantity
API Azure 27,936 48
CSV Customer Portal 10,098747 24

Please expand on "customize default settings, service names etc."

In Documentation/HOWTO.md, it states: "It is strongly advised that you browse the inline comments and change variable values in “CreateAzureServicesScript.ps1” file to customize default settings, service names etc. that will be created. ".

The script itself is very light on comments, so I really have no idea even what entries I am supposed to be changing, let alone what I should be changing them to? Almost all of the code for what I assume are parameters have no relevant comment at all.

For example, one line is: $SQLServerVersion = "2.0"
Am I meant to change that? To what?

There seems to be an assumption of Azure Powershell expertise - I've been using Azure successfully for several years and never needed to use it before this project. I don't really have any interest in learning Azure Powershell - I'm sure it's great and all, but I just want to get this project running.

Error in CreateAzureServicesScript.ps1 - invalid JSON template deployment

Following the instructions in the video, when I run the ps1 file after changing the name of the subscription, I get:

VERBOSE:

 Performing the operation "Creating Deployment" on target "aui-resource-group20".
New-AzureRmResourceGroupDeployment : 3:51:00 PM - Error: Code=InvalidTemplateDeployment; Message=The template
deployment 'CreateAzureServicesScriptResources' is not valid according to the validation procedure. The tracking id is
'5ef3ec4a-7c14-41eb-8bd2-5bd19b249eb4'. See inner errors for details. Please see https://aka.ms/arm-deploy for usage
details.
At .\CreateAzureServicesScript.ps1:107 char:1
+ New-AzureRmResourceGroupDeployment -ResourceGroupName $ResourceGroupN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDep
   loymentCmdlet

PS script error: The subscription is not registered for the resource type 'components' in the location 'West US'

I get the following error running the script: CreateAzureServicesScript.ps1. What should I do?

New-AzureRmResourceGroupDeployment : 6:18:58 PM - Resource Microsoft.Insights/components 'auiregistrationmangasolutions' failed with
message '{
"error": {
"code": "MissingRegistrationForLocation",
"message": "The subscription is not registered for the resource type 'components' in the location 'West US'. Please re-register for
this provider in order to have access to this location."
}
}'
At line:101 char:1

  • New-AzureRmResourceGroupDeployment -ResourceGroupName $ResouceGroupNa ...
  • - CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
    - FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
    

Does this tools support azure sponsorship subscription ?

I come across several website suggestion with same issue, "How to show billing on resource group level from Azure billing".

This tools seem very useful, before I go deep into it, quick question here, can it get the billing on RG level, even detail into specific apps service billing?

AADSTS90002 when trying to register a subscription

The subscription where I publish the AUI App it's registered ok, but if I try to add another subscription I get the error:

Correlation ID: 279aac69-2cb7-47c4-9031-7d54da9ca3bb
Timestamp: 2017-04-12 17:36:01Z
AADSTS90002: Requested tenant identifier '00000000-0000-0000-0000-000000000000' is not valid. Tenant identifiers may not be an empty GUID.

Regards.

Visual Studio Build Errors

I have deployed all the resources into Azure and have edited the AUI Solution file in Visual Studio. When I try to Rebuild the solution, I get a bunch of errors and warnings.

I am by no means a Developer so I'm not sure what to do about these issues. I'm wondering if anyone else has seen these and has an idea about how to fix it.

Also, I came across issues where the Storage Account key wouldn't appear in the output and even the Client ID wouldn't come up either (I'm assuming that's just the subscription ID).

aubp

Unable to view Tags

I would like to be able to sort and report on tags that I have on my resources. At this time Tags are not written to the DB.

It would seem a security risk to bury a password on line 114 of the PS script?

I noticed that line 114 of the Scripts/CreateAzureServicesScript.ps1 file currently reads:

$passwordADApp = "Password.1%"

I'm no Azure PS guru, but I'm presuming this would create something (an Azure AD app?) using that password. As it is quite buried, many people will miss it when they review this script, which would presumably create a security risk?

Should that line be moved up to the top of the script, in the parameters section?

Database is empty

Hi,
My database is showing empty. The dashboard shows (attached screenshot) that the subscriptions are being monitored but it's not pulling any data. As seen in the second screenshot, the table shows empty in PowerBi. Could this be a permission issue?

aubi2
aubi1

SqlScripts.sql

In "SqlScripts.sql" script I suggest changing:
CREATE PROCEDURE InsertUsageRecord
to:
CREATE PROCEDURE dbo.InsertUsageRecord
I am uncertain if that is why this procedure did not create initially.

Issue with CSP subcription cost receiving

I have some Azure subscriptions monitored. And I have only issue with Azure CSP subscription cost receiving. It is in pending status. The error in WebJobBillingData is the following. How to retrieve costs for CSP.

WebJobBillingData.exe Information: 0 : Azure WebJob Log Writer configured
WebJobBillingData.exe Information: 0 : WebJob process started. SubscriptionId: cb538d2f-868a-4b22-a7bf-5688ed137dc2
WebJobBillingData.exe Information: 0 : Start time:6/11/2017 9:00:37 PM, retries Left: 2
WebJobBillingData.exe Information: 0 : Request cost info from RateCard service.
WebJobBillingData.exe Warning: 0 : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WebJobBillingData.exe Warning: 0 : httpWebResponse == null
WebJobBillingData.exe Warning: 0 : GetRateCardInfo(restUrl, orgId)
WebJobBillingData.exe Warning: 0 : restUrl: https://management.azure.com/subscriptions/cb538d2f-868a-4b22-a7bf-5688ed137dc2/providers/Microsoft.Commerce/RateCard?api-version=2015-06-01-preview&$filter=OfferDurableId eq 'MS-AZR-0003P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'
WebJobBillingData.exe Warning: 0 : orgId: 7441e116-ef50-4bf6-a98f-1fa0671ccfb5
WebJobBillingData.exe Warning: 0 : Problem receiving cost info occured - see log for details.
WebJobBillingData.exe Information: 0 : Start time:6/11/2017 9:00:38 PM, retries Left: 1
WebJobBillingData.exe Information: 0 : Request cost info from RateCard service.
WebJobBillingData.exe Warning: 0 : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WebJobBillingData.exe Warning: 0 : httpWebResponse == null
WebJobBillingData.exe Warning: 0 : GetRateCardInfo(restUrl, orgId)
WebJobBillingData.exe Warning: 0 : restUrl: https://management.azure.com/subscriptions/cb538d2f-868a-4b22-a7bf-5688ed137dc2/providers/Microsoft.Commerce/RateCard?api-version=2015-06-01-preview&$filter=OfferDurableId eq 'MS-AZR-0003P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'
WebJobBillingData.exe Warning: 0 : orgId: 7441e116-ef50-4bf6-a98f-1fa0671ccfb5
WebJobBillingData.exe Warning: 0 : Problem receiving cost info occured - see log for details.
WebJobBillingData.exe Information: 0 : Finished internal retries, time:6/11/2017 9:00:38 PM

query editor empty when refresh preview

Hi all
I done all the steps mentionned in the channel9 setup video. and just after importing the .pbix file and set credentials + connection string, the table is empty when I click on REFRESH PREVIEWW button. do you see what is going on ? :(

when I check the SQL DB through MGMT studio all tables of the database are empty, is it normal ? so you see what is happening ? if you have an idea I would really appreciate ! thanks a lot for your feedback

WebJobBillingData.Functions.ProcessQueueMessage() method code defect

In case of exception in GetRateCardInfo() method called from WebJobBillingData.Functions.ProcessQueueMessage() returned null value is not handled causing meaningless "Object reference not set" exception. Suggested change:

RateCardPayload rateCardInfo = GetRateCardInfo(rateCardURL, br.OrganizationId);

if (rateCardInfo == null) {
    Console.WriteLine("Problem receiving cost info occured - see log for details.");
    continue;
} else {
    Console.WriteLine("Received cost info: " + rateCardInfo.ToString());
}

Documentation: Currency, Locale and RegionInfo

I would even better emphasize configuration Currency, Locale and RegionInfo must match. That is, regardless of the actual subscription details.

Our enterprise subscription was purchased (I believe) in Switzerland but is billed in Euro.
Such combination is invalid. However, CHF currency does not cause errors. Similarly, I am able to request EUR currency providing any country using this currency.

I am not convinced authors of API had clear design idea. See:
https://msdn.microsoft.com/en-us/library/azure/mt219004.aspx

403 forbidden

Once I click 'allow monitoring' on my subscription I get a 403 forbidden error below.

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

[WebException: The remote server returned an error: (403) Forbidden.]
   System.Net.HttpWebRequest.GetResponse() +1390
   Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync(RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) +1016

[StorageException: The remote server returned an error: (403) Forbidden.]
   Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync(RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) +4184
   Microsoft.WindowsAzure.Storage.Queue.CloudQueue.Exists(Boolean primaryOnly, QueueRequestOptions options, OperationContext operationContext) +94
   Microsoft.WindowsAzure.Storage.Queue.CloudQueue.CreateIfNotExists(QueueRequestOptions options, OperationContext operationContext) +79
   Registration.Controllers.HomeController.Connect(Subscription subscription, String servicePrincipalObjectId, String displayTag) +554
   lambda_method(Closure , ControllerBase , Object[] ) +193
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +157
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +50
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +26
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36
   System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +22
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9644037
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Then I go back and refresh the page, and it would show that it is being monitored.

Yes, monitoring.

CreateAzureServicesScript.ps1 failing - workaround

I found that I had to make the following changes around line 100 to get the script to run. Also found that the script didn't display my access token (I got from Azure portal)

#web1SiteName = $Web1SiteName;
registrationWebSiteName = $Web1SiteName;

#web2SiteName = $Web2SiteName;
dashboardWebSiteName = $Web2SiteName;

Error When Trying To Monitor Susbcription - Reg Portal

Steps

  1. Open Reg Portal and log in using work/corporate login etc
  2. Enter friendly name and then click allow monitoring

Expected Result
Opens success page

Actual Result:
Throws error..

The remote server returned an error: (403) Forbidden.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The remote server returned an error: (403) Forbidden.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[WebException: The remote server returned an error: (403) Forbidden.]
System.Net.HttpWebRequest.GetResponse() +1390
Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync(RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) +1016

[StorageException: The remote server returned an error: (403) Forbidden.]
Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync(RESTCommand1 cmd, IRetryPolicy policy, OperationContext operationContext) +4184 Microsoft.WindowsAzure.Storage.Queue.CloudQueue.Exists(Boolean primaryOnly, QueueRequestOptions options, OperationContext operationContext) +94 Microsoft.WindowsAzure.Storage.Queue.CloudQueue.CreateIfNotExists(QueueRequestOptions options, OperationContext operationContext) +79 Registration.Controllers.HomeController.Connect(Subscription subscription, String servicePrincipalObjectId, String displayTag) +551 lambda_method(Closure , ControllerBase , Object[] ) +193 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +157
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +27 System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22 System.Web.Mvc.Async.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32 System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +50 System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225 System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34 System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +26 System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100 System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27 System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36 System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +22
System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10 System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9644037
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Other notes.

  • If I refresh reg portal it is listed.
  • If I login into dashboard it is listed but it never collects data always pending (looks like web job never gets the message to run the collection etc)

Given the cost impact, should the SQL Edition etc parameters be made more obvious?

Buried on lines 89 and 91 of the script are these lines:

sqlEdition = "Standard"

...
sqlRequestedServiceObjectiveName = "S0";

From what I have observed, these result in a cost impact to anyone running the script, who did not understand the meaning of those lines. A SQL Standard S0 instance is currently around $15/month.

Should those parameters be made more obvious (e.g. moved to the top of the script) and commented to that effect?

Exception Details: Failed to refresh access token

Hello,
I get the error below during registration. Thanks.

Error.
An error occurred while processing your request.
Exception Details: Failed to refresh access token

Update: The app in Azure AD wasn't configured properly.

PowerBI chart errors

I'm using the Azure Usage Insights V2.0 dashboard.
But get an eror on all the charts, except the chart that lists the subscription

Error: something's wrong with one or more fields (AzureUsageRecords) usageStartTime.

Any idea?
All data is available in the table. Enable load is enabled on the query.
I followed the setup instructions exactly.

Cannot register, even with administrative account

Hello, when I try to register another organization subscription, using Work or school account, I get this error:
Azure Usage and Billing Insights - Registration v8408a99400 needs permission to access resources in your organization that only an admin can grant. Please ask an admin to grant permission to this app before you can use it.

I am trying to register using an administrative account of the other organization. What may be the cause?

Power BI Dashboard Won't Populate

The Power BI Dashboard file doesn't appear to be connecting properly to the database.

After having set the connecting string correctly and seeing data populate into the Advanced Query Editor I am not getting any data in the Dashboard objects, there is also no Fields available to me to select and the refresh button is grayed out.

I copied the connecting string query into a new Power BI file and I was able to refresh the data and I have Fields to select from.

Is it possible there is some compatibility issue with the version of Power BI Desktop that was used to create the file initially?

AzureWebJobsDashboard and AzureWebJobsStorage doesnt show key

In the version of azure Powershell 1.4 to get the specific key you need to append .Value[0] instead of .key1 like it says in line 156 and 158 of /Scripts/CreateAzureServicesScript.ps1

The result is that AzureWebJobsDashboard and AzureWebJobsStorage ends after AzureWebJobsDashboard: DefaultEndpointsProtocol=https;AccountName=XXXXXX;AccountKey=

and after the change to value[0] appends the AccountKey Value.
it's solved but i want to let you know so if somebody has this problem it can solve it(or the change can be made to the script)

this is the resulting code:
(Get-AzureRmStorageAccountKey -Name $StorageAccountName -ResourceGroupName $ResourceGroupName).Value[0]

CreateAzureServicesScript.ps1 error - Get-AzureRmStorageAccountKey : Cannot validate argument on parameter 'ResourceGroupName'.

I'm getting this error from the PS Script:

Get-AzureRmStorageAccountKey : Cannot validate argument on parameter 'ResourceGroupName'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command 
again.
At C:\Dev\AzureUsageAndBillingPortal-master\Scripts\CreateAzureServicesScript.ps1:121 char:89
+ ... ourceGroupName $ResourceGroupName
+                    ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Get-AzureRmStorageAccountKey], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountKeyCommand


Any idea what might be wrong?

Earlier on I noticed this warning - maybe it is related?

CurrentStorageAccount : 

WARNING: Unable to acquire token for tenant ...

CreateAzureServicesScript.ps1 issues

It seems that currently the only supported location is "Central US".
If any other location is specified "Application Insights" setup will error out.

In the last script part AzureWebJobsDashboard and AzureWebJobsStorage AccountKeys do not show up.

Unable to register subscriptions using Organizational Account

I have this tool successfully setup and I am able to register new subscriptions using an MSA, however the below line fails in the GetUserSubscriptions method in AzureResourceManagerUtils

AuthenticationResult result = authContext.AcquireTokenSilent(ConfigurationManager.AppSettings["ida:AzureResourceManagerIdentifier"],
credential, new UserIdentifier(signedInUserUniqueName, UserIdentifierType.RequiredDisplayableId));

The exception message that is received states "Failed to acquire token silently. Call method AcquireToken", to which I have changed the above method to do. It no longer fails on that point, however it also is unable to return back the list of available subscriptions for the logged in user, despite returning three Organizations that each have subscriptions in them.

Has anyone else experienced a similar issue?

Not able to register subscription using "Work or School" option (Organizational Account)

Hi
I followed all the steps in the video . But Im getting error at the second to last step which requires you to register your subscription in the system.
When i hit the register url and login using the "work or school" account option , it throws the following exception.

"Error.
An error occurred while processing your request.
Exception Details: Failed to acquire token silently. Call method AcquireToken"

I saw in the issues that someone else is having the same problem. Kindly provide a solution for it.

Problem in DataGenStatus

I have completed all the process without problems but at the end in the dashboard website the data generation status is always Pending as you can see in the following picture because of this there are tables of power bi that are empty like AzureUsageRecords, ReportRequests and Reports. Does anyone know why this problem is caused? Thank you very much and I hope your answer.
image

How to change to different currency

it seems the PowerBI only show USD , if I can change to other currency ?

if just need to change config here?
WebJobBillingData\App.config

<add key="ida:Authority" value="https://login.microsoftonline.com/{0}/" />
<add key="ida:AzureResourceManagerIdentifier" value="https://management.core.windows.net/" />
<add key="ida:OfferCode" value="MS-AZR-0003P"/>
<add key="ida:Currency" value="USD"/>
<add key="ida:Locale" value="en-US"/>
<add key="ida:RegionInfo" value="US"/>   

Power BI

Subscription #, Min Date, Max Date do not render.

Error : The 'ASQLConn-Web.config Connection String' argument cannot be null or empty.

When following the video and publishing the two webjobs, the output in VS shows the below error:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets(4295,5): Error : The 'ASQLConn-Web.config Connection String' argument cannot be null or empty.

You'll notice that in the video, it actually shows the same error too (right beneath the Successfully built message and when it is starting to do its publish step of the process)

Is this harmless? I'm not getting any data in the sql table at the moment so trying to look for the culprit, and am wondering what error is causing it (there could be multiple).
I'm seeing that 403 forbidden error posted in the other Issue thread by two other people on here, so that could be part of the reason too.
The ARM script didn't give any errors but I noticed the AccountKey= part of my storage string is empty unlike in the video, and I noticed the storage account doesn't have any queues created in it (Not sure which of the components is supposed to create that-- if its from one of the webjobs then I guess its because it is not being published..)

Any help you can give is appreciated!

AADSTS70001 when trying to register another subscriptio

Situation:
Deployed AUBI Portal on a MSDN Subscription. Portal works fine. Can register the subscription to AUBI that is also used for the hosting of the portal itself.

Error:
When trying to register another subscription I get AADSTS70001. This is a pay as you go subscription in another tenant. Also I can not register another subscription from an EA account.

image

Exception while getting rate card

I get following exception while getting rate card. Does one has an idea?

[01/24/2017 20:52:22 > 9c3c12: INFO] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

[01/24/2017 20:52:22 > 9c3c12: INFO] httpWebResponse == null

[01/24/2017 20:52:22 > 9c3c12: INFO] GetRateCardInfo(string restURL, string orgID)

[01/24/2017 20:52:22 > 9c3c12: INFO] restURL: https://management.azure.com/subscriptions/{SubscriptionId}/providers/Microsoft.Commerce/RateCard?api-version=2015-06-01-preview&$filter=OfferDurableId eq 'MS-AZR-0145P' and Currency eq 'CHF' and Locale eq 'de-CH' and RegionInfo eq 'CH'

[01/24/2017 20:52:22 > 9c3c12: INFO] orgID: 6e4a5bc6-ae41-41b7-912b-74c16e3d7b61

[01/24/2017 20:52:22 > 9c3c12: INFO] Problem receiving cost info occured - see log for details.

[01/24/2017 20:52:22 > 9c3c12: INFO] Start time:1/24/2017 8:52:22 PM Retries Left: 1

[01/24/2017 20:52:22 > 9c3c12: INFO] Request cost info from RateCard service.

[01/24/2017 20:52:22 > 9c3c12: INFO] Exception: RateCardRestApiCall->e.message: The remote server returned an error: (400) Bad Request.

[01/24/2017 20:52:22 > 9c3c12: INFO] Response content: {"error":{"code":"DisallowedProvider","message":"The operation is not permitted for namespace 'Microsoft.Commerce'. List of permitted provider namespaces is '84codes.CloudAMQP,AppDynamics.APM,Aspera.Transfers,Auth0.Cloud,Citrix.Cloud,Citrix.Services,Cloudyn.Analytics,Conexlink.MyCloudIT,Crypteron.DataSecurity,Dynatrace.DynatraceSaaS,Dynatrace.Ruxit,Hive.Streaming,Incapsula.Waf,LiveArena.Broadcast,Lombiq.DotNest,Mailjet.Email,Microsoft.ADHybridHealthService,Microsoft.Advisor,Microsoft.ApiManagement,Microsoft.AppService,Microsoft.Authorization,Microsoft.Automation,Microsoft.Backup,Microsoft.Batch,Microsoft.BingMaps,Microsoft.Cache,Microsoft.Cdn,Microsoft.CognitiveServices,Microsoft.Compute,Microsoft.ContainerService,Microsoft.ContentModerator,Microsoft.DataCatalog,Microsoft.DataFactory,Microsoft.DataLakeAnalytics,Microsoft.DataLakeStore,Microsoft.Devices,Microsoft.DevTestLab,Microsoft.DocumentDB,Microsoft.EventHub,Microsoft.Features,Microsoft.HDInsight,Microsoft.ImportExport,microsoft.insights,Microsoft.KeyVault,Microsoft.Logic,Microsoft.MachineLearning,Microsoft.MarketplaceOrdering,Microsoft.Media,Microsoft.Network,Microsoft.NotificationHubs,Microsoft.OperationalInsights,Microsoft.OperationsManagement,Microsoft.Portal,Microsoft.PowerBI,Microsoft.RecoveryServices,Microsoft.ResourceHealth,Microsoft.Resources,Microsoft.Scheduler,Microsoft.Search,Microsoft.Security,Microsoft.ServerManagement,Microsoft.ServiceBus,Microsoft.ServiceFabric,Microsoft.SiteRecovery,Microsoft.Sql,Microsoft.Storage,Microsoft.StorSimple,Microsoft.StreamAnalytics,microsoft.support,Microsoft.Web,Myget.PackageManagement,Paraleap.CloudMonix,Pokitdok.Platform,RavenHq.Db,Raygun.CrashReporting,RedisLabs.Memcached,RedisLabs.Redis,RevAPM.MobileCDN,Sendgrid.Email,Signiant.Flight,Sparkpost.Basic,stackify.retrace,SuccessBricks.ClearDB,TrendMicro.DeepSecurity,U2uconsult.TheIdentityHub'."}}

[01/24/2017 20:52:22 > 9c3c12: INFO] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Error: DisallowedProvider - The operation is not permitted for namespace 'Microsoft.Commerce'

Hi,
I installed Aubi and it works fine. However, if I add a subscription coming from the Partner Center or from
CSP (Cloud Solution Provider), I got error
When the webjob is executing GetRateCardInfo, I got an Error.

"error":{"code":"DisallowedProvider","message":"The operation is not permitted for namespace 'Microsoft.Commerce'

Any workaround? hint? soluiton?

Thanks.

Unable to create SQL server

Hi,

When I am running the script “CreateAzureServicesScript.ps1” I am getting following error message:

`New-AzureRmResourceGroupDeployment : 15:18:39 - Resource Microsoft.Sql/servers 'auisqlsr5' failed with message {
"code": "45122",
"message": "''",
"target": null,
"details": [
{
"code": "45122",
"message": "''",
"target": null,
"severity": "16"
}
],
"innererror": []
}
At D:\AzureUsageAndBillingPortal-master\Scripts\CreateAzureServicesScript.ps1:107 char:1

  • New-AzureRmResourceGroupDeployment -ResourceGroupName $ResourceGroupN ...
  •   + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet`
    
    

I was trying to change the Resource Group location but the issue still persist.

Calculation of resources comes with duplicate fields

Calculation of resources comes with duplicate fields. The first filling of the base of the billing information is correct. The following days are with duplicates

Example data from base (after 28.08.2016 is incorrect data):
name subscriptionId usageStartTime usageEndTime meterId meteredService quantity unit meterName cost
Daily_BRSDT_20130831_0000 494ea534-xxxx-xxxx-xxxx-9a8870a11655 24.08.2016 0:00 25.08.2016 0:00 1b4d8861-8cbc-40c8-88f9-e1b78509c3be Compute 24 Hours Compute Hours 2.16
Daily_BRSDT_20130831_0000 494ea534-xxxx-xxxx-xxxx-9a8870a11655 25.08.2016 0:00 26.08.2016 0:00 1b4d8861-8cbc-40c8-88f9-e1b78509c3be Compute 24 Hours Compute Hours 2.16
Daily_BRSDT_20130831_0000 494ea534-xxxx-xxxx-xxxx-9a8870a11655 26.08.2016 0:00 27.08.2016 0:00 1b4d8861-8cbc-40c8-88f9-e1b78509c3be Compute 24 Hours Compute Hours 2.16
Daily_BRSDT_20130831_0000 494ea534-xxxx-xxxx-xxxx-9a8870a11655 27.08.2016 0:00 28.08.2016 0:00 1b4d8861-8cbc-40c8-88f9-e1b78509c3be Compute 24 Hours Compute Hours 2.16
Daily_BRSDT_20130831_0000 494ea534-xxxx-xxxx-xxxx-9a8870a11655 28.08.2016 0:00 29.08.2016 0:00 1b4d8861-8cbc-40c8-88f9-e1b78509c3be Compute 24 Hours Compute Hours 2.16
Daily_BRSDT_20160829_0000 494ea534-xxxx-xxxx-xxxx-9a8870a11655 28.08.2016 0:00 29.08.2016 0:00 1b4d8861-8cbc-40c8-88f9-e1b78509c3be Compute 9 Hours Compute Hours 0.81
Daily_BRSDT_20160830_0000 494ea534-xxxx-xxxx-xxxx-9a8870a11655 29.08.2016 0:00 30.08.2016 0:00 1b4d8861-8cbc-40c8-88f9-e1b78509c3be Compute 9 Hours Compute Hours 0.81
Daily_BRSDT_20130831_0000 494ea534-xxxx-xxxx-xxxx-9a8870a11655 29.08.2016 0:00 30.08.2016 0:00 1b4d8861-8cbc-40c8-88f9-e1b78509c3be Compute 14.883351 Hours Compute Hours 1.3395
Daily_BRSDT_20160829_0000 494ea534-xxxx-xxxx-xxxx-9a8870a11655 29.08.2016 0:00 30.08.2016 0:00 1b4d8861-8cbc-40c8-88f9-e1b78509c3be Compute 23.883351 Hours Compute Hours 2.1495
Daily_BRSDT_20160830_0000 494ea534-xxxx-xxxx-xxxx-9a8870a11655 30.08.2016 0:00 31.08.2016 0:00 1b4d8861-8cbc-40c8-88f9-e1b78509c3be Compute 24 Hours Compute Hours 2.16
Daily_BRSDT_20160829_0000 494ea534-xxxx-xxxx-xxxx-9a8870a11655 30.08.2016 0:00 31.08.2016 0:00 1b4d8861-8cbc-40c8-88f9-e1b78509c3be Compute 15 Hours Compute Hours 1.35
Daily_BRSDT_20160831_0000 494ea534-xxxx-xxxx-xxxx-9a8870a11655 30.08.2016 0:00 31.08.2016 0:00 1b4d8861-8cbc-40c8-88f9-e1b78509c3be Compute 9 Hours Compute Hours 0.81
Daily_BRSDT_20160831_0000 494ea534-xxxx-xxxx-xxxx-9a8870a11655 31.08.2016 0:00 01.09.2016 0:00 1b4d8861-8cbc-40c8-88f9-e1b78509c3be Compute 24 Hours Compute Hours 2.16
Daily_BRSDT_20160830_0000 494ea534-xxxx-xxxx-xxxx-9a8870a11655 31.08.2016 0:00 01.09.2016 0:00 1b4d8861-8cbc-40c8-88f9-e1b78509c3be Compute 16 Hours Compute Hours 1.44
Daily_BRSDT_20160831_0000 494ea534-xxxx-xxxx-xxxx-9a8870a11655 01.09.2016 0:00 02.09.2016 0:00 1b4d8861-8cbc-40c8-88f9-e1b78509c3be Compute 15 Hours Compute Hours 1.35

My temporary solution is

WebJobUsageDaily/Program.cs

  • DateTime sdt = DateTime.Now.AddDays(-2);

    52 + DateTime sdt = DateTime.Now.AddDays(-1);

WebJobBillingData billingRequest 'StartDate' and 'EndDate' holds initial values

Hi,

I've got an issue with the billingRequest in the BillingData Webjob. The StartDate and EndDate won't update to the latest available dates. On July 11th 2017, the webjob ran for the first time and the StartDate was set to July 9th 2017 and the EndDate to July 11th 2017.

But since then, it won't update the Start and EndDate, so it keeps getting data for that initial date range.

An additional problem is that the webjob keeps inserting new rows to the database. The database contains at this moment 140.000+ usage rows, while there are only 600 unique ones.

Does anyone has a solution to fix these problems?

Thanks in advance!

Daandm

Error in WebJobUsageDaily ?

Hello,

I have an error in the WebJobUsageDaily Job. You can find the log of this webjob below.

Could you please help me treat this problem ?

Thanks in advanced,

Best regards,

Cao

[06/01/2017 14:35:24 > 85aa8c: SYS INFO] Status changed to Running
[06/01/2017 14:35:24 > 85aa8c: INFO] WebJobUsageDaily.exe Information: 0 : *************************************************************************
[06/01/2017 14:35:24 > 85aa8c: INFO] WebJobUsageDaily.exe Information: 0 : WebJobUsageDaily:Main starting. DateTime UTC: 6/1/2017 2:35:24 PM
[06/01/2017 14:35:25 > 85aa8c: INFO] Error indexing method 'Functions.TimerJob'
[06/01/2017 14:35:25 > 85aa8c: INFO] Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException: Error indexing method 'Functions.TimerJob' ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'WebJobUsageDaily.Functions' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
[06/01/2017 14:35:25 > 85aa8c: INFO] at WebJobUsageDaily.Functions..cctor()
[06/01/2017 14:35:25 > 85aa8c: INFO] --- End of inner exception stack trace ---
[06/01/2017 14:35:25 > 85aa8c: INFO] at WebJobUsageDaily.Functions.MyDailySchedule..ctor()
[06/01/2017 14:35:25 > 85aa8c: INFO] --- End of inner exception stack trace ---
[06/01/2017 14:35:25 > 85aa8c: INFO] at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
[06/01/2017 14:35:25 > 85aa8c: INFO] at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
[06/01/2017 14:35:25 > 85aa8c: INFO] at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
[06/01/2017 14:35:25 > 85aa8c: INFO] at System.Activator.CreateInstance(Type type, Boolean nonPublic)
[06/01/2017 14:35:25 > 85aa8c: ERR ]
[06/01/2017 14:35:25 > 85aa8c: INFO] at System.Activator.CreateInstance(Type type)
[06/01/2017 14:35:25 > 85aa8c: ERR ] Unhandled Exception: Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException: Error indexing method 'Functions.TimerJob' ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'WebJobUsageDaily.Functions' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
[06/01/2017 14:35:25 > 85aa8c: INFO] at Microsoft.Azure.WebJobs.Extensions.Timers.TimerSchedule.Create(TimerTriggerAttribute attribute, INameResolver nameResolver)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at WebJobUsageDaily.Functions..cctor()
[06/01/2017 14:35:25 > 85aa8c: INFO] at Microsoft.Azure.WebJobs.Extensions.Timers.Bindings.TimerTriggerAttributeBindingProvider.TryCreateAsync(TriggerBindingProviderContext context)
[06/01/2017 14:35:25 > 85aa8c: ERR ] --- End of inner exception stack trace ---
[06/01/2017 14:35:25 > 85aa8c: INFO] at Microsoft.Azure.WebJobs.Host.Triggers.CompositeTriggerBindingProvider.d__2.MoveNext()
[06/01/2017 14:35:25 > 85aa8c: ERR ] at WebJobUsageDaily.Functions.MyDailySchedule..ctor()
[06/01/2017 14:35:25 > 85aa8c: INFO] --- End of stack trace from previous location where exception was thrown ---
[06/01/2017 14:35:25 > 85aa8c: ERR ] --- End of inner exception stack trace ---
[06/01/2017 14:35:25 > 85aa8c: INFO] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
[06/01/2017 14:35:25 > 85aa8c: INFO] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
[06/01/2017 14:35:25 > 85aa8c: INFO] at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.d__14.MoveNext()
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
[06/01/2017 14:35:25 > 85aa8c: INFO] --- End of stack trace from previous location where exception was thrown ---
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Activator.CreateInstance(Type type, Boolean nonPublic)
[06/01/2017 14:35:25 > 85aa8c: INFO] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Activator.CreateInstance(Type type)
[06/01/2017 14:35:25 > 85aa8c: INFO] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at Microsoft.Azure.WebJobs.Extensions.Timers.TimerSchedule.Create(TimerTriggerAttribute attribute, INameResolver nameResolver)
[06/01/2017 14:35:25 > 85aa8c: INFO] at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.d__13.MoveNext()
[06/01/2017 14:35:25 > 85aa8c: ERR ] at Microsoft.Azure.WebJobs.Extensions.Timers.Bindings.TimerTriggerAttributeBindingProvider.TryCreateAsync(TriggerBindingProviderContext context)
[06/01/2017 14:35:25 > 85aa8c: INFO] --- End of inner exception stack trace ---
[06/01/2017 14:35:25 > 85aa8c: ERR ] at Microsoft.Azure.WebJobs.Host.Triggers.CompositeTriggerBindingProvider.d__2.MoveNext()
[06/01/2017 14:35:25 > 85aa8c: INFO] at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.d__13.MoveNext()
[06/01/2017 14:35:25 > 85aa8c: ERR ] --- End of stack trace from previous location where exception was thrown ---
[06/01/2017 14:35:25 > 85aa8c: INFO] --- End of stack trace from previous location where exception was thrown ---
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[06/01/2017 14:35:25 > 85aa8c: INFO] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[06/01/2017 14:35:25 > 85aa8c: INFO] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.d__14.MoveNext()
[06/01/2017 14:35:25 > 85aa8c: INFO] at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.d__9.MoveNext()
[06/01/2017 14:35:25 > 85aa8c: ERR ] --- End of stack trace from previous location where exception was thrown ---
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.d__13.MoveNext()
[06/01/2017 14:35:25 > 85aa8c: ERR ] --- End of inner exception stack trace ---
[06/01/2017 14:35:25 > 85aa8c: ERR ] at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.d__13.MoveNext()
[06/01/2017 14:35:25 > 85aa8c: ERR ] --- End of stack trace from previous location where exception was thrown ---
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.d__9.MoveNext()
[06/01/2017 14:35:25 > 85aa8c: ERR ] --- End of stack trace from previous location where exception was thrown ---
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexProvider.d__11.MoveNext()
[06/01/2017 14:35:25 > 85aa8c: ERR ] --- End of stack trace from previous location where exception was thrown ---
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexProvider.d__10.MoveNext()
[06/01/2017 14:35:25 > 85aa8c: ERR ] --- End of stack trace from previous location where exception was thrown ---
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at Microsoft.Azure.WebJobs.Host.Executors.JobHostContextFactory.d__5.MoveNext()
[06/01/2017 14:35:25 > 85aa8c: ERR ] --- End of stack trace from previous location where exception was thrown ---
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at Microsoft.Azure.WebJobs.Host.Executors.JobHostContextFactory.d__4.MoveNext()
[06/01/2017 14:35:25 > 85aa8c: ERR ] --- End of stack trace from previous location where exception was thrown ---
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[06/01/2017 14:35:25 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[06/01/2017 14:35:26 > 85aa8c: ERR ] at Microsoft.Azure.WebJobs.JobHost.d__44.MoveNext()
[06/01/2017 14:35:26 > 85aa8c: ERR ] --- End of stack trace from previous location where exception was thrown ---
[06/01/2017 14:35:26 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[06/01/2017 14:35:26 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[06/01/2017 14:35:26 > 85aa8c: ERR ] at Microsoft.Azure.WebJobs.JobHost.d__27.MoveNext()
[06/01/2017 14:35:26 > 85aa8c: ERR ] --- End of stack trace from previous location where exception was thrown ---
[06/01/2017 14:35:26 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[06/01/2017 14:35:26 > 85aa8c: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[06/01/2017 14:35:26 > 85aa8c: ERR ] at Microsoft.Azure.WebJobs.JobHost.Start()
[06/01/2017 14:35:26 > 85aa8c: ERR ] at Microsoft.Azure.WebJobs.JobHost.RunAndBlock()
[06/01/2017 14:35:26 > 85aa8c: ERR ] at WebJobUsageDaily.Program.Main()
[06/01/2017 14:35:26 > 85aa8c: SYS ERR ] Job failed due to exit code -532462766
[06/01/2017 14:35:26 > 85aa8c: SYS INFO] Process went down, waiting for 60 seconds
[06/01/2017 14:35:26 > 85aa8c: SYS INFO] Status changed to PendingRestart

AzureResourceManagerUtil.RateCardRestApiCall() better error handling

In AzureResourceManagerUtil.RateCardRestApiCall() method I suggest catching WebException in addition to plain Exception. The provided response content may (in my case did) provide invaluable hints in addition to the response message. Proposed solution:

public static HttpWebResponse RateCardRestApiCall(string requesturl, string organizationId)
{
    try {
        // Aquire App Only Access Token to call Azure Resource Manager - Client Credential OAuth Flow
        ClientCredential credential = new ClientCredential(
            ConfigurationManager.AppSettings["ida:ClientID"],
            ConfigurationManager.AppSettings["ida:Password"]);

        // initialize AuthenticationContext with the token cache of the currently signed in user, as kept in the app's EF DB
        string authority = ConfigurationManager.AppSettings["ida:Authority"];
        AuthenticationContext authContext = new AuthenticationContext(string.Format(authority, organizationId));

        string resourceManagerIdentifier = ConfigurationManager.AppSettings["ida:AzureResourceManagerIdentifier"];
        AuthenticationResult result = authContext.AcquireToken(resourceManagerIdentifier, credential);

        //Crafting the HTTP call
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requesturl);
        request.Headers.Add(HttpRequestHeader.Authorization, "Bearer " + result.AccessToken);
        request.ContentType = "application/json";
        //request.KeepAlive = true;
        //request.Timeout = 1000 * 60 * 2;  // 2 minutes
        //request.ReadWriteTimeout = 1000 * 60 * 2;

        WebResponse response = request.GetResponse();
        return response as HttpWebResponse;
    } catch (WebException e) {
        Stream str = e.Response.GetResponseStream();
        using (StreamReader readStream = new StreamReader(str, Encoding.UTF8)) {
            string content = readStream.ReadToEnd();
            Console.WriteLine("Exception: RateCardRestApiCall1-e.message: " + e.Message);
            Console.WriteLine("Response content: " + content);
        }
        return null;
    } catch (Exception e) {
        // Exception occurs because of:
        //      "The operation has timed out"
        //      "The remote server returned an error: (403) Forbidden."
        //      "The remote server returned an error: (400) Bad Request."
        //      "The remote server returned an error: (404) Not Found."
        Console.WriteLine("Exception: RateCardRestApiCall1-e.message: " + e.Message);
        return null;
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.