是否有可能通过powershell获得Azure SQL数据库的定价层详细信息?谢谢。
发布于 2016-02-24 20:02:38
您可以从powershell调用rest来获取定价细节:新的-天蓝色-帐单-apis提供
有关定价细节,您可以调用ratecard:获取Azure订阅中使用的资源的价格和元数据信息。
发布于 2017-03-23 07:01:06
您可以阅读Azure新费率卡API来获取有关资源的定价信息。https://learn.microsoft.com/en-us/azure/billing/billing-usage-rate-card-overview
阅读整篇文章很繁琐,但您可以引用此示例文章以用于任务如何用PowerShell计算Azure数据库的价格。
下面是代码片段
$Ret = Invoke-AzureRestGetAPI -Uri "https://management.azure.com/subscriptions/$subscriptionid/providers/Microsoft.Commerce/RateCard?api-version=2015-06-01-preview&`$filter=OfferDurableId eq 'MS-AZR-$OfferDurableId' and Currency eq '$Currency' and Locale eq '$Locale' and RegionInfo eq '$RegionInfo'"
$Sum = 0
$Ret.Meters | ForEach-Object {
If ($_.MeterSubCategory -eq "SQL Database") {
$Sum += $_.MeterRates.0
Write-Host ($_ | ConvertTo-Json -depth 4)
Write-Host ""
}
} https://stackoverflow.com/questions/35611728
复制相似问题