Is there any way to identity if Azure is paygo or not. Using metadata or any API call?

Diksha Singh 60 Reputation points
2024-06-19T08:26:54.2733333+00:00

We want to identify if the Azure VM is paygo type or not. Do we get any billing information using metadata URL or API call?

Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
2,340 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Vlad Costa 935 Reputation points
    2024-06-19T08:44:42.0466667+00:00

    Hi Diksha,

    By checking your Azure subscription bill, you can identify if your Azure VM is Pay-as-you-go (PAYG).

    Here are the steps to do that:

    1. Sign in to the Azure portal.
    2. Type subscriptions in the search box and then select Subscriptions.
    3. In the list of subscriptions, select the subscription you want to check.
    4. Under Billing, select Invoices.
    5. In the list of invoices, look for the one you want to download, then select the download symbol. This action opens the Download Usage + Charges window, where you can select Download CSV and Download invoice.
    6. The detailed usage CSV file shows your charges by billing period and daily usage. If you see charges for your VM usage, your VM is likely on a PAYG.

    You might want to look into the Azure Billing APIs for billing information.

    https://learn.microsoft.com/en-us/rest/api/compute/virtual-machines/get?view=rest-compute-2024-03-01

    If this answers your question, please click Accept Answer and Yes if this answer was helpful. Doing so would help other community members with similar issues identify the solution. I highly appreciate your contribution to the community.



  2. SadiqhAhmed-MSFT 41,296 Reputation points Microsoft Employee
    2024-06-19T13:10:43.26+00:00

    @Diksha Singh I'm not entirely sure what you mean by "metadata URLs" in this context, but I'll do my best to provide you with information about Pay-As-You-Go subscriptions in Azure.

    A Pay-As-You-Go subscription is a flexible and cost-effective way to use Azure services. With this type of subscription, you pay only for the services you use, and there are no upfront costs or termination fees. You can use any Azure service that is available in your region, and you can scale up or down as needed.

    As for metadata URLs, I'm not sure how they relate to Pay-As-You-Go subscriptions. Metadata URLs are typically used to provide information about a resource in Azure, such as a virtual machine or storage account. If you can provide more information about what you're looking for, I may be able to provide a more specific answer.

    Hope this helps!

    EDIT/Update:

    The subscription GET API https://learn.microsoft.com/en-us/rest/api/resources/subscriptions/get?tabs=HTTP will not give the offer id for the subscription however it has the parameter quotaId which will show it as PayAsYouGo/Enterprise/MSDNDev/Test to determine if the subscription is Pay-As-You-Go (PayG). 

    However, this quoteid will be same for MCA FL (Enterprise) and EA legacy, MCA CL (PayG) and legacy PayG will be same. 

    Another way is if the subscription has usage, you can run this API to fetch usage

    https://learn.microsoft.com/en-us/rest/api/consumption/usage-details/list?tabs=HTTP

    and in the usage record we have offerId available which you can get to know what type of offer the subscription is.

    Hope this helps. Let us know if you need any further assistance in this matter!


    If the response helped, do "Accept Answer" and up-vote it

    0 comments No comments