PATCH https://graph.microsoft.com/v1.0/deviceManagement/deviceCompliancePolicies/{deviceCompliancePolicyId}
Content-type: application/json
Content-length: 745
{
"@odata.type": "#microsoft.graph.iosCompliancePolicy",
"description": "Description value",
"displayName": "Display Name value",
"version": 7,
"passcodeBlockSimple": true,
"passcodeExpirationDays": 6,
"passcodeMinimumLength": 5,
"passcodeMinutesOfInactivityBeforeLock": 5,
"passcodePreviousPasscodeBlockCount": 2,
"passcodeMinimumCharacterSetCount": 0,
"passcodeRequiredType": "alphanumeric",
"passcodeRequired": true,
"osMinimumVersion": "Os Minimum Version value",
"osMaximumVersion": "Os Maximum Version value",
"securityBlockJailbrokenDevices": true,
"deviceThreatProtectionEnabled": true,
"deviceThreatProtectionRequiredSecurityLevel": "secured",
"managedEmailProfileRequired": true
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new IosCompliancePolicy
{
OdataType = "#microsoft.graph.iosCompliancePolicy",
Description = "Description value",
DisplayName = "Display Name value",
Version = 7,
PasscodeBlockSimple = true,
PasscodeExpirationDays = 6,
PasscodeMinimumLength = 5,
PasscodeMinutesOfInactivityBeforeLock = 5,
PasscodePreviousPasscodeBlockCount = 2,
PasscodeMinimumCharacterSetCount = 0,
PasscodeRequiredType = RequiredPasswordType.Alphanumeric,
PasscodeRequired = true,
OsMinimumVersion = "Os Minimum Version value",
OsMaximumVersion = "Os Maximum Version value",
SecurityBlockJailbrokenDevices = true,
DeviceThreatProtectionEnabled = true,
DeviceThreatProtectionRequiredSecurityLevel = DeviceThreatProtectionLevel.Secured,
ManagedEmailProfileRequired = 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.DeviceCompliancePolicies["{deviceCompliancePolicy-id}"].PatchAsync(requestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
mgc device-management device-compliance-policies patch --device-compliance-policy-id {deviceCompliancePolicy-id} --body '{\
"@odata.type": "#microsoft.graph.iosCompliancePolicy",\
"description": "Description value",\
"displayName": "Display Name value",\
"version": 7,\
"passcodeBlockSimple": true,\
"passcodeExpirationDays": 6,\
"passcodeMinimumLength": 5,\
"passcodeMinutesOfInactivityBeforeLock": 5,\
"passcodePreviousPasscodeBlockCount": 2,\
"passcodeMinimumCharacterSetCount": 0,\
"passcodeRequiredType": "alphanumeric",\
"passcodeRequired": true,\
"osMinimumVersion": "Os Minimum Version value",\
"osMaximumVersion": "Os Maximum Version value",\
"securityBlockJailbrokenDevices": true,\
"deviceThreatProtectionEnabled": true,\
"deviceThreatProtectionRequiredSecurityLevel": "secured",\
"managedEmailProfileRequired": 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)
passcodeBlockSimple := true
requestBody.SetPasscodeBlockSimple(&passcodeBlockSimple)
passcodeExpirationDays := int32(6)
requestBody.SetPasscodeExpirationDays(&passcodeExpirationDays)
passcodeMinimumLength := int32(5)
requestBody.SetPasscodeMinimumLength(&passcodeMinimumLength)
passcodeMinutesOfInactivityBeforeLock := int32(5)
requestBody.SetPasscodeMinutesOfInactivityBeforeLock(&passcodeMinutesOfInactivityBeforeLock)
passcodePreviousPasscodeBlockCount := int32(2)
requestBody.SetPasscodePreviousPasscodeBlockCount(&passcodePreviousPasscodeBlockCount)
passcodeMinimumCharacterSetCount := int32(0)
requestBody.SetPasscodeMinimumCharacterSetCount(&passcodeMinimumCharacterSetCount)
passcodeRequiredType := graphmodels.ALPHANUMERIC_REQUIREDPASSWORDTYPE
requestBody.SetPasscodeRequiredType(&passcodeRequiredType)
passcodeRequired := true
requestBody.SetPasscodeRequired(&passcodeRequired)
osMinimumVersion := "Os Minimum Version value"
requestBody.SetOsMinimumVersion(&osMinimumVersion)
osMaximumVersion := "Os Maximum Version value"
requestBody.SetOsMaximumVersion(&osMaximumVersion)
securityBlockJailbrokenDevices := true
requestBody.SetSecurityBlockJailbrokenDevices(&securityBlockJailbrokenDevices)
deviceThreatProtectionEnabled := true
requestBody.SetDeviceThreatProtectionEnabled(&deviceThreatProtectionEnabled)
deviceThreatProtectionRequiredSecurityLevel := graphmodels.SECURED_DEVICETHREATPROTECTIONLEVEL
requestBody.SetDeviceThreatProtectionRequiredSecurityLevel(&deviceThreatProtectionRequiredSecurityLevel)
managedEmailProfileRequired := true
requestBody.SetManagedEmailProfileRequired(&managedEmailProfileRequired)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
deviceCompliancePolicies, err := graphClient.DeviceManagement().DeviceCompliancePolicies().ByDeviceCompliancePolicyId("deviceCompliancePolicy-id").Patch(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);
IosCompliancePolicy deviceCompliancePolicy = new IosCompliancePolicy();
deviceCompliancePolicy.setOdataType("#microsoft.graph.iosCompliancePolicy");
deviceCompliancePolicy.setDescription("Description value");
deviceCompliancePolicy.setDisplayName("Display Name value");
deviceCompliancePolicy.setVersion(7);
deviceCompliancePolicy.setPasscodeBlockSimple(true);
deviceCompliancePolicy.setPasscodeExpirationDays(6);
deviceCompliancePolicy.setPasscodeMinimumLength(5);
deviceCompliancePolicy.setPasscodeMinutesOfInactivityBeforeLock(5);
deviceCompliancePolicy.setPasscodePreviousPasscodeBlockCount(2);
deviceCompliancePolicy.setPasscodeMinimumCharacterSetCount(0);
deviceCompliancePolicy.setPasscodeRequiredType(RequiredPasswordType.Alphanumeric);
deviceCompliancePolicy.setPasscodeRequired(true);
deviceCompliancePolicy.setOsMinimumVersion("Os Minimum Version value");
deviceCompliancePolicy.setOsMaximumVersion("Os Maximum Version value");
deviceCompliancePolicy.setSecurityBlockJailbrokenDevices(true);
deviceCompliancePolicy.setDeviceThreatProtectionEnabled(true);
deviceCompliancePolicy.setDeviceThreatProtectionRequiredSecurityLevel(DeviceThreatProtectionLevel.Secured);
deviceCompliancePolicy.setManagedEmailProfileRequired(true);
DeviceCompliancePolicy result = graphClient.deviceManagement().deviceCompliancePolicies().byDeviceCompliancePolicyId("{deviceCompliancePolicy-id}").patch(deviceCompliancePolicy);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const deviceCompliancePolicy = {
'@odata.type': '#microsoft.graph.iosCompliancePolicy',
description: 'Description value',
displayName: 'Display Name value',
version: 7,
passcodeBlockSimple: true,
passcodeExpirationDays: 6,
passcodeMinimumLength: 5,
passcodeMinutesOfInactivityBeforeLock: 5,
passcodePreviousPasscodeBlockCount: 2,
passcodeMinimumCharacterSetCount: 0,
passcodeRequiredType: 'alphanumeric',
passcodeRequired: true,
osMinimumVersion: 'Os Minimum Version value',
osMaximumVersion: 'Os Maximum Version value',
securityBlockJailbrokenDevices: true,
deviceThreatProtectionEnabled: true,
deviceThreatProtectionRequiredSecurityLevel: 'secured',
managedEmailProfileRequired: true
};
await client.api('/deviceManagement/deviceCompliancePolicies/{deviceCompliancePolicyId}')
.update(deviceCompliancePolicy);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\IosCompliancePolicy;
use Microsoft\Graph\Generated\Models\RequiredPasswordType;
use Microsoft\Graph\Generated\Models\DeviceThreatProtectionLevel;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new IosCompliancePolicy();
$requestBody->setOdataType('#microsoft.graph.iosCompliancePolicy');
$requestBody->setDescription('Description value');
$requestBody->setDisplayName('Display Name value');
$requestBody->setVersion(7);
$requestBody->setPasscodeBlockSimple(true);
$requestBody->setPasscodeExpirationDays(6);
$requestBody->setPasscodeMinimumLength(5);
$requestBody->setPasscodeMinutesOfInactivityBeforeLock(5);
$requestBody->setPasscodePreviousPasscodeBlockCount(2);
$requestBody->setPasscodeMinimumCharacterSetCount(0);
$requestBody->setPasscodeRequiredType(new RequiredPasswordType('alphanumeric'));
$requestBody->setPasscodeRequired(true);
$requestBody->setOsMinimumVersion('Os Minimum Version value');
$requestBody->setOsMaximumVersion('Os Maximum Version value');
$requestBody->setSecurityBlockJailbrokenDevices(true);
$requestBody->setDeviceThreatProtectionEnabled(true);
$requestBody->setDeviceThreatProtectionRequiredSecurityLevel(new DeviceThreatProtectionLevel('secured'));
$requestBody->setManagedEmailProfileRequired(true);
$result = $graphServiceClient->deviceManagement()->deviceCompliancePolicies()->byDeviceCompliancePolicyId('deviceCompliancePolicy-id')->patch($requestBody)->wait();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.DeviceManagement
$params = @{
"@odata.type" = "#microsoft.graph.iosCompliancePolicy"
description = "Description value"
displayName = "Display Name value"
version = 7
passcodeBlockSimple = $true
passcodeExpirationDays =
passcodeMinimumLength =
passcodeMinutesOfInactivityBeforeLock =
passcodePreviousPasscodeBlockCount =
passcodeMinimumCharacterSetCount =
passcodeRequiredType = "alphanumeric"
passcodeRequired = $true
osMinimumVersion = "Os Minimum Version value"
osMaximumVersion = "Os Maximum Version value"
securityBlockJailbrokenDevices = $true
deviceThreatProtectionEnabled = $true
deviceThreatProtectionRequiredSecurityLevel = "secured"
managedEmailProfileRequired = $true
}
Update-MgDeviceManagementDeviceCompliancePolicy -DeviceCompliancePolicyId $deviceCompliancePolicyId -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.ios_compliance_policy import IosCompliancePolicy
from msgraph.generated.models.required_password_type import RequiredPasswordType
from msgraph.generated.models.device_threat_protection_level import DeviceThreatProtectionLevel
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = IosCompliancePolicy(
odata_type = "#microsoft.graph.iosCompliancePolicy",
description = "Description value",
display_name = "Display Name value",
version = 7,
passcode_block_simple = True,
passcode_expiration_days = 6,
passcode_minimum_length = 5,
passcode_minutes_of_inactivity_before_lock = 5,
passcode_previous_passcode_block_count = 2,
passcode_minimum_character_set_count = 0,
passcode_required_type = RequiredPasswordType.Alphanumeric,
passcode_required = True,
os_minimum_version = "Os Minimum Version value",
os_maximum_version = "Os Maximum Version value",
security_block_jailbroken_devices = True,
device_threat_protection_enabled = True,
device_threat_protection_required_security_level = DeviceThreatProtectionLevel.Secured,
managed_email_profile_required = True,
)
result = await graph_client.device_management.device_compliance_policies.by_device_compliance_policy_id('deviceCompliancePolicy-id').patch(request_body)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。