Cree un nuevo objeto targetDeviceGroup para el objeto remoteDesktopSecurityConfiguration en servicePrincipal. Puede configurar un máximo de 10 grupos de dispositivos de destino para el objeto remoteDesktopSecurityConfiguraiton en servicePrincipal.
Elija el permiso o los permisos marcados como con privilegios mínimos para esta API. Use un permiso o permisos con privilegios superiores solo si la aplicación lo requiere. Para obtener más información sobre los permisos delegados y de aplicación, consulte Tipos de permisos. Para obtener más información sobre estos permisos, consulte la referencia de permisos.
En escenarios delegados con cuentas profesionales o educativas, el usuario que ha iniciado sesión debe ser propietario o miembro del grupo o tener asignado un rol de Microsoft Entra compatible o un rol personalizado con un permiso de rol admitido. Se admiten los siguientes roles con privilegios mínimos para esta operación.
Administrador de la aplicación
Administrador de aplicaciones en la nube
Solicitud HTTP
POST /servicePrincipals/{servicePrincipalsId}/remoteDesktopSecurityConfiguration/targetDeviceGroups
POST https://graph.microsoft.com/v1.0/servicePrincipals/00af5dfb-85da-4b41-a677-0c6b86dd34f8/remoteDesktopSecurityConfiguration/targetDeviceGroups
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.targetDeviceGroup",
"id": "b9e4eae4-b781-45a1-ce65-f2dd8ac3b696",
"displayName": "Device Group A"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new TargetDeviceGroup
{
OdataType = "#microsoft.graph.targetDeviceGroup",
Id = "b9e4eae4-b781-45a1-ce65-f2dd8ac3b696",
DisplayName = "Device Group A",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.ServicePrincipals["{servicePrincipal-id}"].RemoteDesktopSecurityConfiguration.TargetDeviceGroups.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewTargetDeviceGroup()
id := "b9e4eae4-b781-45a1-ce65-f2dd8ac3b696"
requestBody.SetId(&id)
displayName := "Device Group A"
requestBody.SetDisplayName(&displayName)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
targetDeviceGroups, err := graphClient.ServicePrincipals().ByServicePrincipalId("servicePrincipal-id").RemoteDesktopSecurityConfiguration().TargetDeviceGroups().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
TargetDeviceGroup targetDeviceGroup = new TargetDeviceGroup();
targetDeviceGroup.setOdataType("#microsoft.graph.targetDeviceGroup");
targetDeviceGroup.setId("b9e4eae4-b781-45a1-ce65-f2dd8ac3b696");
targetDeviceGroup.setDisplayName("Device Group A");
TargetDeviceGroup result = graphClient.servicePrincipals().byServicePrincipalId("{servicePrincipal-id}").remoteDesktopSecurityConfiguration().targetDeviceGroups().post(targetDeviceGroup);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\TargetDeviceGroup;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new TargetDeviceGroup();
$requestBody->setOdataType('#microsoft.graph.targetDeviceGroup');
$requestBody->setId('b9e4eae4-b781-45a1-ce65-f2dd8ac3b696');
$requestBody->setDisplayName('Device Group A');
$result = $graphServiceClient->servicePrincipals()->byServicePrincipalId('servicePrincipal-id')->remoteDesktopSecurityConfiguration()->targetDeviceGroups()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.target_device_group import TargetDeviceGroup
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = TargetDeviceGroup(
odata_type = "#microsoft.graph.targetDeviceGroup",
id = "b9e4eae4-b781-45a1-ce65-f2dd8ac3b696",
display_name = "Device Group A",
)
result = await graph_client.service_principals.by_service_principal_id('servicePrincipal-id').remote_desktop_security_configuration.target_device_groups.post(request_body)