Forum Discussion

vneekhra's avatar
vneekhra
Copper Contributor
Jul 11, 2021

Azure advisor API

I am trying to fetch cost recommendations using Advisor API call and need to fetch data from this category(Optimize virtual machine spend by resizing or shutting down underutilized instances).

Reduce service costs using Azure Advisor - Azure Advisor | Microsoft Docs

I can make a call but in my subscription there is no data and for that I started 2VMs, is there any other fast way to generate the data? as mentioned in the doc that I need to wait for 7 days so that Advisor will pick, generate and show that data in Advisor page.

Can I get the response json of that? So that I can complete my code and in the meantime data will generate. Any words on this would be really appreciated. Thank you!

  • tofanjena's avatar
    tofanjena
    Copper Contributor
    Hi,
    Do you have any data in Azure portal at Advisor blade , if Yes , definitely you will get the same data in your API Call.

    If you do not have any data in Azure Portal Advisor blade , dont expect to get while calling the API.

    A side Note : - also there is a Az Module to get Advisor not only Cost ( for all aspect ) .

    just have a look to all synatx : Get-AzAdvisorRecommendation

  • You need to leave the Virtual Machines on long enough for it to detect that you can reduce the cost by resizing, for example turning them off each night won't allow enough time for the advisor to collate and do any recommendations, as they aren't on for long enough, Advisor monitors for 7 days, as far as I am aware there is no way to force this, as it collates data and does some smart machine learning in the backend.

    "Advisor monitors your virtual machine usage for 7 days and then identifies low-utilization virtual machines. Virtual machines are considered low-utilization if their CPU utilization is 5% or less and their network utilization is less than 2% or if the current workload can be accommodated by a smaller virtual machine size."

    https://docs.microsoft.com/en-us/azure/advisor/advisor-get-started#configure-low-usage-vm-recommendation

     

    Also, take a look at Microsoft Graph Explorer as well, I wrote a brief blog article about it - using the Advisor a few months ago you may be interested in: https://luke.geek.nz/azure-resource-graph-explorer-and-the-powershell-azure-resource-graph

    • hspinto's avatar
      hspinto
      Icon for Microsoft rankMicrosoft

      vneekhra, besides what was already mentioned by other contributors, if you want to increase the chances of getting VM right-size recommendations, you should also raise the CPU threshold to a higher value, by configuring Advisor rules as documented here.

Resources