Namespace: microsoft.graph
Importante
As APIs na versão /beta no Microsoft Graph estão sujeitas a alterações. Não há suporte para o uso dessas APIs em aplicativos de produção. Para determinar se uma API está disponível na v1.0, use o seletor Versão.
Atualize uma propriedade de alerta editável em qualquer solução integrada para manter o alerta status e as atribuições sincronizadas entre soluções. Este método atualiza qualquer solução que tenha um registo do ID de alerta referenciado.
Esta API está disponível nas seguintes implementações de cloud nacionais.
| Serviço global |
US Government L4 |
US Government L5 (DOD) |
China operada pela 21Vianet |
| ✅ |
✅ |
✅ |
❌ |
Permissões
Escolha a permissão ou permissões marcadas como menos privilegiadas para esta API. Utilize uma permissão ou permissões com privilégios mais elevados apenas se a sua aplicação o exigir. Para obter detalhes sobre as permissões delegadas e de aplicação, veja Tipos de permissão. Para saber mais sobre estas permissões, veja a referência de permissões.
| Tipo de permissão |
Permissões com menos privilégios |
Permissões com privilégios superiores |
| Delegado (conta corporativa ou de estudante) |
SecurityEvents.ReadWrite.All |
Indisponível. |
| Delegado (conta pessoal da Microsoft) |
Sem suporte. |
Sem suporte. |
| Application |
SecurityEvents.ReadWrite.All |
Indisponível. |
Solicitação HTTP
Nota: Tem de incluir o ID do alerta como um parâmetro e vendorInformation que contém o provider e vendor com este método.
PATCH /security/alerts/{alert_id}
| Nome |
Descrição |
| Autorização |
Portador {código}. Obrigatório. |
| Preferir |
return=representation. Opcional. |
Corpo da solicitação
No corpo do pedido, forneça uma representação JSON dos valores para campos relevantes que devem ser atualizados. O corpo tem de conter a propriedade vendorInformation com campos e vendor válidosprovider. A tabela seguinte lista os campos que podem ser atualizados para um alerta. Os valores das propriedades existentes que não estão incluídas no corpo do pedido não serão alterados. Para alcançar o melhor desempenho, não inclua valores existentes que não foram alterados.
| Propriedade |
Tipo |
Descrição |
| assignedTo |
Cadeia de caracteres |
Nome do analista a que o alerta está atribuído para triagem, investigação ou remediação. |
| closedDateTime |
DateTimeOffset |
Tempo em que o alerta foi fechado. O tipo Timestamp representa informações de data e hora usando o formato ISO 8601 e está sempre no horário UTC. Por exemplo, meia-noite UTC em 1 de janeiro de 2014 é 2014-01-01T00:00:00Z. |
| comentários |
String collection |
Comentários do analista sobre o alerta (para gestão de alertas de clientes). Este método pode atualizar o campo de comentários apenas com os seguintes valores: Closed in IPC, Closed in MCAS. |
| comentários |
enumeração alertFeedback |
Comentários do analista no alerta. Os valores possíveis são: unknown, truePositive, falsePositive, benignPositive. |
| status |
enum alertStatus |
Ciclo de vida do alerta status (fase). Os valores possíveis são: unknown, newAlert, inProgress, resolved. |
| tags |
String collection |
Etiquetas definíveis pelo utilizador que podem ser aplicadas a um alerta e que podem servir como condições de filtro (por exemplo, "HVA", "SAW"). |
| vendorInformation |
securityVendorInformation |
Tipo complexo que contém detalhes sobre o produto/fornecedor de serviços de segurança, fornecedor e subprovididor (por exemplo, vendor=Microsoft; provider=Windows Defender ATP; subProvider=AppLocker).
Os campos fornecedor e fornecedor são obrigatórios. |
Resposta
Se tiver êxito, este método retornará um código de resposta 204 No Content.
Se for utilizado o cabeçalho do pedido opcional, o método devolve um 200 OK código de resposta e um objeto de alerta atualizado no corpo da resposta.
Exemplos
Solicitação
O exemplo seguinte mostra um pedido sem o Prefer cabeçalho.
PATCH https://graph.microsoft.com/beta/security/alerts/{alert_id}
Content-type: application/json
{
"assignedTo": "String",
"closedDateTime": "String (timestamp)",
"comments": ["String"],
"feedback": "@odata.type: microsoft.graph.alertFeedback",
"status": "@odata.type: microsoft.graph.alertStatus",
"tags": ["String"],
"vendorInformation":
{
"provider": "String",
"vendor": "String"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Alert
{
AssignedTo = "String",
ClosedDateTime = DateTimeOffset.Parse("String (timestamp)"),
Comments = new List<string>
{
"String",
},
Feedback = AlertFeedback.Unknown,
Status = AlertStatus.Unknown,
Tags = new List<string>
{
"String",
},
VendorInformation = new SecurityVendorInformation
{
Provider = "String",
Vendor = "String",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Security.Alerts["{alert-id}"].PatchAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
"time"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewAlert()
assignedTo := "String"
requestBody.SetAssignedTo(&assignedTo)
closedDateTime , err := time.Parse(time.RFC3339, "String (timestamp)")
requestBody.SetClosedDateTime(&closedDateTime)
comments := []string {
"String",
}
requestBody.SetComments(comments)
feedback := graphmodels.ALERTFEEDBACK_GRAPH_TYPE: MICROSOFT_@ODATA_ALERTFEEDBACK
requestBody.SetFeedback(&feedback)
status := graphmodels.ALERTSTATUS_GRAPH_TYPE: MICROSOFT_@ODATA_ALERTSTATUS
requestBody.SetStatus(&status)
tags := []string {
"String",
}
requestBody.SetTags(tags)
vendorInformation := graphmodels.NewSecurityVendorInformation()
provider := "String"
vendorInformation.SetProvider(&provider)
vendor := "String"
vendorInformation.SetVendor(&vendor)
requestBody.SetVendorInformation(vendorInformation)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
alerts, err := graphClient.Security().Alerts().ByAlertId("alert-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);
Alert alert = new Alert();
alert.setAssignedTo("String");
OffsetDateTime closedDateTime = OffsetDateTime.parse("String (timestamp)");
alert.setClosedDateTime(closedDateTime);
LinkedList<String> comments = new LinkedList<String>();
comments.add("String");
alert.setComments(comments);
alert.setFeedback(AlertFeedback.Unknown);
alert.setStatus(AlertStatus.Unknown);
LinkedList<String> tags = new LinkedList<String>();
tags.add("String");
alert.setTags(tags);
SecurityVendorInformation vendorInformation = new SecurityVendorInformation();
vendorInformation.setProvider("String");
vendorInformation.setVendor("String");
alert.setVendorInformation(vendorInformation);
Alert result = graphClient.security().alerts().byAlertId("{alert-id}").patch(alert);
const options = {
authProvider,
};
const client = Client.init(options);
const alert = {
assignedTo: 'String',
closedDateTime: 'String (timestamp)',
comments: ['String'],
feedback: '@odata.type: microsoft.graph.alertFeedback',
status: '@odata.type: microsoft.graph.alertStatus',
tags: ['String'],
vendorInformation:
{
provider: 'String',
vendor: 'String'
}
};
await client.api('/security/alerts/{alert_id}')
.version('beta')
.update(alert);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Alert;
use Microsoft\Graph\Beta\Generated\Models\AlertFeedback;
use Microsoft\Graph\Beta\Generated\Models\AlertStatus;
use Microsoft\Graph\Beta\Generated\Models\SecurityVendorInformation;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Alert();
$requestBody->setAssignedTo('String');
$requestBody->setClosedDateTime(new \DateTime('String (timestamp)'));
$requestBody->setComments(['String', ]);
$requestBody->setFeedback(new AlertFeedback('alertFeedback'));
$requestBody->setStatus(new AlertStatus('alertStatus'));
$requestBody->setTags(['String', ]);
$vendorInformation = new SecurityVendorInformation();
$vendorInformation->setProvider('String');
$vendorInformation->setVendor('String');
$requestBody->setVendorInformation($vendorInformation);
$result = $graphServiceClient->security()->alerts()->byAlertId('alert-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Security
$params = @{
assignedTo = "String"
closedDateTime = [System.DateTime]::Parse("String (timestamp)")
comments = @(
"String"
)
feedback = "@odata.type: microsoft.graph.alertFeedback"
status = "@odata.type: microsoft.graph.alertStatus"
tags = @(
"String"
)
vendorInformation = @{
provider = "String"
vendor = "String"
}
}
Update-MgBetaSecurityAlert -AlertId $alertId -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.alert import Alert
from msgraph_beta.generated.models.alert_feedback import AlertFeedback
from msgraph_beta.generated.models.alert_status import AlertStatus
from msgraph_beta.generated.models.security_vendor_information import SecurityVendorInformation
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Alert(
assigned_to = "String",
closed_date_time = "String (timestamp)",
comments = [
"String",
],
feedback = AlertFeedback.Unknown,
status = AlertStatus.Unknown,
tags = [
"String",
],
vendor_information = SecurityVendorInformation(
provider = "String",
vendor = "String",
),
)
result = await graph_client.security.alerts.by_alert_id('alert-id').patch(request_body)
Resposta
Veja a seguir o exemplo de uma resposta bem-sucedida.
HTTP/1.1 204 No Content
Solicitação
O exemplo seguinte mostra um pedido que inclui o cabeçalho do Prefer pedido.
PATCH https://graph.microsoft.com/beta/security/alerts/{alert_id}
Content-type: application/json
Prefer: return=representation
{
"assignedTo": "String",
"closedDateTime": "String (timestamp)",
"comments": ["String"],
"feedback": "@odata.type: microsoft.graph.alertFeedback",
"status": "@odata.type: microsoft.graph.alertStatus",
"tags": ["String"],
"vendorInformation":
{
"provider": "String",
"vendor": "String"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Alert
{
AssignedTo = "String",
ClosedDateTime = DateTimeOffset.Parse("String (timestamp)"),
Comments = new List<string>
{
"String",
},
Feedback = AlertFeedback.Unknown,
Status = AlertStatus.Unknown,
Tags = new List<string>
{
"String",
},
VendorInformation = new SecurityVendorInformation
{
Provider = "String",
Vendor = "String",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Security.Alerts["{alert-id}"].PatchAsync(requestBody, (requestConfiguration) =>
{
requestConfiguration.Headers.Add("Prefer", "return=representation");
});
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
"time"
abstractions "github.com/microsoft/kiota-abstractions-go"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
graphsecurity "github.com/microsoftgraph/msgraph-beta-sdk-go/security"
//other-imports
)
headers := abstractions.NewRequestHeaders()
headers.Add("Prefer", "return=representation")
configuration := &graphsecurity.AlertsItemRequestBuilderPatchRequestConfiguration{
Headers: headers,
}
requestBody := graphmodels.NewAlert()
assignedTo := "String"
requestBody.SetAssignedTo(&assignedTo)
closedDateTime , err := time.Parse(time.RFC3339, "String (timestamp)")
requestBody.SetClosedDateTime(&closedDateTime)
comments := []string {
"String",
}
requestBody.SetComments(comments)
feedback := graphmodels.ALERTFEEDBACK_GRAPH_TYPE: MICROSOFT_@ODATA_ALERTFEEDBACK
requestBody.SetFeedback(&feedback)
status := graphmodels.ALERTSTATUS_GRAPH_TYPE: MICROSOFT_@ODATA_ALERTSTATUS
requestBody.SetStatus(&status)
tags := []string {
"String",
}
requestBody.SetTags(tags)
vendorInformation := graphmodels.NewSecurityVendorInformation()
provider := "String"
vendorInformation.SetProvider(&provider)
vendor := "String"
vendorInformation.SetVendor(&vendor)
requestBody.SetVendorInformation(vendorInformation)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
alerts, err := graphClient.Security().Alerts().ByAlertId("alert-id").Patch(context.Background(), requestBody, configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Alert alert = new Alert();
alert.setAssignedTo("String");
OffsetDateTime closedDateTime = OffsetDateTime.parse("String (timestamp)");
alert.setClosedDateTime(closedDateTime);
LinkedList<String> comments = new LinkedList<String>();
comments.add("String");
alert.setComments(comments);
alert.setFeedback(AlertFeedback.Unknown);
alert.setStatus(AlertStatus.Unknown);
LinkedList<String> tags = new LinkedList<String>();
tags.add("String");
alert.setTags(tags);
SecurityVendorInformation vendorInformation = new SecurityVendorInformation();
vendorInformation.setProvider("String");
vendorInformation.setVendor("String");
alert.setVendorInformation(vendorInformation);
Alert result = graphClient.security().alerts().byAlertId("{alert-id}").patch(alert, requestConfiguration -> {
requestConfiguration.headers.add("Prefer", "return=representation");
});
const options = {
authProvider,
};
const client = Client.init(options);
const alert = {
assignedTo: 'String',
closedDateTime: 'String (timestamp)',
comments: ['String'],
feedback: '@odata.type: microsoft.graph.alertFeedback',
status: '@odata.type: microsoft.graph.alertStatus',
tags: ['String'],
vendorInformation:
{
provider: 'String',
vendor: 'String'
}
};
await client.api('/security/alerts/{alert_id}')
.version('beta')
.update(alert);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Security\Alerts\Item\AlertItemRequestBuilderPatchRequestConfiguration;
use Microsoft\Graph\Beta\Generated\Models\Alert;
use Microsoft\Graph\Beta\Generated\Models\AlertFeedback;
use Microsoft\Graph\Beta\Generated\Models\AlertStatus;
use Microsoft\Graph\Beta\Generated\Models\SecurityVendorInformation;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Alert();
$requestBody->setAssignedTo('String');
$requestBody->setClosedDateTime(new \DateTime('String (timestamp)'));
$requestBody->setComments(['String', ]);
$requestBody->setFeedback(new AlertFeedback('alertFeedback'));
$requestBody->setStatus(new AlertStatus('alertStatus'));
$requestBody->setTags(['String', ]);
$vendorInformation = new SecurityVendorInformation();
$vendorInformation->setProvider('String');
$vendorInformation->setVendor('String');
$requestBody->setVendorInformation($vendorInformation);
$requestConfiguration = new AlertItemRequestBuilderPatchRequestConfiguration();
$headers = [
'Prefer' => 'return=representation',
];
$requestConfiguration->headers = $headers;
$result = $graphServiceClient->security()->alerts()->byAlertId('alert-id')->patch($requestBody, $requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Security
$params = @{
assignedTo = "String"
closedDateTime = [System.DateTime]::Parse("String (timestamp)")
comments = @(
"String"
)
feedback = "@odata.type: microsoft.graph.alertFeedback"
status = "@odata.type: microsoft.graph.alertStatus"
tags = @(
"String"
)
vendorInformation = @{
provider = "String"
vendor = "String"
}
}
Update-MgBetaSecurityAlert -AlertId $alertId -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.security.alerts.item.alert_item_request_builder import AlertItemRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
from msgraph_beta.generated.models.alert import Alert
from msgraph_beta.generated.models.alert_feedback import AlertFeedback
from msgraph_beta.generated.models.alert_status import AlertStatus
from msgraph_beta.generated.models.security_vendor_information import SecurityVendorInformation
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Alert(
assigned_to = "String",
closed_date_time = "String (timestamp)",
comments = [
"String",
],
feedback = AlertFeedback.Unknown,
status = AlertStatus.Unknown,
tags = [
"String",
],
vendor_information = SecurityVendorInformation(
provider = "String",
vendor = "String",
),
)
request_configuration = RequestConfiguration()
request_configuration.headers.add("Prefer", "return=representation")
result = await graph_client.security.alerts.by_alert_id('alert-id').patch(request_body, request_configuration = request_configuration)
Resposta
Segue-se um exemplo da resposta quando é utilizado o cabeçalho do pedido opcional Prefer: return=representation .
Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.
HTTP/1.1 200 OK
Content-type: application/json
{
"activityGroupName": "activityGroupName-value",
"assignedTo": "assignedTo-value",
"azureSubscriptionId": "azureSubscriptionId-value",
"azureTenantId": "azureTenantId-value",
"category": "category-value",
"closedDateTime": "datetime-value"
}