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!
Related
I do have external Azure Gateway which allows calling internal API services through internal (not public) APIM.
For billing purpose, I need to know who exactly (IP or some type of IDs) make a call.
I thought that could get this information from APIM logs.
I've tried to send custom header, with some sort of IDs, during API call - but I could not find any meaningful information in APIM diagnostic logs.
Could you please share your thoughts and suggestions, how to achieve the above goal?
You can know the requestor by pulling reports of that particular API management using rest API. Here you get option to filter the reports by User and User-Ids
reference : https://learn.microsoft.com/en-us/rest/api/apimanagement/current-ga/reports/list-by-user
In Azure Cost analysis console, we have the option to filter by Service Name. The same Column is NOT there in the billing CSV export I’m getting from Azure. Does anyone know how to filter Service name in billing export
I tried to see cost analysis in 'Cost Management + Billing | Billing account' menu, and I also found the downloaded CSV files don't contain an Service Name column. So I prefer to use cost management api to get the details.
Here's the api link: https://learn.microsoft.com/en-us/rest/api/cost-management/query/usage
By the way, I remembered that if someone wanna use this api, please make sure that the target subscription has joined Azure plan.
Hope it will do some help. Wish you a good day.
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}
So for Pay-as-you-Go Azure subscriptions you can use the ConsumptionManagementClient. However, this does not work on Azure Sponsorship or CSP subscriptions. It even states this at https://learn.microsoft.com/en-us/rest/api/consumption/. However, if you do have one of those unsupported subscription types, how do you get usage details?
Basically I want to be able to query the usageDetails of any subscription I am authorized to view in C#. What is the right approach to this?
Seems odd that Microsoft has completely different interfaces like this for usage details. What API/SDK (C#) should I be using when ConsumptionManagementClient doesn't work?
OK, so I was exploring the ARM subscription REST endpoint in more detail and I stumbled upon how to get this directly without the need for the ConsumptionManagementClient. For anyone else that needs this info, you can find it in '/providers/Microsoft.Commerce/UsageAggregates'. I can confirm this is working for both PAYG and sponsored subscriptions.
Does Azure ARM REST API provide a way to get a list of available regions?
I can see that the classic REST API provides such a list as described here:
https://msdn.microsoft.com/en-us/library/azure/gg441293.aspx
But I can't see its equivalent for ARM.
To list the locations for an Azure Subscription using ARM API, please see this link: https://msdn.microsoft.com/en-us/library/azure/dn790540.aspx.
However please keep in mind that not all resources are available in all locations. If you want to find out the locations where a particular resource type is available, you would need to fetch information about the provider of that resource type. For this, please see this link: https://msdn.microsoft.com/en-us/library/azure/dn790524.aspx