Namespace: microsoft.graph.healthMonitoring
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Update the properties of a Microsoft Entra health monitoring alertConfiguration object. You can use alertConfiguration settings to specify the distribution groups where alert notifications are to be sent.
This API doesn't currently support group validation.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
❌ |
❌ |
❌ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
HealthMonitoringAlertConfig.ReadWrite.All |
Not available. |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
Not supported. |
Not supported. |
Important
In addition to the delegated permissions, the signed-in user needs to belong to a Microsoft Entra role that allows them to update alert configurations. The following least privileged roles are supported for this operation.
- Security Administrator
- Helpdesk Administrator
HTTP request
PATCH /reports/healthMonitoring/alertConfigurations/{alertConfigurationId}
Request body
In the request body, supply only the values for properties to update. Existing properties that aren't included in the request body maintain their previous values or are recalculated based on changes to other property values.
The following table specifies the properties that can be updated.
Property |
Type |
Description |
emailNotificationConfigurations |
microsoft.graph.healthMonitoring.emailNotificationConfiguration collection |
Email notification settings for the particular alert type. Currently, only one email notification configuration is supported for an alert configuration, meaning just one group will receive notifications for an alert type. |
Response
If successful, this method returns a 200 OK
response code and an updated microsoft.graph.healthMonitoring.alertConfiguration object in the response body.
Examples
Request
The following example shows a request. It currently supports only 1 group to receive email notification for an alert type.
PATCH https://graph.microsoft.com/beta/reports/healthMonitoring/alertConfigurations/{alertConfigurationId}
Content-Type: application/json
{
"emailNotificationConfigurations": [
{
"groupId":"c5140914-9507-4180-b60c-04d5ec5eddcb",
"isEnabled": true
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models.HealthMonitoring;
var requestBody = new AlertConfiguration
{
EmailNotificationConfigurations = new List<EmailNotificationConfiguration>
{
new EmailNotificationConfiguration
{
GroupId = "c5140914-9507-4180-b60c-04d5ec5eddcb",
IsEnabled = true,
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Reports.HealthMonitoring.AlertConfigurations["{alertConfiguration-id}"].PatchAsync(requestBody);
mgc-beta reports health-monitoring alert-configurations patch --alert-configuration-id {alertConfiguration-id} --body '{\
"emailNotificationConfigurations": [\
{\
"groupId":"c5140914-9507-4180-b60c-04d5ec5eddcb",\
"isEnabled": true\
}\
]\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodelshealthmonitoring "github.com/microsoftgraph/msgraph-beta-sdk-go/models/healthmonitoring"
//other-imports
)
requestBody := graphmodelshealthmonitoring.NewAlertConfiguration()
emailNotificationConfiguration := graphmodelshealthmonitoring.NewEmailNotificationConfiguration()
groupId := "c5140914-9507-4180-b60c-04d5ec5eddcb"
emailNotificationConfiguration.SetGroupId(&groupId)
isEnabled := true
emailNotificationConfiguration.SetIsEnabled(&isEnabled)
emailNotificationConfigurations := []graphmodelshealthmonitoring.EmailNotificationConfigurationable {
emailNotificationConfiguration,
}
requestBody.SetEmailNotificationConfigurations(emailNotificationConfigurations)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
alertConfigurations, err := graphClient.Reports().HealthMonitoring().AlertConfigurations().ByAlertConfigurationId("alertConfiguration-id").Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.models.healthmonitoring.AlertConfiguration alertConfiguration = new com.microsoft.graph.beta.models.healthmonitoring.AlertConfiguration();
LinkedList<com.microsoft.graph.beta.models.healthmonitoring.EmailNotificationConfiguration> emailNotificationConfigurations = new LinkedList<com.microsoft.graph.beta.models.healthmonitoring.EmailNotificationConfiguration>();
com.microsoft.graph.beta.models.healthmonitoring.EmailNotificationConfiguration emailNotificationConfiguration = new com.microsoft.graph.beta.models.healthmonitoring.EmailNotificationConfiguration();
emailNotificationConfiguration.setGroupId("c5140914-9507-4180-b60c-04d5ec5eddcb");
emailNotificationConfiguration.setIsEnabled(true);
emailNotificationConfigurations.add(emailNotificationConfiguration);
alertConfiguration.setEmailNotificationConfigurations(emailNotificationConfigurations);
com.microsoft.graph.models.healthmonitoring.AlertConfiguration result = graphClient.reports().healthMonitoring().alertConfigurations().byAlertConfigurationId("{alertConfiguration-id}").patch(alertConfiguration);
const options = {
authProvider,
};
const client = Client.init(options);
const alertConfiguration = {
emailNotificationConfigurations: [
{
groupId: 'c5140914-9507-4180-b60c-04d5ec5eddcb',
isEnabled: true
}
]
};
await client.api('/reports/healthMonitoring/alertConfigurations/{alertConfigurationId}')
.version('beta')
.update(alertConfiguration);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\HealthMonitoring\AlertConfiguration;
use Microsoft\Graph\Beta\Generated\Models\HealthMonitoring\EmailNotificationConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AlertConfiguration();
$emailNotificationConfigurationsEmailNotificationConfiguration1 = new EmailNotificationConfiguration();
$emailNotificationConfigurationsEmailNotificationConfiguration1->setGroupId('c5140914-9507-4180-b60c-04d5ec5eddcb');
$emailNotificationConfigurationsEmailNotificationConfiguration1->setIsEnabled(true);
$emailNotificationConfigurationsArray []= $emailNotificationConfigurationsEmailNotificationConfiguration1;
$requestBody->setEmailNotificationConfigurations($emailNotificationConfigurationsArray);
$result = $graphServiceClient->reports()->healthMonitoring()->alertConfigurations()->byAlertConfigurationId('alertConfiguration-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Reports
$params = @{
emailNotificationConfigurations = @(
@{
groupId = "c5140914-9507-4180-b60c-04d5ec5eddcb"
isEnabled = $true
}
)
}
Update-MgBetaReportHealthMonitoringAlertConfiguration -AlertConfigurationId $alertConfigurationId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.health_monitoring.alert_configuration import AlertConfiguration
from msgraph_beta.generated.models.health_monitoring.email_notification_configuration import EmailNotificationConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AlertConfiguration(
email_notification_configurations = [
EmailNotificationConfiguration(
group_id = "c5140914-9507-4180-b60c-04d5ec5eddcb",
is_enabled = True,
),
],
)
result = await graph_client.reports.health_monitoring.alert_configurations.by_alert_configuration_id('alertConfiguration-id').patch(request_body)
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#reports/healthMonitoring/alertConfigurations/$entity",
"id": "mfaSignInFailure",
"emailNotificationConfigurations": [
{
"groupId": "c5140914-9507-4180-b60c-04d5ec5eddcb",
"isEnabled": true
}
]
}