Azure Ratecard Api to get VM price - azure

AWS provides a pricing api to get cost details of each service. If you want to know the price of an EC2 instance, you just pass the region,instance type(eg:t2.micro) and service code of EC2 to the pricing API and it returns the pricing details. I understand that azure exposes Ratecard API to get the prices. But It returns a huge JSON with all the services. How do I filter based on service type and its attributes. For example, I want the pricing details of Azure VM of instance type Standard_B2S in Central US. Is this possible?

No there is no separate API available for it apart from RateCard, if you need to get the details of particular VM you can use Virtual Machine Rest API. See this link.
GET
https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes?api-version={apiVersion}

Related

Azure Retail Prices overview

Reading the official documentation about Azure Retail Prices overview, I found that we can make API calls filtering by serviceName
https://learn.microsoft.com/en-us/rest/api/cost-management/retail-prices/azure-retail-prices
https://prices.azure.com/api/retail/prices?$filter=serviceName eq
'Virtual Machines'
However, this assumes that we know the service's correct name.
How do we get a list of all service names in Azure?
In AWS there is an endpoint that returns a list of all AWS service names, and we can use that data in the subsequent API calls.
I found this article but it is not exactly what I would expect from Azure side.
https://dev.to/holger/how-to-retrieve-a-list-of-available-services-from-the-azure-retail-rates-prices-api-2nk6
Thank you!

How to get cost of Azure subscription programmatically

Trying to understand the different Azure APIs to get the Azure subscription cost details programmatically.
I see RateCard API is good approach. In the output/response of this API , there is something called meterID and meterDetails.
anyone know what is this meterID and meterDetails ? how to get it using Azure Portal ?
The meterID is a GUID for every resource except VMs. meterDetails is the detailed Usage. You can get these details from the cost management section in Azure portal

Cognitive services text translation authentication issue

I'm utilizing Azure's Cognitive Services Text Analysis API. I'm attempting to authenticate by passing my secret key for an access token via these instructions: https://learn.microsoft.com/en-us/azure/cognitive-services/translator/reference/v3-0-reference
I POST my Ocp-Apim-Subscription-Key to https://eastus.api.cognitive.microsoft.com/sts/v1.0/issueToken and get the following error:
{"error":{"code":"401","message": "The issueToken Operation under Token API V1.0 API is not supported with the current subscription key and pricing tier TextAnalytics.S."}}
I'm performing this authentication request using The Info Lab's macro in Alteryx - https://www.theinformationlab.co.uk/2017/09/26/translate-foreign-language-text-alteryx/ - I had to edit URL in the macro to add the "eastus" as the region in the issueToken request. Before I did that, I was getting an AccessDenied error response. At least now I know it's logging on to my resource because it will change the last letter in the error from "F" (free) to "S" to "S1" which are the pricing tiers I was switching between.
I have a pay-as-you-go subscription and I switched the resource to use Free, S, and S0 pricing tiers. Still always getting the same error. Please help!
Thank you
All provided in my summary.
I expect to get an authenticated token.
Per my understanding, you want to use Azure translator API and want to get an authenticated token specified by region. Based this doc mentioned , if you want to get a region based token, you should use Cognitive Service’s multi-service subscription . You can create a multi-service subscription by this link and you can get a token by its region and key as below :
For differences between Single-service resource and Multi-service resource , as official mentioned :
Multi-service resource:
Access multiple Azure Cognitive Services with
a single key and endpoint. Consolidates billing from the services you
use.
Single-service resource:
Access a single Azure Cognitive Service
with a unique key and endpoint for each service created. Use the free
tier to try out the service.
As we know except for translation service , there are many other services on Azure cognitive service . So when you create a Multi-service resource , you can call all Azure Cognitive Services . If you just need one or two kind Azure Cognitive Services or you want to get a separate billing of them, you can create Single-service resources separately.
In a wold, the differences between them is more about management instead of service.
Hope it helps.

How to monitor Azure Classic VM using REST API or via Java SDK?

HI i want to monitor Azure Classic VM using REST API/Java SDK , when i tried it with REST API with the following URL(The below url worked for Azure VM)
https://management.azure.com/subscriptions/<subscription_id>/resourceGroups/Preprod2-Resource-Group/providers/Microsoft.ClassicCompute/virtualMachines/cloudops-testvm1/providers/microsoft.insights/metrics?api-version=2016-09-01
I'm getting the following error
{
"code": "NotFound",
"message": "Resource provider not found: [Microsoft.ClassicCompute]"
}
Please suggest me if it can be done via REST API or if there is an SDK please suggest me the same.
My requirement is i want to monitor Classic VM and collect Network In,Network Out,Percentage CPU,Disk Read Operations/Sec,Disk Write Operations/Sec,Disk Write Bytes and Disk Read Bytes for every 5mins
This isn't a supported resource type through metrics API. The supported types and metrics are here:Supported metrics with Azure Monitor. You could check this link, for now, classic VM is not supported.
According to your description, you could use the Metric Definitions API. It works for classic VM.
https://management.azure.com/subscriptions/<subscription_id>/resourceGroups/<resourceGroups/>/providers/Microsoft.ClassicCompute/virtualMachines/<Virutal name>/providers/microsoft.insights/metricdefinitions?api-version=2015-07-01
Metric information stores in Azure storage account, you also could call Storage API to get VM metrics. More information please refer to this link:Storage Analytics.

API for metrics per Azure Site instance

In Azure's Portal you can view instance specific metrics per site if you go to a resource, select Metrics per instance (Apps), select the tab Site Metrics and then click an individual instance (starting with RD00... in the screenshot below):
I'd like to get this data (per instance, including the instance name RD00...) using some REST API call. I've looked at Azure's Resource Manager and their Metrics API, but couldn't find a way to get this data.
Is this possible, and, if so, how/where can I get this data?
I've looked at Azure's Resource Manager and their Metrics API, but couldn't find a way to get this data.
Based on the supported metrics with Azure Monitor of websites, Azure Metrics API only supports total and average type metrics for Azure Web App. We can't get per instance metrics by Azure Metrics API.
If you turn on the Web server logging in Azure portal, you will get the detail request data from /LogFiles/http/RawLogs/ folder using FTP. You could download the log and generate the metrics according the log.
Following is a record of raw logs. The ARRAffinity property will specify which instance is used to handle user request.
2017-04-27 08:51:32 AMOR-WEBAPP-TESTMSBUILD GET /home/index X-ARR-LOG-ID=bbdf4e53-3b96-4884-829c-cf82554abcc7 80 - 167.220.255.28 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/51.0.2704.79+Safari/537.36+Edge/14.14393 ARRAffinity=8f8ac6c076f7a9e2132f2eea1ff0fc61836fde1fef8c5525da0e81359003c9e8;+_ga=GA1.3.411824075.1493282866;+_gat=1 - amor-webapp-testmsbuild.azurewebsites.net 200 0 0 2607 1145 10095
ARRAffinity=8f8ac6c076f7a9e2132f2eea1ff0fc61836fde1fef8c5525da0e81359003c9e8

Resources