PATCH https://graph.microsoft.com/v1.0/deviceManagement/deviceCompliancePolicies/{deviceCompliancePolicyId}
Content-type: application/json
Content-length: 1170
{
"@odata.type": "#microsoft.graph.androidWorkProfileCompliancePolicy",
"description": "Description value",
"displayName": "Display Name value",
"version": 7,
"passwordRequired": true,
"passwordMinimumLength": 5,
"passwordRequiredType": "alphabetic",
"passwordMinutesOfInactivityBeforeLock": 5,
"passwordExpirationDays": 6,
"passwordPreviousPasswordBlockCount": 2,
"securityPreventInstallAppsFromUnknownSources": true,
"securityDisableUsbDebugging": true,
"securityRequireVerifyApps": true,
"deviceThreatProtectionEnabled": true,
"deviceThreatProtectionRequiredSecurityLevel": "secured",
"securityBlockJailbrokenDevices": true,
"osMinimumVersion": "Os Minimum Version value",
"osMaximumVersion": "Os Maximum Version value",
"minAndroidSecurityPatchLevel": "Min Android Security Patch Level value",
"storageRequireEncryption": true,
"securityRequireSafetyNetAttestationBasicIntegrity": true,
"securityRequireSafetyNetAttestationCertifiedDevice": true,
"securityRequireGooglePlayServices": true,
"securityRequireUpToDateSecurityProviders": true,
"securityRequireCompanyPortalAppIntegrity": true
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new AndroidWorkProfileCompliancePolicy
{
OdataType = "#microsoft.graph.androidWorkProfileCompliancePolicy",
Description = "Description value",
DisplayName = "Display Name value",
Version = 7,
PasswordRequired = true,
PasswordMinimumLength = 5,
PasswordRequiredType = AndroidRequiredPasswordType.Alphabetic,
PasswordMinutesOfInactivityBeforeLock = 5,
PasswordExpirationDays = 6,
PasswordPreviousPasswordBlockCount = 2,
SecurityPreventInstallAppsFromUnknownSources = true,
SecurityDisableUsbDebugging = true,
SecurityRequireVerifyApps = true,
DeviceThreatProtectionEnabled = true,
DeviceThreatProtectionRequiredSecurityLevel = DeviceThreatProtectionLevel.Secured,
SecurityBlockJailbrokenDevices = true,
OsMinimumVersion = "Os Minimum Version value",
OsMaximumVersion = "Os Maximum Version value",
MinAndroidSecurityPatchLevel = "Min Android Security Patch Level value",
StorageRequireEncryption = true,
SecurityRequireSafetyNetAttestationBasicIntegrity = true,
SecurityRequireSafetyNetAttestationCertifiedDevice = true,
SecurityRequireGooglePlayServices = true,
SecurityRequireUpToDateSecurityProviders = true,
SecurityRequireCompanyPortalAppIntegrity = 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.androidWorkProfileCompliancePolicy",\
"description": "Description value",\
"displayName": "Display Name value",\
"version": 7,\
"passwordRequired": true,\
"passwordMinimumLength": 5,\
"passwordRequiredType": "alphabetic",\
"passwordMinutesOfInactivityBeforeLock": 5,\
"passwordExpirationDays": 6,\
"passwordPreviousPasswordBlockCount": 2,\
"securityPreventInstallAppsFromUnknownSources": true,\
"securityDisableUsbDebugging": true,\
"securityRequireVerifyApps": true,\
"deviceThreatProtectionEnabled": true,\
"deviceThreatProtectionRequiredSecurityLevel": "secured",\
"securityBlockJailbrokenDevices": true,\
"osMinimumVersion": "Os Minimum Version value",\
"osMaximumVersion": "Os Maximum Version value",\
"minAndroidSecurityPatchLevel": "Min Android Security Patch Level value",\
"storageRequireEncryption": true,\
"securityRequireSafetyNetAttestationBasicIntegrity": true,\
"securityRequireSafetyNetAttestationCertifiedDevice": true,\
"securityRequireGooglePlayServices": true,\
"securityRequireUpToDateSecurityProviders": true,\
"securityRequireCompanyPortalAppIntegrity": 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)
passwordMinimumLength := int32(5)
requestBody.SetPasswordMinimumLength(&passwordMinimumLength)
passwordRequiredType := graphmodels.ALPHABETIC_ANDROIDREQUIREDPASSWORDTYPE
requestBody.SetPasswordRequiredType(&passwordRequiredType)
passwordMinutesOfInactivityBeforeLock := int32(5)
requestBody.SetPasswordMinutesOfInactivityBeforeLock(&passwordMinutesOfInactivityBeforeLock)
passwordExpirationDays := int32(6)
requestBody.SetPasswordExpirationDays(&passwordExpirationDays)
passwordPreviousPasswordBlockCount := int32(2)
requestBody.SetPasswordPreviousPasswordBlockCount(&passwordPreviousPasswordBlockCount)
securityPreventInstallAppsFromUnknownSources := true
requestBody.SetSecurityPreventInstallAppsFromUnknownSources(&securityPreventInstallAppsFromUnknownSources)
securityDisableUsbDebugging := true
requestBody.SetSecurityDisableUsbDebugging(&securityDisableUsbDebugging)
securityRequireVerifyApps := true
requestBody.SetSecurityRequireVerifyApps(&securityRequireVerifyApps)
deviceThreatProtectionEnabled := true
requestBody.SetDeviceThreatProtectionEnabled(&deviceThreatProtectionEnabled)
deviceThreatProtectionRequiredSecurityLevel := graphmodels.SECURED_DEVICETHREATPROTECTIONLEVEL
requestBody.SetDeviceThreatProtectionRequiredSecurityLevel(&deviceThreatProtectionRequiredSecurityLevel)
securityBlockJailbrokenDevices := true
requestBody.SetSecurityBlockJailbrokenDevices(&securityBlockJailbrokenDevices)
osMinimumVersion := "Os Minimum Version value"
requestBody.SetOsMinimumVersion(&osMinimumVersion)
osMaximumVersion := "Os Maximum Version value"
requestBody.SetOsMaximumVersion(&osMaximumVersion)
minAndroidSecurityPatchLevel := "Min Android Security Patch Level value"
requestBody.SetMinAndroidSecurityPatchLevel(&minAndroidSecurityPatchLevel)
storageRequireEncryption := true
requestBody.SetStorageRequireEncryption(&storageRequireEncryption)
securityRequireSafetyNetAttestationBasicIntegrity := true
requestBody.SetSecurityRequireSafetyNetAttestationBasicIntegrity(&securityRequireSafetyNetAttestationBasicIntegrity)
securityRequireSafetyNetAttestationCertifiedDevice := true
requestBody.SetSecurityRequireSafetyNetAttestationCertifiedDevice(&securityRequireSafetyNetAttestationCertifiedDevice)
securityRequireGooglePlayServices := true
requestBody.SetSecurityRequireGooglePlayServices(&securityRequireGooglePlayServices)
securityRequireUpToDateSecurityProviders := true
requestBody.SetSecurityRequireUpToDateSecurityProviders(&securityRequireUpToDateSecurityProviders)
securityRequireCompanyPortalAppIntegrity := true
requestBody.SetSecurityRequireCompanyPortalAppIntegrity(&securityRequireCompanyPortalAppIntegrity)
// 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);
AndroidWorkProfileCompliancePolicy deviceCompliancePolicy = new AndroidWorkProfileCompliancePolicy();
deviceCompliancePolicy.setOdataType("#microsoft.graph.androidWorkProfileCompliancePolicy");
deviceCompliancePolicy.setDescription("Description value");
deviceCompliancePolicy.setDisplayName("Display Name value");
deviceCompliancePolicy.setVersion(7);
deviceCompliancePolicy.setPasswordRequired(true);
deviceCompliancePolicy.setPasswordMinimumLength(5);
deviceCompliancePolicy.setPasswordRequiredType(AndroidRequiredPasswordType.Alphabetic);
deviceCompliancePolicy.setPasswordMinutesOfInactivityBeforeLock(5);
deviceCompliancePolicy.setPasswordExpirationDays(6);
deviceCompliancePolicy.setPasswordPreviousPasswordBlockCount(2);
deviceCompliancePolicy.setSecurityPreventInstallAppsFromUnknownSources(true);
deviceCompliancePolicy.setSecurityDisableUsbDebugging(true);
deviceCompliancePolicy.setSecurityRequireVerifyApps(true);
deviceCompliancePolicy.setDeviceThreatProtectionEnabled(true);
deviceCompliancePolicy.setDeviceThreatProtectionRequiredSecurityLevel(DeviceThreatProtectionLevel.Secured);
deviceCompliancePolicy.setSecurityBlockJailbrokenDevices(true);
deviceCompliancePolicy.setOsMinimumVersion("Os Minimum Version value");
deviceCompliancePolicy.setOsMaximumVersion("Os Maximum Version value");
deviceCompliancePolicy.setMinAndroidSecurityPatchLevel("Min Android Security Patch Level value");
deviceCompliancePolicy.setStorageRequireEncryption(true);
deviceCompliancePolicy.setSecurityRequireSafetyNetAttestationBasicIntegrity(true);
deviceCompliancePolicy.setSecurityRequireSafetyNetAttestationCertifiedDevice(true);
deviceCompliancePolicy.setSecurityRequireGooglePlayServices(true);
deviceCompliancePolicy.setSecurityRequireUpToDateSecurityProviders(true);
deviceCompliancePolicy.setSecurityRequireCompanyPortalAppIntegrity(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.androidWorkProfileCompliancePolicy',
description: 'Description value',
displayName: 'Display Name value',
version: 7,
passwordRequired: true,
passwordMinimumLength: 5,
passwordRequiredType: 'alphabetic',
passwordMinutesOfInactivityBeforeLock: 5,
passwordExpirationDays: 6,
passwordPreviousPasswordBlockCount: 2,
securityPreventInstallAppsFromUnknownSources: true,
securityDisableUsbDebugging: true,
securityRequireVerifyApps: true,
deviceThreatProtectionEnabled: true,
deviceThreatProtectionRequiredSecurityLevel: 'secured',
securityBlockJailbrokenDevices: true,
osMinimumVersion: 'Os Minimum Version value',
osMaximumVersion: 'Os Maximum Version value',
minAndroidSecurityPatchLevel: 'Min Android Security Patch Level value',
storageRequireEncryption: true,
securityRequireSafetyNetAttestationBasicIntegrity: true,
securityRequireSafetyNetAttestationCertifiedDevice: true,
securityRequireGooglePlayServices: true,
securityRequireUpToDateSecurityProviders: true,
securityRequireCompanyPortalAppIntegrity: true
};
await client.api('/deviceManagement/deviceCompliancePolicies/{deviceCompliancePolicyId}')
.update(deviceCompliancePolicy);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\AndroidWorkProfileCompliancePolicy;
use Microsoft\Graph\Generated\Models\AndroidRequiredPasswordType;
use Microsoft\Graph\Generated\Models\DeviceThreatProtectionLevel;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AndroidWorkProfileCompliancePolicy();
$requestBody->setOdataType('#microsoft.graph.androidWorkProfileCompliancePolicy');
$requestBody->setDescription('Description value');
$requestBody->setDisplayName('Display Name value');
$requestBody->setVersion(7);
$requestBody->setPasswordRequired(true);
$requestBody->setPasswordMinimumLength(5);
$requestBody->setPasswordRequiredType(new AndroidRequiredPasswordType('alphabetic'));
$requestBody->setPasswordMinutesOfInactivityBeforeLock(5);
$requestBody->setPasswordExpirationDays(6);
$requestBody->setPasswordPreviousPasswordBlockCount(2);
$requestBody->setSecurityPreventInstallAppsFromUnknownSources(true);
$requestBody->setSecurityDisableUsbDebugging(true);
$requestBody->setSecurityRequireVerifyApps(true);
$requestBody->setDeviceThreatProtectionEnabled(true);
$requestBody->setDeviceThreatProtectionRequiredSecurityLevel(new DeviceThreatProtectionLevel('secured'));
$requestBody->setSecurityBlockJailbrokenDevices(true);
$requestBody->setOsMinimumVersion('Os Minimum Version value');
$requestBody->setOsMaximumVersion('Os Maximum Version value');
$requestBody->setMinAndroidSecurityPatchLevel('Min Android Security Patch Level value');
$requestBody->setStorageRequireEncryption(true);
$requestBody->setSecurityRequireSafetyNetAttestationBasicIntegrity(true);
$requestBody->setSecurityRequireSafetyNetAttestationCertifiedDevice(true);
$requestBody->setSecurityRequireGooglePlayServices(true);
$requestBody->setSecurityRequireUpToDateSecurityProviders(true);
$requestBody->setSecurityRequireCompanyPortalAppIntegrity(true);
$result = $graphServiceClient->deviceManagement()->deviceCompliancePolicies()->byDeviceCompliancePolicyId('deviceCompliancePolicy-id')->patch($requestBody)->wait();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.DeviceManagement
$params = @{
"@odata.type" = "#microsoft.graph.androidWorkProfileCompliancePolicy"
description = "Description value"
displayName = "Display Name value"
version = 7
passwordRequired = $true
passwordMinimumLength =
passwordRequiredType = "alphabetic"
passwordMinutesOfInactivityBeforeLock =
passwordExpirationDays =
passwordPreviousPasswordBlockCount =
securityPreventInstallAppsFromUnknownSources = $true
securityDisableUsbDebugging = $true
securityRequireVerifyApps = $true
deviceThreatProtectionEnabled = $true
deviceThreatProtectionRequiredSecurityLevel = "secured"
securityBlockJailbrokenDevices = $true
osMinimumVersion = "Os Minimum Version value"
osMaximumVersion = "Os Maximum Version value"
minAndroidSecurityPatchLevel = "Min Android Security Patch Level value"
storageRequireEncryption = $true
securityRequireSafetyNetAttestationBasicIntegrity = $true
securityRequireSafetyNetAttestationCertifiedDevice = $true
securityRequireGooglePlayServices = $true
securityRequireUpToDateSecurityProviders = $true
securityRequireCompanyPortalAppIntegrity = $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.android_work_profile_compliance_policy import AndroidWorkProfileCompliancePolicy
from msgraph.generated.models.android_required_password_type import AndroidRequiredPasswordType
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 = AndroidWorkProfileCompliancePolicy(
odata_type = "#microsoft.graph.androidWorkProfileCompliancePolicy",
description = "Description value",
display_name = "Display Name value",
version = 7,
password_required = True,
password_minimum_length = 5,
password_required_type = AndroidRequiredPasswordType.Alphabetic,
password_minutes_of_inactivity_before_lock = 5,
password_expiration_days = 6,
password_previous_password_block_count = 2,
security_prevent_install_apps_from_unknown_sources = True,
security_disable_usb_debugging = True,
security_require_verify_apps = True,
device_threat_protection_enabled = True,
device_threat_protection_required_security_level = DeviceThreatProtectionLevel.Secured,
security_block_jailbroken_devices = True,
os_minimum_version = "Os Minimum Version value",
os_maximum_version = "Os Maximum Version value",
min_android_security_patch_level = "Min Android Security Patch Level value",
storage_require_encryption = True,
security_require_safety_net_attestation_basic_integrity = True,
security_require_safety_net_attestation_certified_device = True,
security_require_google_play_services = True,
security_require_up_to_date_security_providers = True,
security_require_company_portal_app_integrity = True,
)
result = await graph_client.device_management.device_compliance_policies.by_device_compliance_policy_id('deviceCompliancePolicy-id').patch(request_body)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。