Namespace: microsoft.graph.security
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.
Activate Microsoft Defender for Identity sensors.
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) |
SecurityIdentitiesSensors.ReadWrite.All |
Not available. |
| Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
| Application |
SecurityIdentitiesSensors.ReadWrite.All |
Not available. |
Important
In delegated scenarios with work or school accounts, the signed-in user must be assigned the Security Administrator Microsoft Entra role or a custom role with supported permissions created through the Microsoft Defender XDR Unified Role-Based Access Control (RBAC).
HTTP request
POST /security/identities/sensorCandidates/activate
Request body
In the request body, supply a JSON representation of the parameters.
The following table lists the parameters that are required when you call this action.
| Parameter |
Type |
Description |
| serverIds |
String collection |
A collection of server identifiers for the sensors to activate. |
Response
If successful, this action returns a 200 OK response code.
Examples
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/security/identities/sensorCandidates/activate
Content-Type: application/json
{
"serverIds": [
"c0633ebb-8cfb-f17a-0b9e-83aa661f53a3"
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Security.Identities.SensorCandidates.MicrosoftGraphSecurityActivate;
var requestBody = new ActivatePostRequestBody
{
ServerIds = new List<string>
{
"c0633ebb-8cfb-f17a-0b9e-83aa661f53a3",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Security.Identities.SensorCandidates.MicrosoftGraphSecurityActivate.PostAsync(requestBody);
// 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"
graphsecurity "github.com/microsoftgraph/msgraph-beta-sdk-go/security"
//other-imports
)
requestBody := graphsecurity.NewActivatePostRequestBody()
serverIds := []string {
"c0633ebb-8cfb-f17a-0b9e-83aa661f53a3",
}
requestBody.SetServerIds(serverIds)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Security().Identities().SensorCandidates().MicrosoftGraphSecurityActivate().Post(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.security.identities.sensorcandidates.microsoftgraphsecurityactivate.ActivatePostRequestBody activatePostRequestBody = new com.microsoft.graph.beta.security.identities.sensorcandidates.microsoftgraphsecurityactivate.ActivatePostRequestBody();
LinkedList<String> serverIds = new LinkedList<String>();
serverIds.add("c0633ebb-8cfb-f17a-0b9e-83aa661f53a3");
activatePostRequestBody.setServerIds(serverIds);
graphClient.security().identities().sensorCandidates().microsoftGraphSecurityActivate().post(activatePostRequestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const activate = {
serverIds: [
'c0633ebb-8cfb-f17a-0b9e-83aa661f53a3'
]
};
await client.api('/security/identities/sensorCandidates/activate')
.version('beta')
.post(activate);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Security\Identities\SensorCandidates\MicrosoftGraphSecurityActivate\ActivatePostRequestBody;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ActivatePostRequestBody();
$requestBody->setServerIds(['c0633ebb-8cfb-f17a-0b9e-83aa661f53a3', ]);
$graphServiceClient->security()->identities()->sensorCandidates()->microsoftGraphSecurityActivate()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.security.identities.sensorcandidates.microsoft_graph_security_activate.activate_post_request_body import ActivatePostRequestBody
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ActivatePostRequestBody(
server_ids = [
"c0633ebb-8cfb-f17a-0b9e-83aa661f53a3",
],
)
await graph_client.security.identities.sensor_candidates.microsoft_graph_security_activate.post(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