หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
This article shows how to create and configure Azure Resource Health alerts using the Azure portal, Azure PowerShell, Azure Resource Manager (ARM) templates, and Azure CLI.
Resource Health alerts notify you when your Azure resources experience a change in health status, such as becoming unavailable or degraded. These alerts help you stay informed and respond quickly to service issues affecting your workloads.
Create a Resource Health alert rule in the Service Health portal
- In the Azure portal, select Service Health.
- Select Resource Health.
- Select Add resource health alert.
The Create an alert rule wizard opens the Condition tab, with the Scope tab already populated.
- Follow the steps to create Resource Health alerts, starting from the Condition tab, in the Alert rule wizard.
Create a Resource Health alert using PowerShell
Note
We recommend that you use the Azure Az PowerShell module to interact with Azure. To get started, see Install Azure PowerShell. To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.
To follow the instructions on this page, you need to set up a few things in advance:
- You need to install the Azure PowerShell module.
- You need to create or reuse an Action Group configured to notify you.
Instructions for PowerShell
Use PowerShell to sign-in to Azure using your account, and select the subscription you want to use.
Login-AzAccount Select-AzSubscription -Subscription <subscriptionId>
Note
You can use
Get-AzSubscription
to list the subscriptions you have access to.Find and save the full Azure Resource Manager ID for your Action Group.
(Get-AzActionGroup -ResourceGroupName <resourceGroup> -Name <actionGroup>).Id
Create and save an ARM template for Resource Health alerts as
resourcehealthalert.json
(see details)Create a new Azure Resource Manager deployment using this template.
New-AzResourceGroupDeployment -Name ExampleDeployment -ResourceGroupName <resourceGroup> -TemplateFile <path\to\resourcehealthalert.json>
You're prompted to type in the Alert Name and Action Group Resource ID you copied earlier:
Supply values for the following parameters: (Type !? for Help.) activityLogAlertName: <Alert Name> actionGroupResourceId: /subscriptions/<subscriptionId>/resourceGroups/<resourceGroup>/providers/microsoft.insights/actionGroups/<actionGroup>
If everything worked successfully, you get a confirmation in PowerShell
DeploymentName : ExampleDeployment ResourceGroupName : <resourceGroup> ProvisioningState : Succeeded Timestamp : 11/8/2017 2:32:00 AM Mode : Incremental TemplateLink : Parameters : Name Type Value =============== ========= ========== activityLogAlertName String <Alert Name> activityLogAlertEnabled Bool True actionGroupResourceId String /... Outputs : DeploymentDebugLogLevel :
Note
If you're planning on fully automating this process, you simply need to edit the ARM template to not prompt for the values in Step 5.
Create Resource health alerts using template options
- Base template
- Alert scope
- Resource types
- Health events
- Unknown events
- User initiated events
- Resource Health alert template
- ARM templates
You can use this base template as a starting point for creating Resource Health alerts. This template works as written, and signs you up to receive alerts for all newly activated resource health events across all resources in a subscription.
Note
The Resource Health alert template is a more complex alert template, which should increase the signal to noise ratio for Resource Health alerts as compared to this template.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"activityLogAlertName": {
"type": "string",
"metadata": {
"description": "Unique name (within the Resource Group) for the Activity log alert."
}
},
"actionGroupResourceId": {
"type": "string",
"metadata": {
"description": "Resource Id for the Action group."
}
}
},
"resources": [
{
"type": "Microsoft.Insights/activityLogAlerts",
"apiVersion": "2017-04-01",
"name": "[parameters('activityLogAlertName')]",
"location": "Global",
"properties": {
"enabled": true,
"scopes": [
"[subscription().id]"
],
"condition": {
"allOf": [
{
"field": "category",
"equals": "ResourceHealth"
},
{
"field": "status",
"equals": "Active"
}
]
},
"actions": {
"actionGroups":
[
{
"actionGroupId": "[parameters('actionGroupResourceId')]"
}
]
}
}
}
]
}
However, a broad alert like this one isn't recommended. Learn how we can scope down this alert to focus on the events we care about.
Next steps
Learn more about Resource Health:
- Azure Resource Health overview
- Resource types and health checks available through Azure Resource Health
Create Service Health Alerts: