我正在嘗試查詢 Azure 成本管理 API,我希望能夠根據 2 種不同型別的資源標簽過濾結果,但我無法確定格式。我可以讓單個標簽過濾器正常作業,但我對多個標簽的格式一無所知。任何人都可以投入他們的 2 美分嗎?
作業單個過濾器查詢:
{
"type": "Usage",
"timeframe": "{TimeFrame}",
"dataset": {
"granularity": "None",
"filter": {
"tags": {
"name": "Environment",
"operator": "In",
"values": [
{Environment}
]
}
},
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"grouping": [
{
"type": "Dimension",
"name": "{Aggregation}"
}
]
}
}
我嘗試添加多個過濾器:
{
"type": "Usage",
"timeframe": "{TimeFrame}",
"dataset": {
"granularity": "None",
"filter": {
"tags": [
{
"name": "Environment",
"operator": "In",
"values": [
{Environment}
]
},
{
"name": "Location",
"operator": "In",
"values": [
{Location}
]
}
]
},
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"grouping": [
{
"type": "Dimension",
"name": "{Aggregation}"
}
]
}
}
我對 Azure 很陌生,所以請不要把我烤得太厲害,哈哈。
感謝所有看過我問題的人,即使您沒有我的答案,也非常感謝。
uj5u.com熱心網友回復:
我的引數設定方式存在問題,導致查詢錯誤。這是具有用于過濾的多個標簽屬性的作業代碼:
{
"type": "Usage",
"timeframe": "{TimeFrame}",
"dataset": {
"granularity": "None",
"filter": {
"and": [
{
"tags": {
"name": "Location",
"operator": "In",
"values": [{LocationTag}]
}
},
{
"tags": {
"name": "Environment",
"operator": "In",
"Values": [{EnvironmentTag}]
}
},
{
"tags": {
"name": "Integrated-System",
"operator": "In",
"Values": [{IntegratedSystemTag}]
}
}
]
},
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"grouping": [
{
"type": "Dimension",
"name": "{Aggregation}"
}
]
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/487280.html
標籤:天蓝色 天蓝色资源管理器 成本管理 天蓝色监视器工作簿
