你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Alerts - Get
按警报 ID 获取范围的警报。
GET https://management.azure.com/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}?api-version=2023-11-01
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
alert
|
path | True |
string |
警报 ID |
scope
|
path | True |
string |
与警报操作关联的范围。 这包括订阅范围的“/subscriptions/{subscriptionId}/” resourceGroup 范围的“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}”,计费帐户范围的“/providers/Microsoft.Billing/billingAccounts/{billingAccountId}”和“/providers/Microsoft.Billing/billingAccounts/{billingAccounts/{departmentId}”,“/providers/Microsoft.Billing/billingAccounts/{billingAccounts}/enrollmentAccounts/{enrollmentAccountId},对于 EnrollmentAccount 范围,“/providers/Microsoft.Management/managementGroups/{managementGroupId}”,用于管理组范围, billingProfile 范围的'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}“、'/providers/Microsoft.Billing/billingAccounts}/billingProfiles/{billingProfileId}/{billingProfileId}/invoiceSections/{invoiceSectionId}'”以及“/providers/Microsoft”。特定于合作伙伴的 Billing/billingAccounts/{billingAccountId}/customers/{customerId}。 |
api-version
|
query | True |
string |
要用于此操作的 API 版本。 |
响应
名称 | 类型 | 说明 |
---|---|---|
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
名称 | 说明 |
---|---|
user_impersonation | 模拟用户帐户 |
示例
Single |
Single |
SingleResourceGroupAlerts
Sample Request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/alerts/22222222-2222-2222-2222-222222222222?api-version=2023-11-01
Sample Response
{
"id": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/alerts/22222222-2222-2222-2222-222222222222",
"name": "22222222-2222-2222-2222-222222222222",
"type": "Microsoft.CostManagement/alerts",
"properties": {
"definition": {
"type": "Budget",
"category": "Cost",
"criteria": "CostThresholdExceeded"
},
"description": "",
"source": "Preset",
"details": {
"timeGrainType": "Quarterly",
"periodStartDate": "2020-03-01T00:00:00Z",
"triggeredBy": "22222222-2222-2222-2222-222222222222_1_01",
"resourceGroupFilter": [],
"resourceFilter": [],
"meterFilter": [],
"tagFilter": {},
"threshold": 0.8,
"operator": "GreaterThan",
"amount": 200000,
"unit": "USD",
"currentSpend": 161000.12,
"contactEmails": [
"1234@contoso.com"
],
"contactGroups": [],
"contactRoles": [],
"overridingAlert": null
},
"costEntityId": "budget1",
"status": "Active",
"creationTime": "2020-04-27T11:07:52.7143901Z",
"closeTime": "0001-01-01T00:00:00",
"modificationTime": "2020-04-28T11:06:02.8999373Z",
"statusModificationUserName": null,
"statusModificationTime": "0001-01-01T00:00:00"
}
}
SingleSubscriptionAlerts
Sample Request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/alerts/22222222-2222-2222-2222-222222222222?api-version=2023-11-01
Sample Response
{
"id": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/alerts/22222222-2222-2222-2222-222222222222",
"name": "22222222-2222-2222-2222-222222222222",
"type": "Microsoft.CostManagement/alerts",
"properties": {
"definition": {
"type": "Budget",
"category": "Cost",
"criteria": "CostThresholdExceeded"
},
"description": "",
"source": "Preset",
"details": {
"timeGrainType": "Quarterly",
"periodStartDate": "2020-03-01T00:00:00Z",
"triggeredBy": "22222222-2222-2222-2222-222222222222_1_01",
"resourceGroupFilter": [],
"resourceFilter": [],
"meterFilter": [],
"tagFilter": {},
"threshold": 0.8,
"operator": "GreaterThan",
"amount": 200000,
"unit": "USD",
"currentSpend": 161000.12,
"contactEmails": [
"1234@contoso.com"
],
"contactGroups": [],
"contactRoles": [],
"overridingAlert": null
},
"costEntityId": "budget1",
"status": "Active",
"creationTime": "2020-04-27T11:07:52.7143901Z",
"closeTime": "0001-01-01T00:00:00",
"modificationTime": "2020-04-28T11:06:02.8999373Z",
"statusModificationUserName": null,
"statusModificationTime": "0001-01-01T00:00:00"
}
}
定义
名称 | 说明 |
---|---|
Alert |
单个警报。 |
Alert |
警报类别 |
Alert |
触发警报的条件 |
Alert |
用于比较 currentSpend 与 amount 的运算符 |
Alert |
警报源 |
Alert |
警报状态 |
Alert |
timegrain 节奏的类型 |
Alert |
警报类型 |
Definition |
定义警报的类型 |
Details |
警报详细信息 |
Error |
错误的详细信息。 |
Error |
错误响应指示服务无法处理传入请求。 错误消息中提供了原因。 某些错误响应:
|
Tag |
要筛选依据的标记 |
Alert
单个警报。
名称 | 类型 | 说明 |
---|---|---|
eTag |
string |
资源的 eTag。 为了处理并发更新方案,此字段将用于确定用户是否要更新最新版本。 |
id |
string |
资源 ID。 |
name |
string |
资源名称。 |
properties.closeTime |
string |
关闭警报的 dateTime |
properties.costEntityId |
string |
相关预算 |
properties.creationTime |
string |
创建警报的 dateTime |
properties.definition |
定义警报的类型 |
|
properties.description |
string |
警报描述 |
properties.details |
警报详细信息 |
|
properties.modificationTime |
string |
上次修改警报的 dateTime |
properties.source |
警报源 |
|
properties.status |
警报状态 |
|
properties.statusModificationTime |
string |
上次修改警报状态的 dateTime |
properties.statusModificationUserName |
string |
上次修改警报的用户 |
type |
string |
资源类型。 |
AlertCategory
警报类别
名称 | 类型 | 说明 |
---|---|---|
Billing |
string |
|
Cost |
string |
|
System |
string |
|
Usage |
string |
AlertCriteria
触发警报的条件
名称 | 类型 | 说明 |
---|---|---|
CostThresholdExceeded |
string |
|
CreditThresholdApproaching |
string |
|
CreditThresholdReached |
string |
|
CrossCloudCollectionError |
string |
|
CrossCloudNewDataAvailable |
string |
|
ForecastCostThresholdExceeded |
string |
|
ForecastUsageThresholdExceeded |
string |
|
GeneralThresholdError |
string |
|
InvoiceDueDateApproaching |
string |
|
InvoiceDueDateReached |
string |
|
MultiCurrency |
string |
|
QuotaThresholdApproaching |
string |
|
QuotaThresholdReached |
string |
|
UsageThresholdExceeded |
string |
AlertOperator
用于比较 currentSpend 与 amount 的运算符
名称 | 类型 | 说明 |
---|---|---|
EqualTo |
string |
|
GreaterThan |
string |
|
GreaterThanOrEqualTo |
string |
|
LessThan |
string |
|
LessThanOrEqualTo |
string |
|
None |
string |
AlertSource
警报源
名称 | 类型 | 说明 |
---|---|---|
Preset |
string |
|
User |
string |
AlertStatus
警报状态
名称 | 类型 | 说明 |
---|---|---|
Active |
string |
|
Dismissed |
string |
|
None |
string |
|
Overridden |
string |
|
Resolved |
string |
AlertTimeGrainType
timegrain 节奏的类型
名称 | 类型 | 说明 |
---|---|---|
Annually |
string |
|
BillingAnnual |
string |
|
BillingMonth |
string |
|
BillingQuarter |
string |
|
Monthly |
string |
|
None |
string |
|
Quarterly |
string |
AlertType
警报类型
名称 | 类型 | 说明 |
---|---|---|
Budget |
string |
|
BudgetForecast |
string |
|
Credit |
string |
|
General |
string |
|
Invoice |
string |
|
Quota |
string |
|
xCloud |
string |
Definition
定义警报的类型
名称 | 类型 | 说明 |
---|---|---|
category |
警报类别 |
|
criteria |
触发警报的条件 |
|
type |
警报类型 |
Details
警报详细信息
名称 | 类型 | 说明 |
---|---|---|
amount |
number |
预算阈值金额 |
companyName |
string |
公司名称 |
contactEmails |
string[] |
要联系的电子邮件列表 |
contactGroups |
string[] |
要广播到的操作组列表 |
contactRoles |
string[] |
联系人角色列表 |
currentSpend |
number |
当前支出 |
departmentName |
string |
部门名称 |
enrollmentEndDate |
string |
enrollmentEndDate 的 datetime |
enrollmentNumber |
string |
注册号 |
enrollmentStartDate |
string |
enrollmentStartDate 的 datetime |
invoicingThreshold |
number |
开票阈值 |
meterFilter |
Alert |
要筛选依据的计量数组 |
operator |
用于比较 currentSpend 与 amount 的运算符 |
|
overridingAlert |
string |
重写警报 |
periodStartDate |
string |
periodStartDate 的 datetime |
resourceFilter |
Alert |
要筛选依据的资源数组 |
resourceGroupFilter |
Alert |
要筛选依据的 resourceGroup 数组 |
tagFilter |
要筛选依据的标记 |
|
threshold |
number |
激活此警报的通知阈值百分比(以小数表示) |
timeGrainType |
timegrain 节奏的类型 |
|
triggeredBy |
string |
触发此警报的 notificationId |
unit |
string |
使用的货币单位 |
ErrorDetails
错误的详细信息。
名称 | 类型 | 说明 |
---|---|---|
code |
string |
错误代码。 |
message |
string |
指示操作失败原因的错误消息。 |
ErrorResponse
错误响应指示服务无法处理传入请求。 错误消息中提供了原因。
某些错误响应:
429 TooManyRequests - 请求受到限制。 等待“x-ms-ratelimit-microsoft.consumption-retry-after”标头中指定的时间后重试。
503 ServiceUnavailable - 服务暂时不可用。 等待“Retry-After”标头中指定的时间后重试。
名称 | 类型 | 说明 |
---|---|---|
error |
错误的详细信息。 |
TagFilter
要筛选依据的标记