You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Azure Government portal: <ahref="https://portal.azure.us/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/SpotResources%0A%7C%20where%20type%20%3D~%20%27microsoft.compute%2Fskuspotevictionrate%2Flocation%27%0A%7C%20where%20sku.name%20in~%20%28%27standard_d2s_v4%27%2C%20%27standard_d4s_v4%27%29%0A%7C%20where%20location%20in~%20%28%27eastus%27%2C%20%27southcentralus%27%29%0A%7C%20project%20skuName%20%3D%20tostring%28sku.name%29%2C%20location%2C%20spotEvictionRate%20%3D%20tostring%28properties.evictionRate%29%0A%7C%20order%20by%20skuName%20asc%2C%20location%20asc"target="_blank">portal.Azure.us</a>
41
+
- Azure China 21Vianet portal: <ahref="https://portal.azure.cn/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/SpotResources%0A%7C%20where%20type%20%3D~%20%27microsoft.compute%2Fskuspotevictionrate%2Flocation%27%0A%7C%20where%20sku.name%20in~%20%28%27standard_d2s_v4%27%2C%20%27standard_d4s_v4%27%29%0A%7C%20where%20location%20in~%20%28%27eastus%27%2C%20%27southcentralus%27%29%0A%7C%20project%20skuName%20%3D%20tostring%28sku.name%29%2C%20location%2C%20spotEvictionRate%20%3D%20tostring%28properties.evictionRate%29%0A%7C%20order%20by%20skuName%20asc%2C%20location%20asc"target="_blank">portal.Azure.cn</a>
42
+
43
+
---
44
+
23
45
### Compare the latest Spot price across multiple VM SKUs and regions for an OS type
24
46
25
47
This query gets the latest Spot price across multiple VM SKUs and regions for an OS type. The results are sorted by price in ascending order.
@@ -34,4 +56,25 @@ SpotResources
34
56
| order by latestSpotPriceUSD asc
35
57
```
36
58
59
+
# [Azure CLI](#tab/azure-cli)
60
+
61
+
```azurecli
62
+
az graph query -q "SpotResources | where type =~ 'microsoft.compute/skuspotpricehistory/ostype/location' | where sku.name in~ ('standard_d2s_v4', 'standard_d4s_v4') | where properties.osType =~ 'linux' | where location in~ ('eastus', 'southcentralus') | project skuName = tostring(sku.name), osType = tostring(properties.osType), location, latestSpotPriceUSD = todouble(properties.spotPrices[0].priceUSD) | order by latestSpotPriceUSD asc"
63
+
```
64
+
65
+
# [Azure PowerShell](#tab/azure-powershell)
66
+
67
+
```azurepowershell
68
+
Search-AzGraph -Query "SpotResources | where type =~ 'microsoft.compute/skuspotpricehistory/ostype/location' | where sku.name in~ ('standard_d2s_v4', 'standard_d4s_v4') | where properties.osType =~ 'linux' | where location in~ ('eastus', 'southcentralus') | project skuName = tostring(sku.name), osType = tostring(properties.osType), location, latestSpotPriceUSD = todouble(properties.spotPrices[0].priceUSD) | order by latestSpotPriceUSD asc"
69
+
```
70
+
71
+
# [Portal](#tab/azure-portal)
72
+
73
+
:::image type="icon" source="../../../../articles/governance/resource-graph/media/resource-graph-small.png"::: Try this query in Azure Resource Graph Explorer:
- Azure Government portal: <ahref="https://portal.azure.us/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/SpotResources%0A%7C%20where%20type%20%3D~%20%27microsoft.compute%2Fskuspotpricehistory%2Fostype%2Flocation%27%0A%7C%20where%20sku.name%20in~%20%28%27standard_d2s_v4%27%2C%20%27standard_d4s_v4%27%29%0A%7C%20where%20properties.osType%20%3D~%20%27linux%27%0A%7C%20where%20location%20in~%20%28%27eastus%27%2C%20%27southcentralus%27%29%0A%7C%20project%20skuName%20%3D%20tostring%28sku.name%29%2C%20osType%20%3D%20tostring%28properties.osType%29%2C%20location%2C%20latestSpotPriceUSD%20%3D%20todouble%28properties.spotPrices%5B0%5D.priceUSD%29%0A%7C%20order%20by%20latestSpotPriceUSD%20asc"target="_blank">portal.Azure.us</a>
77
+
- Azure China 21Vianet portal: <ahref="https://portal.azure.cn/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/SpotResources%0A%7C%20where%20type%20%3D~%20%27microsoft.compute%2Fskuspotpricehistory%2Fostype%2Flocation%27%0A%7C%20where%20sku.name%20in~%20%28%27standard_d2s_v4%27%2C%20%27standard_d4s_v4%27%29%0A%7C%20where%20properties.osType%20%3D~%20%27linux%27%0A%7C%20where%20location%20in~%20%28%27eastus%27%2C%20%27southcentralus%27%29%0A%7C%20project%20skuName%20%3D%20tostring%28sku.name%29%2C%20osType%20%3D%20tostring%28properties.osType%29%2C%20location%2C%20latestSpotPriceUSD%20%3D%20todouble%28properties.spotPrices%5B0%5D.priceUSD%29%0A%7C%20order%20by%20latestSpotPriceUSD%20asc"target="_blank">portal.Azure.cn</a>
0 commit comments