Accessing Azure Notification Hub Pricing Tier Via .NET - azure

I want to determine the current pricing tier of my hub so I can use/not use telemetry functions without generating errors. I have found a PricingTier class, but it states it "Creates a custom value for PricingTier". Does the NotificationHubClient have access to the pricing tier in use?

Related

API to know Azure Notification Hubs limit left

I need to know how to get limit which is left for Azure Notification Hub. Is there such function in Azure API? I haven't find anything about it in docs.
As far as I know, there are three tiers in Notification Hubs—free, basic, and standard. Base charge and quotas are applied at the namespace level. These three tiers have limits in the namespace. For more details, you can refer to the doc. To see the current namespace tier, simply GET on the namespace plan:
GET: https://management.core.windows.net/{subscription ID}/services/ServiceBus/Namespaces/{namespace name}/notificationhubplan

Service Bus Component of Azure on Premise data gateway - Pricing

according to MS there is a Azure Service bus component to on-prem data gateway , however when you install the Azure component no service bus resource created. we need to understand the impact on pricing i.e. is the price of service bus hidden within Azure on prem data gateway ? there is no pricing guidelines for Azure On premise gateway
The On-premises data gateway relies on Azure Service Bus for cloud connectivity and correspondingly establishes outbound connections to its associated Azure region, which means an Azure Service Bus implicitly created when a data gateway is installed.
Created Azure Service Bus will not be shown explicitly. There is no extra cost for it. All you have to pay is for the on-prem data gateway which includes all infrastructure costs(Azure Service Bus).
There is not a licensing cost for the data gateway and data flowing into Azure is free. You pay egress costs which can be calculated using https://azure.microsoft.com/en-us/pricing/details/bandwidth/

Azure Rate Card reserved instance pricing

Is there an API provided by Azure providing information about Azure Rate Card pricing ?
The usual rate card doesn't seem to have any such information.
You could use Azure Billing APIs to predict and manage your costs, refer to this article.
Use Azure Billing APIs to pull usage and resource data into your preferred data analysis tools. The Azure Resource Usage and RateCard APIs can help you accurately predict and manage your costs.
Azure Invoice Download API: download invoices
Azure Resource Usage API: get your estimated Azure consumption data
Azure Resource RateCard API: get the list of available Azure resources and estimated pricing information for each

How to check if a Azure Service Bus has Premium Pricing

In one of my Azure Web Apps I create an Azure Topic when it doesn't exist yet during the warmup(start) of our Azure Web App.
On topic creation time I want to know whether the service bus has a premium pricing tier, when yes I want to disable express, when no (standard pricing tier) I want to enable express, to prevent exceptions.
Is there a defensive way to check if a premium pricing tier is available on the service bus (for example: using the service bus connection string) ?
When there is no defensive way, I can always catch the web exception that know raises, but I want to prevent the exception if I can.
Edit: After consulting our lead-dev we decided to skip the EnableExpress setting completely in our DTAP. So I don't need to implement the SKU check at all. Be aware to not set the EnableExpress property at all otherwise you get the webexception in Premium SKU.
Is there a defensive way to check if a premium pricing tier is
available on the service bus (for example: using the service bus
connection string)?
Unfortunately there's none as of today. Service Bus Client SDK does not expose this information. This feature has been asked from the Service Bus team and there's an open issue on Github for that: https://github.com/Azure/azure-service-bus/issues/42.
The differences between Premium and Standard tiers are highlighted here: https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-premium-messaging. Kind of an anti-pattern but one thing you could do is perform and operation that is only available in Premium tier (say sending a message greater than 256KB in size) and catch the exception (or lack of) to determine if the Service Bus tier is Premium or not.
If we want to check the Azure Service Bus Pricing tier,we could use the following code with Microsoft.Azure.Management.Fluent SDK.
var credentials = SdkContext.AzureCredentialsFactory.FromFile(#"c:\tom\azureCredential.txt");
var azure = Azure
.Configure()
.WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
.Authenticate(credentials)
.WithDefaultSubscription();
var serviceBus = azure.ServiceBusNamespaces.GetByResourceGroup("resourcegroup", "servicebusnamespace");
var priceTier = serviceBus.Sku.Tier;
Before code we need to create an azure active directory application and assign the correspondent role. We could create the azure credential file following the document. The following is the credential file format.
subscription=########-####-####-####-############
client=########-####-####-####-############
tenant=########-####-####-####-############
key=XXXXXXXXXXXXXXXX
managementURI=https\://management.core.windows.net/
baseURL=https\://management.azure.com/
authURL=https\://login.windows.net/
graphURL=https\://graph.windows.net/

Does Azure function pricing include webhooks too?

I understood how functions pricing works. It is basically the sum of request charges and computation charges. Assuming I use a webhook + API triiger for my function. Now how my pricing works ?
Regardless of the trigger type (HTTP/WebHook, Queue, Service Bus, etc.), the billing model (from an Azure Functions' perspective) is the same, so covered by the pricing page and the billing calculator you've linked to.
Any other resources external to Azure Functions (service bus, storage, services providing the WebHook) would have their own costs.
I hope this helps.

Resources