'Pricing tier' Azure SQL 数据库的详细信息 - powershell
'Pricing tier' details of Azure SQL databases - powershell
是否可以通过 powershell 获取 Azure SQL 数据库的定价层详细信息?谢谢你。
您可以从 powershell 调用其余 api 以获取定价详细信息:
new-azure-billing-apis-available
有关定价详情,您可以致电价目表api:Get price and metadata information for resources used in an Azure subscription
您可以阅读 Azure 新价目表 API 以获取有关您的资源的定价信息。 https://docs.microsoft.com/en-us/azure/billing/billing-usage-rate-card-overview
阅读整篇文章很乏味,但您可以参考此示例post完成您的任务How to calculate Azure SQL databases price by PowerShell
下面是代码片段
$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 ""
}
}
是否可以通过 powershell 获取 Azure SQL 数据库的定价层详细信息?谢谢你。
您可以从 powershell 调用其余 api 以获取定价详细信息: new-azure-billing-apis-available
有关定价详情,您可以致电价目表api:Get price and metadata information for resources used in an Azure subscription
您可以阅读 Azure 新价目表 API 以获取有关您的资源的定价信息。 https://docs.microsoft.com/en-us/azure/billing/billing-usage-rate-card-overview
阅读整篇文章很乏味,但您可以参考此示例post完成您的任务How to calculate Azure SQL databases price by PowerShell
下面是代码片段
$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 ""
}
}