';定价层';Azure SQL数据库的详细信息-powershell

';定价层';Azure SQL数据库的详细信息-powershell,azure,azure-powershell,azure-sql-database,Azure,Azure Powershell,Azure Sql Database,是否可以通过powershell获取Azure SQL数据库的定价层详细信息?多谢各位 您可以从powershell调用rest api以获取定价详细信息: 有关定价详细信息,您可以调用ratecard api:您可以阅读Azure新费率卡api以获取有关资源的定价信息 阅读整篇文章很枯燥,但您可以参考此示例文章来完成任务 下面是代码片段 $Ret = Invoke-AzureRestGetAPI -Uri "https://management.azure.com/subscriptions

是否可以通过powershell获取Azure SQL数据库的定价层详细信息?多谢各位

您可以从powershell调用rest api以获取定价详细信息:


有关定价详细信息,您可以调用ratecard api:

您可以阅读Azure新费率卡api以获取有关资源的定价信息

阅读整篇文章很枯燥,但您可以参考此示例文章来完成任务

下面是代码片段

$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 "" 
    } 
}