question

gauravsuman avatar image
0 Votes"
gauravsuman asked gauravsuman commented

How to get VM eviction rate through rest api

I want Eviction rate for different Sku as shown in the portal through rest api for my analysis.
Do we have any API exposed by Azure for the same.

azure-virtual-machinesazure-spot
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

TravisCragg-MSFT avatar image
0 Votes"
TravisCragg-MSFT answered gauravsuman commented

We do not have a documented way to get this info, but (almost) everything the portal gets is available via an API that you can call.

The easiest way that I have found to get this info is to capture the API request when you view it in the portal, and then you can call the API yourself.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@TravisCragg-MSFT From the portal I can see that 'https://management.azure.com/subscriptions/${subscription-id}/providers/Microsoft.Compute/locations/eastus/spotEvictionRates/history/bulkQuery?api-version=2020-06-01' is getting called.
When I tried calling the same from the postman I am getting the below response.
{
"error": {
"code": "OperationNotAllowed",
"message": "Client 'client-id' is unauthorized to execute requests of this type. Only 'IbizaPortal, IbizaPortalFairfax' clients are allowed to execute requests of this type."
}
}

Can I know why this could be happening? Is it like this api can only be called from azure portal?
And is there any alternative?

0 Votes 0 ·

That is likely only from the portal. Let me follow up with this internally and see if there is a good way to do this.

0 Votes 0 ·

@TravisCragg-MSFT any update on the same?

0 Votes 0 ·