创建 windows10SecureAssessmentConfiguration
本文内容
命名空间:microsoft.graph
注意: 适用于 Intune 的 Microsoft Graph API 需要适用于租户的活动 Intune 许可证 。
创建新的 windows10SecureAssessmentConfiguration 对象。
此 API 可用于以下国家级云部署 。
全局服务
美国政府 L4
美国政府 L5 (DOD)
由世纪互联运营的中国
✅
✅
✅
✅
权限
要调用此 API,需要以下权限之一。 若要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
DeviceManagementConfiguration.ReadWrite.All
委派(个人 Microsoft 帐户)
不支持。
应用程序
DeviceManagementConfiguration.ReadWrite.All
HTTP 请求
POST /deviceManagement/deviceConfigurations
标头
值
Authorization
持有者 {token}。 必填。 详细了解 身份验证和授权 。
接受
application/json
请求正文
在请求正文中,提供 windows10SecureAssessmentConfiguration 对象的 JSON 表示形式。
下表显示创建 windows10SecureAssessmentConfiguration 时所需的属性。
属性
类型
说明
id
String
实体的键。 继承自 deviceConfiguration
lastModifiedDateTime
DateTimeOffset
上次修改对象的日期/时间。 继承自 deviceConfiguration
createdDateTime
DateTimeOffset
创建对象的日期/时间。 继承自 deviceConfiguration
description
String
管理员提供的设备配置的说明。 继承自 deviceConfiguration
displayName
String
管理员提供的设备配置的名称。 继承自 deviceConfiguration
version
Int32
设备配置的版本。 继承自 deviceConfiguration
launchUri
String
启动安全评估浏览器时指向自动加载的评估的 URL 链接。 它必须是有效的 url (http[s]://msdn.microsoft.com/) 。
configurationAccount
String
用于配置 Windows 设备进行测试的帐户。 用户可以是域帐户 (\user) 、AAD 帐户 () username@tenant.com 或本地帐户 (用户名) 。
allowPrinting
Boolean
指示在测试期间是否允许应用打印。
allowScreenCapture
Boolean
指示在测试期间是否允许屏幕捕获功能。
allowTextSuggestion
Boolean
指示在测试期间是否允许文本建议。
响应
如果成功,此方法在响应正文中返回 201 Created
响应代码和 windows10SecureAssessmentConfiguration 对象。
示例
请求
下面是一个请求示例。
POST https://graph.microsoft.com/v1.0/deviceManagement/deviceConfigurations
Content-type: application/json
Content-length: 359
{
"@odata.type": "#microsoft.graph.windows10SecureAssessmentConfiguration",
"description": "Description value",
"displayName": "Display Name value",
"version": 7,
"launchUri": "Launch Uri value",
"configurationAccount": "Configuration Account value",
"allowPrinting": true,
"allowScreenCapture": true,
"allowTextSuggestion": true
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new Windows10SecureAssessmentConfiguration
{
OdataType = "#microsoft.graph.windows10SecureAssessmentConfiguration",
Description = "Description value",
DisplayName = "Display Name value",
Version = 7,
LaunchUri = "Launch Uri value",
ConfigurationAccount = "Configuration Account value",
AllowPrinting = true,
AllowScreenCapture = true,
AllowTextSuggestion = true,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.DeviceConfigurations.PostAsync(requestBody);
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc device-management device-configurations create --body '{\
"@odata.type": "#microsoft.graph.windows10SecureAssessmentConfiguration",\
"description": "Description value",\
"displayName": "Display Name value",\
"version": 7,\
"launchUri": "Launch Uri value",\
"configurationAccount": "Configuration Account value",\
"allowPrinting": true,\
"allowScreenCapture": true,\
"allowTextSuggestion": true\
}\
'
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewDeviceConfiguration()
description := "Description value"
requestBody.SetDescription(&description)
displayName := "Display Name value"
requestBody.SetDisplayName(&displayName)
version := int32(7)
requestBody.SetVersion(&version)
launchUri := "Launch Uri value"
requestBody.SetLaunchUri(&launchUri)
configurationAccount := "Configuration Account value"
requestBody.SetConfigurationAccount(&configurationAccount)
allowPrinting := true
requestBody.SetAllowPrinting(&allowPrinting)
allowScreenCapture := true
requestBody.SetAllowScreenCapture(&allowScreenCapture)
allowTextSuggestion := true
requestBody.SetAllowTextSuggestion(&allowTextSuggestion)
deviceConfigurations, err := graphClient.DeviceManagement().DeviceConfigurations().Post(context.Background(), requestBody, nil)
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Windows10SecureAssessmentConfiguration deviceConfiguration = new Windows10SecureAssessmentConfiguration();
deviceConfiguration.setOdataType("#microsoft.graph.windows10SecureAssessmentConfiguration");
deviceConfiguration.setDescription("Description value");
deviceConfiguration.setDisplayName("Display Name value");
deviceConfiguration.setVersion(7);
deviceConfiguration.setLaunchUri("Launch Uri value");
deviceConfiguration.setConfigurationAccount("Configuration Account value");
deviceConfiguration.setAllowPrinting(true);
deviceConfiguration.setAllowScreenCapture(true);
deviceConfiguration.setAllowTextSuggestion(true);
DeviceConfiguration result = graphClient.deviceManagement().deviceConfigurations().post(deviceConfiguration);
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
const options = {
authProvider,
};
const client = Client.init(options);
const deviceConfiguration = {
'@odata.type': '#microsoft.graph.windows10SecureAssessmentConfiguration',
description: 'Description value',
displayName: 'Display Name value',
version: 7,
launchUri: 'Launch Uri value',
configurationAccount: 'Configuration Account value',
allowPrinting: true,
allowScreenCapture: true,
allowTextSuggestion: true
};
await client.api('/deviceManagement/deviceConfigurations')
.post(deviceConfiguration);
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Windows10SecureAssessmentConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Windows10SecureAssessmentConfiguration();
$requestBody->setOdataType('#microsoft.graph.windows10SecureAssessmentConfiguration');
$requestBody->setDescription('Description value');
$requestBody->setDisplayName('Display Name value');
$requestBody->setVersion(7);
$requestBody->setLaunchUri('Launch Uri value');
$requestBody->setConfigurationAccount('Configuration Account value');
$requestBody->setAllowPrinting(true);
$requestBody->setAllowScreenCapture(true);
$requestBody->setAllowTextSuggestion(true);
$result = $graphServiceClient->deviceManagement()->deviceConfigurations()->post($requestBody)->wait();
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
Import-Module Microsoft.Graph.DeviceManagement
$params = @{
"@odata.type" = "#microsoft.graph.windows10SecureAssessmentConfiguration"
description = "Description value"
displayName = "Display Name value"
version = 7
launchUri = "Launch Uri value"
configurationAccount = "Configuration Account value"
allowPrinting = $true
allowScreenCapture = $true
allowTextSuggestion = $true
}
New-MgDeviceManagementDeviceConfiguration -BodyParameter $params
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
from msgraph import GraphServiceClient
from msgraph.generated.models.windows10_secure_assessment_configuration import Windows10SecureAssessmentConfiguration
graph_client = GraphServiceClient(credentials, scopes)
request_body = Windows10SecureAssessmentConfiguration(
odata_type = "#microsoft.graph.windows10SecureAssessmentConfiguration",
description = "Description value",
display_name = "Display Name value",
version = 7,
launch_uri = "Launch Uri value",
configuration_account = "Configuration Account value",
allow_printing = True,
allow_screen_capture = True,
allow_text_suggestion = True,
)
result = await graph_client.device_management.device_configurations.post(request_body)
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
响应
下面是一个响应示例。 注意:为简洁起见,可能会截断此处显示的响应对象。 将从实际调用中返回所有属性。
HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 531
{
"@odata.type": "#microsoft.graph.windows10SecureAssessmentConfiguration",
"id": "f60d71be-71be-f60d-be71-0df6be710df6",
"lastModifiedDateTime": "2017-01-01T00:00:35.1329464-08:00",
"createdDateTime": "2017-01-01T00:02:43.5775965-08:00",
"description": "Description value",
"displayName": "Display Name value",
"version": 7,
"launchUri": "Launch Uri value",
"configurationAccount": "Configuration Account value",
"allowPrinting": true,
"allowScreenCapture": true,
"allowTextSuggestion": true
}