POST https://graph.microsoft.com/v1.0/deviceManagement/deviceCompliancePolicies
Content-type: application/json
Content-length: 954
{
"@odata.type": "#microsoft.graph.windows10CompliancePolicy",
"description": "Description value",
"displayName": "Display Name value",
"version": 7,
"passwordRequired": true,
"passwordBlockSimple": true,
"passwordRequiredToUnlockFromIdle": true,
"passwordMinutesOfInactivityBeforeLock": 5,
"passwordExpirationDays": 6,
"passwordMinimumLength": 5,
"passwordMinimumCharacterSetCount": 0,
"passwordRequiredType": "alphanumeric",
"passwordPreviousPasswordBlockCount": 2,
"requireHealthyDeviceReport": true,
"osMinimumVersion": "Os Minimum Version value",
"osMaximumVersion": "Os Maximum Version value",
"mobileOsMinimumVersion": "Mobile Os Minimum Version value",
"mobileOsMaximumVersion": "Mobile Os Maximum Version value",
"earlyLaunchAntiMalwareDriverEnabled": true,
"bitLockerEnabled": true,
"secureBootEnabled": true,
"codeIntegrityEnabled": true,
"storageRequireEncryption": true
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new Windows10CompliancePolicy
{
OdataType = "#microsoft.graph.windows10CompliancePolicy",
Description = "Description value",
DisplayName = "Display Name value",
Version = 7,
PasswordRequired = true,
PasswordBlockSimple = true,
PasswordRequiredToUnlockFromIdle = true,
PasswordMinutesOfInactivityBeforeLock = 5,
PasswordExpirationDays = 6,
PasswordMinimumLength = 5,
PasswordMinimumCharacterSetCount = 0,
PasswordRequiredType = RequiredPasswordType.Alphanumeric,
PasswordPreviousPasswordBlockCount = 2,
RequireHealthyDeviceReport = true,
OsMinimumVersion = "Os Minimum Version value",
OsMaximumVersion = "Os Maximum Version value",
MobileOsMinimumVersion = "Mobile Os Minimum Version value",
MobileOsMaximumVersion = "Mobile Os Maximum Version value",
EarlyLaunchAntiMalwareDriverEnabled = true,
BitLockerEnabled = true,
SecureBootEnabled = true,
CodeIntegrityEnabled = true,
StorageRequireEncryption = true,
};
// To initialize your graphClient, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.DeviceCompliancePolicies.PostAsync(requestBody);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
mgc device-management device-compliance-policies create --body '{\
"@odata.type": "#microsoft.graph.windows10CompliancePolicy",\
"description": "Description value",\
"displayName": "Display Name value",\
"version": 7,\
"passwordRequired": true,\
"passwordBlockSimple": true,\
"passwordRequiredToUnlockFromIdle": true,\
"passwordMinutesOfInactivityBeforeLock": 5,\
"passwordExpirationDays": 6,\
"passwordMinimumLength": 5,\
"passwordMinimumCharacterSetCount": 0,\
"passwordRequiredType": "alphanumeric",\
"passwordPreviousPasswordBlockCount": 2,\
"requireHealthyDeviceReport": true,\
"osMinimumVersion": "Os Minimum Version value",\
"osMaximumVersion": "Os Maximum Version value",\
"mobileOsMinimumVersion": "Mobile Os Minimum Version value",\
"mobileOsMaximumVersion": "Mobile Os Maximum Version value",\
"earlyLaunchAntiMalwareDriverEnabled": true,\
"bitLockerEnabled": true,\
"secureBootEnabled": true,\
"codeIntegrityEnabled": true,\
"storageRequireEncryption": true\
}\
'
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
// 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.NewDeviceCompliancePolicy()
description := "Description value"
requestBody.SetDescription(&description)
displayName := "Display Name value"
requestBody.SetDisplayName(&displayName)
version := int32(7)
requestBody.SetVersion(&version)
passwordRequired := true
requestBody.SetPasswordRequired(&passwordRequired)
passwordBlockSimple := true
requestBody.SetPasswordBlockSimple(&passwordBlockSimple)
passwordRequiredToUnlockFromIdle := true
requestBody.SetPasswordRequiredToUnlockFromIdle(&passwordRequiredToUnlockFromIdle)
passwordMinutesOfInactivityBeforeLock := int32(5)
requestBody.SetPasswordMinutesOfInactivityBeforeLock(&passwordMinutesOfInactivityBeforeLock)
passwordExpirationDays := int32(6)
requestBody.SetPasswordExpirationDays(&passwordExpirationDays)
passwordMinimumLength := int32(5)
requestBody.SetPasswordMinimumLength(&passwordMinimumLength)
passwordMinimumCharacterSetCount := int32(0)
requestBody.SetPasswordMinimumCharacterSetCount(&passwordMinimumCharacterSetCount)
passwordRequiredType := graphmodels.ALPHANUMERIC_REQUIREDPASSWORDTYPE
requestBody.SetPasswordRequiredType(&passwordRequiredType)
passwordPreviousPasswordBlockCount := int32(2)
requestBody.SetPasswordPreviousPasswordBlockCount(&passwordPreviousPasswordBlockCount)
requireHealthyDeviceReport := true
requestBody.SetRequireHealthyDeviceReport(&requireHealthyDeviceReport)
osMinimumVersion := "Os Minimum Version value"
requestBody.SetOsMinimumVersion(&osMinimumVersion)
osMaximumVersion := "Os Maximum Version value"
requestBody.SetOsMaximumVersion(&osMaximumVersion)
mobileOsMinimumVersion := "Mobile Os Minimum Version value"
requestBody.SetMobileOsMinimumVersion(&mobileOsMinimumVersion)
mobileOsMaximumVersion := "Mobile Os Maximum Version value"
requestBody.SetMobileOsMaximumVersion(&mobileOsMaximumVersion)
earlyLaunchAntiMalwareDriverEnabled := true
requestBody.SetEarlyLaunchAntiMalwareDriverEnabled(&earlyLaunchAntiMalwareDriverEnabled)
bitLockerEnabled := true
requestBody.SetBitLockerEnabled(&bitLockerEnabled)
secureBootEnabled := true
requestBody.SetSecureBootEnabled(&secureBootEnabled)
codeIntegrityEnabled := true
requestBody.SetCodeIntegrityEnabled(&codeIntegrityEnabled)
storageRequireEncryption := true
requestBody.SetStorageRequireEncryption(&storageRequireEncryption)
// To initialize your graphClient, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=go
deviceCompliancePolicies, err := graphClient.DeviceManagement().DeviceCompliancePolicies().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);
Windows10CompliancePolicy deviceCompliancePolicy = new Windows10CompliancePolicy();
deviceCompliancePolicy.setOdataType("#microsoft.graph.windows10CompliancePolicy");
deviceCompliancePolicy.setDescription("Description value");
deviceCompliancePolicy.setDisplayName("Display Name value");
deviceCompliancePolicy.setVersion(7);
deviceCompliancePolicy.setPasswordRequired(true);
deviceCompliancePolicy.setPasswordBlockSimple(true);
deviceCompliancePolicy.setPasswordRequiredToUnlockFromIdle(true);
deviceCompliancePolicy.setPasswordMinutesOfInactivityBeforeLock(5);
deviceCompliancePolicy.setPasswordExpirationDays(6);
deviceCompliancePolicy.setPasswordMinimumLength(5);
deviceCompliancePolicy.setPasswordMinimumCharacterSetCount(0);
deviceCompliancePolicy.setPasswordRequiredType(RequiredPasswordType.Alphanumeric);
deviceCompliancePolicy.setPasswordPreviousPasswordBlockCount(2);
deviceCompliancePolicy.setRequireHealthyDeviceReport(true);
deviceCompliancePolicy.setOsMinimumVersion("Os Minimum Version value");
deviceCompliancePolicy.setOsMaximumVersion("Os Maximum Version value");
deviceCompliancePolicy.setMobileOsMinimumVersion("Mobile Os Minimum Version value");
deviceCompliancePolicy.setMobileOsMaximumVersion("Mobile Os Maximum Version value");
deviceCompliancePolicy.setEarlyLaunchAntiMalwareDriverEnabled(true);
deviceCompliancePolicy.setBitLockerEnabled(true);
deviceCompliancePolicy.setSecureBootEnabled(true);
deviceCompliancePolicy.setCodeIntegrityEnabled(true);
deviceCompliancePolicy.setStorageRequireEncryption(true);
DeviceCompliancePolicy result = graphClient.deviceManagement().deviceCompliancePolicies().post(deviceCompliancePolicy);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
const options = {
authProvider,
};
const client = Client.init(options);
const deviceCompliancePolicy = {
'@odata.type': '#microsoft.graph.windows10CompliancePolicy',
description: 'Description value',
displayName: 'Display Name value',
version: 7,
passwordRequired: true,
passwordBlockSimple: true,
passwordRequiredToUnlockFromIdle: true,
passwordMinutesOfInactivityBeforeLock: 5,
passwordExpirationDays: 6,
passwordMinimumLength: 5,
passwordMinimumCharacterSetCount: 0,
passwordRequiredType: 'alphanumeric',
passwordPreviousPasswordBlockCount: 2,
requireHealthyDeviceReport: true,
osMinimumVersion: 'Os Minimum Version value',
osMaximumVersion: 'Os Maximum Version value',
mobileOsMinimumVersion: 'Mobile Os Minimum Version value',
mobileOsMaximumVersion: 'Mobile Os Maximum Version value',
earlyLaunchAntiMalwareDriverEnabled: true,
bitLockerEnabled: true,
secureBootEnabled: true,
codeIntegrityEnabled: true,
storageRequireEncryption: true
};
await client.api('/deviceManagement/deviceCompliancePolicies')
.post(deviceCompliancePolicy);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Windows10CompliancePolicy;
use Microsoft\Graph\Generated\Models\RequiredPasswordType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Windows10CompliancePolicy();
$requestBody->setOdataType('#microsoft.graph.windows10CompliancePolicy');
$requestBody->setDescription('Description value');
$requestBody->setDisplayName('Display Name value');
$requestBody->setVersion(7);
$requestBody->setPasswordRequired(true);
$requestBody->setPasswordBlockSimple(true);
$requestBody->setPasswordRequiredToUnlockFromIdle(true);
$requestBody->setPasswordMinutesOfInactivityBeforeLock(5);
$requestBody->setPasswordExpirationDays(6);
$requestBody->setPasswordMinimumLength(5);
$requestBody->setPasswordMinimumCharacterSetCount(0);
$requestBody->setPasswordRequiredType(new RequiredPasswordType('alphanumeric'));
$requestBody->setPasswordPreviousPasswordBlockCount(2);
$requestBody->setRequireHealthyDeviceReport(true);
$requestBody->setOsMinimumVersion('Os Minimum Version value');
$requestBody->setOsMaximumVersion('Os Maximum Version value');
$requestBody->setMobileOsMinimumVersion('Mobile Os Minimum Version value');
$requestBody->setMobileOsMaximumVersion('Mobile Os Maximum Version value');
$requestBody->setEarlyLaunchAntiMalwareDriverEnabled(true);
$requestBody->setBitLockerEnabled(true);
$requestBody->setSecureBootEnabled(true);
$requestBody->setCodeIntegrityEnabled(true);
$requestBody->setStorageRequireEncryption(true);
$result = $graphServiceClient->deviceManagement()->deviceCompliancePolicies()->post($requestBody)->wait();
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
Import-Module Microsoft.Graph.DeviceManagement
$params = @{
"@odata.type" = "#microsoft.graph.windows10CompliancePolicy"
description = "Description value"
displayName = "Display Name value"
version = 7
passwordRequired = $true
passwordBlockSimple = $true
passwordRequiredToUnlockFromIdle = $true
passwordMinutesOfInactivityBeforeLock =
passwordExpirationDays =
passwordMinimumLength =
passwordMinimumCharacterSetCount =
passwordRequiredType = "alphanumeric"
passwordPreviousPasswordBlockCount =
requireHealthyDeviceReport = $true
osMinimumVersion = "Os Minimum Version value"
osMaximumVersion = "Os Maximum Version value"
mobileOsMinimumVersion = "Mobile Os Minimum Version value"
mobileOsMaximumVersion = "Mobile Os Maximum Version value"
earlyLaunchAntiMalwareDriverEnabled = $true
bitLockerEnabled = $true
secureBootEnabled = $true
codeIntegrityEnabled = $true
storageRequireEncryption = $true
}
New-MgDeviceManagementDeviceCompliancePolicy -BodyParameter $params
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.windows10_compliance_policy import Windows10CompliancePolicy
from msgraph.generated.models.required_password_type import RequiredPasswordType
# To initialize your graph_client, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Windows10CompliancePolicy(
odata_type = "#microsoft.graph.windows10CompliancePolicy",
description = "Description value",
display_name = "Display Name value",
version = 7,
password_required = True,
password_block_simple = True,
password_required_to_unlock_from_idle = True,
password_minutes_of_inactivity_before_lock = 5,
password_expiration_days = 6,
password_minimum_length = 5,
password_minimum_character_set_count = 0,
password_required_type = RequiredPasswordType.Alphanumeric,
password_previous_password_block_count = 2,
require_healthy_device_report = True,
os_minimum_version = "Os Minimum Version value",
os_maximum_version = "Os Maximum Version value",
mobile_os_minimum_version = "Mobile Os Minimum Version value",
mobile_os_maximum_version = "Mobile Os Maximum Version value",
early_launch_anti_malware_driver_enabled = True,
bit_locker_enabled = True,
secure_boot_enabled = True,
code_integrity_enabled = True,
storage_require_encryption = True,
)
result = await graph_client.device_management.device_compliance_policies.post(request_body)
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
以下は、応答の例です。 注: 簡潔にするために、ここに示す応答オブジェクトは切り詰められている場合があります。 実際の呼び出しではすべてのプロパティが返されます。