microsoft / AzureUsageAndBillingPortal

This web application solution enables you to monitor the usage and billing for any Azure subscriptions you have access to.
Other
199 stars 88 forks source link

Exception while getting rate card #51

Open TVDKoni opened 7 years ago

TVDKoni commented 7 years ago

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] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

backxb commented 7 years ago

Did you get this resolved? I'm running into the same issue.

TVDKoni commented 7 years ago

Too long to remember. Sorry. Just make sure, you have registered Microsoft.Commerce on your Subscription. In addition here my actual code. Possibly you will find some hints:

public static RateCardSync GetRateCard(Product prod, string resellerCid, string sa_token) { try { Dictionary<string, string> headers = new Dictionary<string, string>(); headers.Add("api-version", "2015-03-31"); headers.Add("x-ms-correlation-id", Guid.NewGuid().ToString()); headers.Add("x-ms-tracking-id", Guid.NewGuid().ToString()); headers.Add("Authorization", "Bearer " + sa_token); RateCardSync sync = RestHelper.GetJsonFromUriAsObject( string.Format("https://api.cp.microsoft.com/{0}/rate-card?&OfferDurableId={1}&Currency={2}&Locale={3}&RegionInfo={4}", resellerCid, prod.code, prod.currency, prod.locale, prod.regionInfo), headers);

    sync.tds_date_synced = DateTime.Now;
    return sync;
}
catch (WebException webException)
{
    log.Error(webException);
}
return null;

}

backxb commented 7 years ago

Thanks for your anser, however I stumbled upon issue #36 Subscriptions from a partner/CSP are not supported. My CSP recommended aubi, so that was time well spent :(

FBoucher commented 7 years ago

For CSP subscription check the project Peek