Budgets - Get
依預算名稱取得範圍的預算。
GET https://management.azure.com/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}?api-version=2023-05-01
URI 參數
名稱 | 位於 | 必要 | 類型 | Description |
---|---|---|---|---|
budget
|
path | True |
string |
預算名稱。 |
scope
|
path | True |
string |
與預算作業相關聯的範圍。 這包括訂用帳戶範圍的 '/subscriptions/{subscriptionId}/' '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 管理群組範圍的 '/providers/Microsoft.Management/managementGroups/{managementGroupId}'、'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope、'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSectionId}'。 |
api-version
|
query | True |
string |
要與用戶端要求搭配使用的 API 版本。 目前的版本為 2023-03-01。 |
回應
名稱 | 類型 | Description |
---|---|---|
200 OK |
正常。 要求已成功。 |
|
Other Status Codes |
描述作業失敗原因的錯誤回應。 |
安全性
azure_auth
Azure Active Directory OAuth2 Flow。
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名稱 | Description |
---|---|
user_impersonation | 模擬您的用戶帳戶 |
範例
Budget
Sample Request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/budgets/TestBudget?api-version=2023-05-01
Sample Response
{
"id": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/TestBudget",
"name": "TestBudget",
"type": "Microsoft.Consumption/budgets",
"eTag": "\"1d34d012214157f\"",
"properties": {
"category": "Cost",
"amount": 100.65,
"timeGrain": "Monthly",
"timePeriod": {
"startDate": "2017-10-01T00:00:00Z",
"endDate": "2018-10-31T00:00:00Z"
},
"filter": {
"and": [
{
"dimensions": {
"name": "ResourceId",
"operator": "In",
"values": [
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2",
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1"
]
}
},
{
"tags": {
"name": "category",
"operator": "In",
"values": [
"Dev",
"Prod"
]
}
},
{
"tags": {
"name": "department",
"operator": "In",
"values": [
"engineering",
"sales"
]
}
}
]
},
"currentSpend": {
"amount": 80.89,
"unit": "USD"
},
"notifications": {
"Actual_GreaterThan_80_Percent": {
"enabled": true,
"operator": "GreaterThan",
"threshold": 80,
"contactEmails": [
"johndoe@contoso.com",
"janesmith@contoso.com"
],
"contactRoles": [
"Contributor",
"Reader"
],
"contactGroups": [
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup"
],
"thresholdType": "Actual"
}
}
}
}
定義
名稱 | Description |
---|---|
Budget |
預算資源。 |
Budget |
要用於預算的比較表達式。 |
Budget |
可用來依資源群組、資源或計量來篩選預算。 |
Budget |
要篩選預算依據的維度或標籤。 |
Budget |
要用於比較的運算符。 |
Budget |
預算的開始日期和結束日期。 |
Category |
預算的類別,不論預算是追蹤成本還是使用量。 |
Culture |
收件者將接收通知的語言 |
Current |
正在追蹤預算的目前成本量。 |
Error |
錯誤的詳細數據。 |
Error |
錯誤回應表示服務無法處理傳入要求。 錯誤訊息中會提供原因。 某些錯誤回應:
|
Forecast |
正在追蹤預算的預測成本。 |
Notification |
與預算相關聯的通知。 |
Operator |
比較運算子。 |
Threshold |
閾值的類型 |
Time |
預算所涵蓋的時間。 追蹤數量將會根據時間粒度重設。 只有 WD 客戶才支援 BillingMonth、BillingQuarter 和 BillingAnnual |
Budget
預算資源。
名稱 | 類型 | Description |
---|---|---|
eTag |
string |
資源的 eTag。 若要處理並行更新案例,此字段將用來判斷使用者是否要更新最新版本。 |
id |
string |
資源標識碼。 |
name |
string |
資源名稱。 |
properties.amount |
number |
使用預算追蹤的總成本金額 |
properties.category |
預算的類別,不論預算是追蹤成本還是使用量。 |
|
properties.currentSpend |
正在追蹤預算的目前成本量。 |
|
properties.filter |
可用來依使用者指定的維度和/或標籤來篩選預算。 |
|
properties.forecastSpend |
正在追蹤預算的預測成本。 |
|
properties.notifications |
<string, Notification> |
與預算相關聯的通知字典。 預算最多可以有五個通知。 |
properties.timeGrain |
預算所涵蓋的時間。 追蹤數量將會根據時間粒度重設。 只有 WD 客戶才支援 BillingMonth、BillingQuarter 和 BillingAnnual |
|
properties.timePeriod |
具有預算的開始和結束日期。 開始日期必須是月份的第一個,而且應該小於結束日期。 預算開始日期必須在 2017 年 6 月 1 日或之後。 未來的開始日期不應超過12個月。 過去開始日期應該在 timegrain 期間內選取。 結束日期沒有任何限制。 |
|
type |
string |
資源類型。 |
BudgetComparisonExpression
要用於預算的比較表達式。
名稱 | 類型 | Description |
---|---|---|
name |
string |
要用於比較的數據行名稱。 |
operator |
要用於比較的運算符。 |
|
values |
string[] |
要用於比較的值陣列 |
BudgetFilter
可用來依資源群組、資源或計量來篩選預算。
名稱 | 類型 | Description |
---|---|---|
and |
邏輯 「AND」 表達式。 必須至少有2個專案。 |
|
dimensions |
具有維度的比較表達式 |
|
tags |
具有標記的比較表達式 |
BudgetFilterProperties
要篩選預算依據的維度或標籤。
名稱 | 類型 | Description |
---|---|---|
dimensions |
具有維度的比較表達式 |
|
tags |
具有標記的比較表達式 |
BudgetOperatorType
要用於比較的運算符。
名稱 | 類型 | Description |
---|---|---|
In |
string |
BudgetTimePeriod
預算的開始日期和結束日期。
名稱 | 類型 | Description |
---|---|---|
endDate |
string |
預算的結束日期。 如果未提供,我們會從開始日期預設為10年。 |
startDate |
string |
預算的開始日期。 |
CategoryType
預算的類別,不論預算是追蹤成本還是使用量。
名稱 | 類型 | Description |
---|---|---|
Cost |
string |
CultureCode
收件者將接收通知的語言
名稱 | 類型 | Description |
---|---|---|
cs-cz |
string |
|
da-dk |
string |
|
de-de |
string |
|
en-gb |
string |
|
en-us |
string |
|
es-es |
string |
|
fr-fr |
string |
|
hu-hu |
string |
|
it-it |
string |
|
ja-jp |
string |
|
ko-kr |
string |
|
nb-no |
string |
|
nl-nl |
string |
|
pl-pl |
string |
|
pt-br |
string |
|
pt-pt |
string |
|
ru-ru |
string |
|
sv-se |
string |
|
tr-tr |
string |
|
zh-cn |
string |
|
zh-tw |
string |
CurrentSpend
正在追蹤預算的目前成本量。
名稱 | 類型 | Description |
---|---|---|
amount |
number |
預算所追蹤的總成本金額。 |
unit |
string |
預算金額的測量單位。 |
ErrorDetails
錯誤的詳細數據。
名稱 | 類型 | Description |
---|---|---|
code |
string |
錯誤碼。 |
message |
string |
錯誤訊息,指出作業失敗的原因。 |
ErrorResponse
錯誤回應表示服務無法處理傳入要求。 錯誤訊息中會提供原因。
某些錯誤回應:
429 TooManyRequests - 要求已節流。 等候 「x-ms-ratelimit-microsoft.consumption-retry-after」 標頭中指定的時間後重試。
503 ServiceUnavailable - 服務暫時無法使用。 請在等候「Retry-After」標頭中指定的時間之後重試。
名稱 | 類型 | Description |
---|---|---|
error |
錯誤的詳細數據。 |
ForecastSpend
正在追蹤預算的預測成本。
名稱 | 類型 | Description |
---|---|---|
amount |
number |
預算所追蹤的總時間週期預測成本。 只有在預算包含預測警示類型時,才會提供此值。 |
unit |
string |
預算金額的測量單位。 |
Notification
與預算相關聯的通知。
名稱 | 類型 | 預設值 | Description |
---|---|---|---|
contactEmails |
string[] |
Email 位址,以在超過閾值時將預算通知傳送至 。 至少必須在訂用帳戶或資源群組範圍指定一個聯繫人電子郵件或聯繫人群組。 所有其他範圍必須至少指定一個聯繫人電子郵件。 |
|
contactGroups |
string[] |
超過閾值時要傳送預算通知的動作群組。 必須以完整 Azure 資源標識碼的形式提供。僅支援訂用帳戶或資源群組範圍。 |
|
contactRoles |
string[] |
當超過閾值時,要傳送預算通知的聯繫人角色。 |
|
enabled |
boolean |
通知已啟用或未啟用。 |
|
locale |
收件者將接收通知的語言 |
||
operator |
比較運算子。 |
||
threshold |
number |
與通知相關聯的臨界值。 當成本超過閾值時,就會傳送通知。 它一律是百分比,而且必須介於 0 到 1000 之間。 |
|
thresholdType | Actual |
閾值的類型 |
OperatorType
比較運算子。
名稱 | 類型 | Description |
---|---|---|
EqualTo |
string |
如果評估的成本與閾值相同,就會觸發警示。 注意:不建議使用此 OperatorType,因為成本與閾值完全相同,導致警示遺失。 此 OperatorType 未來將會淘汰。 |
GreaterThan |
string |
如果評估的成本大於閾值,就會觸發警示。 注意:這是設定預算警示時建議的 OperatorType。 |
GreaterThanOrEqualTo |
string |
如果評估的成本大於或等於臨界值,就會觸發警示。 |
ThresholdType
閾值的類型
名稱 | 類型 | Description |
---|---|---|
Actual |
string |
實際成本預算警示會在實際累算成本超過配置的預算 時通知。 |
Forecasted |
string |
預測成本預算警示會提供進階通知,指出您的消費趨勢可能超過已配置的預算,因為它依賴預測的成本預測。 |
TimeGrainType
預算所涵蓋的時間。 追蹤數量將會根據時間粒度重設。 只有 WD 客戶才支援 BillingMonth、BillingQuarter 和 BillingAnnual
名稱 | 類型 | Description |
---|---|---|
Annually |
string |
|
BillingAnnual |
string |
|
BillingMonth |
string |
|
BillingQuarter |
string |
|
Monthly |
string |
|
Quarterly |
string |