Update macOSGeneralDeviceConfiguration
Статья 08/01/2024
Участники: 13
Обратная связь
В этой статье
Пространство имен: microsoft.graph
Примечание. API Microsoft Graph для Intune требует наличия активной лицензии Intune для клиента.
Обновление свойств объекта macOSGeneralDeviceConfiguration .
Этот API доступен в следующих национальных облачных развертываниях .
Глобальная служба
Правительство США L4
Правительство США L5 (DOD)
Китай управляется 21Vianet
✅
✅
✅
✅
Разрешения
Для вызова этого API требуется одно из следующих разрешений. Дополнительные сведения, включая сведения о том, как выбрать разрешения, см. в статье Разрешения .
Тип разрешения
Разрешения (в порядке повышения привилегий)
Делегированные (рабочая или учебная учетная запись)
DeviceManagementConfiguration.ReadWrite.All
Делегированные (личная учетная запись Майкрософт)
Не поддерживается.
Приложение
DeviceManagementConfiguration.ReadWrite.All
HTTP-запрос
PATCH /deviceManagement/deviceConfigurations/{deviceConfigurationId}
Тело запроса
В теле запроса добавьте представление объекта macOSGeneralDeviceConfiguration в формате JSON.
Ниже показаны свойства, которые необходимо указывать при создании объекта macOSGeneralDeviceConfiguration .
Свойство
Тип
Описание
id
String
Ключ объекта. Наследуется от объекта deviceConfiguration .
lastModifiedDateTime
DateTimeOffset
Дата и время последнего изменения объекта. Наследуется от объекта deviceConfiguration .
createdDateTime
DateTimeOffset
Дата и время создания объекта. Наследуется от объекта deviceConfiguration .
description
String
Указанное администратором описание конфигурации устройства. Наследуется от объекта deviceConfiguration .
displayName
String
Указанное администратором имя конфигурации устройства. Наследуется от объекта deviceConfiguration .
version
Int32
Версия конфигурации устройства. Наследуется от объекта deviceConfiguration
compliantAppsList
Коллекция appListItem
Список приложений, соответствующих требованиям (список разрешений или блокировок, определяется свойством CompliantAppListType). Эта коллекция может содержать не более 10 000 элементов.
compliantAppListType
appListType
Список, включенный в CompliantAppsList. Возможные значения: none
, appsInListCompliant
, appsNotInListCompliant
.
emailInDomainSuffixes
Коллекция String
Электронный адрес без суффикса, соответствующего одной из этих строк, будет считаться не добавленным в домен.
passwordBlockSimple
Boolean
Блокировка простых паролей.
passwordExpirationDays
Int32
Количество дней до окончания срока действия пароля.
passwordMinimumCharacterSetCount
Int32
Количество наборов символов, которые должен содержать пароль. Допустимые значения: от 0 до 4.
passwordMinimumLength
Int32
Минимальная длина паролей.
passwordMinutesOfInactivityBeforeLock
Int32
Период бездействия (в минутах), по истечении которого будет запрашиваться пароль.
passwordMinutesOfInactivityBeforeScreenTimeout
Int32
Период бездействия (в минутах), по истечении которого будет гаснуть экран.
passwordPreviousPasswordBlockCount
Int32
Количество предыдущих паролей, которые требуется блокировать.
passwordRequiredType
requiredPasswordType
Требуемый тип пароля. Возможные значения: deviceDefault
, alphanumeric
, numeric
.
passwordRequired
Boolean
Указывает, обязательно ли использовать пароль.
Ответ
В случае успешного выполнения этот метод возвращает код ответа 200 OK
и обновленный объект macOSGeneralDeviceConfiguration в теле ответа.
Пример
Запрос
Ниже приведен пример запроса.
PATCH https://graph.microsoft.com/v1.0/deviceManagement/deviceConfigurations/{deviceConfigurationId}
Content-type: application/json
Content-length: 906
{
"@odata.type": "#microsoft.graph.macOSGeneralDeviceConfiguration",
"description": "Description value",
"displayName": "Display Name value",
"version": 7,
"compliantAppsList": [
{
"@odata.type": "microsoft.graph.appListItem",
"name": "Name value",
"publisher": "Publisher value",
"appStoreUrl": "https://example.com/appStoreUrl/",
"appId": "App Id value"
}
],
"compliantAppListType": "appsInListCompliant",
"emailInDomainSuffixes": [
"Email In Domain Suffixes value"
],
"passwordBlockSimple": true,
"passwordExpirationDays": 6,
"passwordMinimumCharacterSetCount": 0,
"passwordMinimumLength": 5,
"passwordMinutesOfInactivityBeforeLock": 5,
"passwordMinutesOfInactivityBeforeScreenTimeout": 14,
"passwordPreviousPasswordBlockCount": 2,
"passwordRequiredType": "alphanumeric",
"passwordRequired": true
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new MacOSGeneralDeviceConfiguration
{
OdataType = "#microsoft.graph.macOSGeneralDeviceConfiguration",
Description = "Description value",
DisplayName = "Display Name value",
Version = 7,
CompliantAppsList = new List<AppListItem>
{
new AppListItem
{
OdataType = "microsoft.graph.appListItem",
Name = "Name value",
Publisher = "Publisher value",
AppStoreUrl = "https://example.com/appStoreUrl/",
AppId = "App Id value",
},
},
CompliantAppListType = AppListType.AppsInListCompliant,
EmailInDomainSuffixes = new List<string>
{
"Email In Domain Suffixes value",
},
PasswordBlockSimple = true,
PasswordExpirationDays = 6,
PasswordMinimumCharacterSetCount = 0,
PasswordMinimumLength = 5,
PasswordMinutesOfInactivityBeforeLock = 5,
PasswordMinutesOfInactivityBeforeScreenTimeout = 14,
PasswordPreviousPasswordBlockCount = 2,
PasswordRequiredType = RequiredPasswordType.Alphanumeric,
PasswordRequired = 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["{deviceConfiguration-id}"].PatchAsync(requestBody);
Подробнее о том, как добавить SDK в свой проект и создать экземпляр authProvider , см. в документации по SDK .
mgc device-management device-configurations patch --device-configuration-id {deviceConfiguration-id} --body '{\
"@odata.type": "#microsoft.graph.macOSGeneralDeviceConfiguration",\
"description": "Description value",\
"displayName": "Display Name value",\
"version": 7,\
"compliantAppsList": [\
{\
"@odata.type": "microsoft.graph.appListItem",\
"name": "Name value",\
"publisher": "Publisher value",\
"appStoreUrl": "https://example.com/appStoreUrl/",\
"appId": "App Id value"\
}\
],\
"compliantAppListType": "appsInListCompliant",\
"emailInDomainSuffixes": [\
"Email In Domain Suffixes value"\
],\
"passwordBlockSimple": true,\
"passwordExpirationDays": 6,\
"passwordMinimumCharacterSetCount": 0,\
"passwordMinimumLength": 5,\
"passwordMinutesOfInactivityBeforeLock": 5,\
"passwordMinutesOfInactivityBeforeScreenTimeout": 14,\
"passwordPreviousPasswordBlockCount": 2,\
"passwordRequiredType": "alphanumeric",\
"passwordRequired": 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.NewDeviceConfiguration()
description := "Description value"
requestBody.SetDescription(&description)
displayName := "Display Name value"
requestBody.SetDisplayName(&displayName)
version := int32(7)
requestBody.SetVersion(&version)
appListItem := graphmodels.NewAppListItem()
name := "Name value"
appListItem.SetName(&name)
publisher := "Publisher value"
appListItem.SetPublisher(&publisher)
appStoreUrl := "https://example.com/appStoreUrl/"
appListItem.SetAppStoreUrl(&appStoreUrl)
appId := "App Id value"
appListItem.SetAppId(&appId)
compliantAppsList := []graphmodels.AppListItemable {
appListItem,
}
requestBody.SetCompliantAppsList(compliantAppsList)
compliantAppListType := graphmodels.APPSINLISTCOMPLIANT_APPLISTTYPE
requestBody.SetCompliantAppListType(&compliantAppListType)
emailInDomainSuffixes := []string {
"Email In Domain Suffixes value",
}
requestBody.SetEmailInDomainSuffixes(emailInDomainSuffixes)
passwordBlockSimple := true
requestBody.SetPasswordBlockSimple(&passwordBlockSimple)
passwordExpirationDays := int32(6)
requestBody.SetPasswordExpirationDays(&passwordExpirationDays)
passwordMinimumCharacterSetCount := int32(0)
requestBody.SetPasswordMinimumCharacterSetCount(&passwordMinimumCharacterSetCount)
passwordMinimumLength := int32(5)
requestBody.SetPasswordMinimumLength(&passwordMinimumLength)
passwordMinutesOfInactivityBeforeLock := int32(5)
requestBody.SetPasswordMinutesOfInactivityBeforeLock(&passwordMinutesOfInactivityBeforeLock)
passwordMinutesOfInactivityBeforeScreenTimeout := int32(14)
requestBody.SetPasswordMinutesOfInactivityBeforeScreenTimeout(&passwordMinutesOfInactivityBeforeScreenTimeout)
passwordPreviousPasswordBlockCount := int32(2)
requestBody.SetPasswordPreviousPasswordBlockCount(&passwordPreviousPasswordBlockCount)
passwordRequiredType := graphmodels.ALPHANUMERIC_REQUIREDPASSWORDTYPE
requestBody.SetPasswordRequiredType(&passwordRequiredType)
passwordRequired := true
requestBody.SetPasswordRequired(&passwordRequired)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
deviceConfigurations, err := graphClient.DeviceManagement().DeviceConfigurations().ByDeviceConfigurationId("deviceConfiguration-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);
MacOSGeneralDeviceConfiguration deviceConfiguration = new MacOSGeneralDeviceConfiguration();
deviceConfiguration.setOdataType("#microsoft.graph.macOSGeneralDeviceConfiguration");
deviceConfiguration.setDescription("Description value");
deviceConfiguration.setDisplayName("Display Name value");
deviceConfiguration.setVersion(7);
LinkedList<AppListItem> compliantAppsList = new LinkedList<AppListItem>();
AppListItem appListItem = new AppListItem();
appListItem.setOdataType("microsoft.graph.appListItem");
appListItem.setName("Name value");
appListItem.setPublisher("Publisher value");
appListItem.setAppStoreUrl("https://example.com/appStoreUrl/");
appListItem.setAppId("App Id value");
compliantAppsList.add(appListItem);
deviceConfiguration.setCompliantAppsList(compliantAppsList);
deviceConfiguration.setCompliantAppListType(AppListType.AppsInListCompliant);
LinkedList<String> emailInDomainSuffixes = new LinkedList<String>();
emailInDomainSuffixes.add("Email In Domain Suffixes value");
deviceConfiguration.setEmailInDomainSuffixes(emailInDomainSuffixes);
deviceConfiguration.setPasswordBlockSimple(true);
deviceConfiguration.setPasswordExpirationDays(6);
deviceConfiguration.setPasswordMinimumCharacterSetCount(0);
deviceConfiguration.setPasswordMinimumLength(5);
deviceConfiguration.setPasswordMinutesOfInactivityBeforeLock(5);
deviceConfiguration.setPasswordMinutesOfInactivityBeforeScreenTimeout(14);
deviceConfiguration.setPasswordPreviousPasswordBlockCount(2);
deviceConfiguration.setPasswordRequiredType(RequiredPasswordType.Alphanumeric);
deviceConfiguration.setPasswordRequired(true);
DeviceConfiguration result = graphClient.deviceManagement().deviceConfigurations().byDeviceConfigurationId("{deviceConfiguration-id}").patch(deviceConfiguration);
Подробнее о том, как добавить SDK в свой проект и создать экземпляр authProvider , см. в документации по SDK .
const options = {
authProvider,
};
const client = Client.init(options);
const deviceConfiguration = {
'@odata.type': '#microsoft.graph.macOSGeneralDeviceConfiguration',
description: 'Description value',
displayName: 'Display Name value',
version: 7,
compliantAppsList: [
{
'@odata.type': 'microsoft.graph.appListItem',
name: 'Name value',
publisher: 'Publisher value',
appStoreUrl: 'https://example.com/appStoreUrl/',
appId: 'App Id value'
}
],
compliantAppListType: 'appsInListCompliant',
emailInDomainSuffixes: [
'Email In Domain Suffixes value'
],
passwordBlockSimple: true,
passwordExpirationDays: 6,
passwordMinimumCharacterSetCount: 0,
passwordMinimumLength: 5,
passwordMinutesOfInactivityBeforeLock: 5,
passwordMinutesOfInactivityBeforeScreenTimeout: 14,
passwordPreviousPasswordBlockCount: 2,
passwordRequiredType: 'alphanumeric',
passwordRequired: true
};
await client.api('/deviceManagement/deviceConfigurations/{deviceConfigurationId}')
.update(deviceConfiguration);
Подробнее о том, как добавить SDK в свой проект и создать экземпляр authProvider , см. в документации по SDK .
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\MacOSGeneralDeviceConfiguration;
use Microsoft\Graph\Generated\Models\AppListItem;
use Microsoft\Graph\Generated\Models\AppListType;
use Microsoft\Graph\Generated\Models\RequiredPasswordType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new MacOSGeneralDeviceConfiguration();
$requestBody->setOdataType('#microsoft.graph.macOSGeneralDeviceConfiguration');
$requestBody->setDescription('Description value');
$requestBody->setDisplayName('Display Name value');
$requestBody->setVersion(7);
$compliantAppsListAppListItem1 = new AppListItem();
$compliantAppsListAppListItem1->setOdataType('microsoft.graph.appListItem');
$compliantAppsListAppListItem1->setName('Name value');
$compliantAppsListAppListItem1->setPublisher('Publisher value');
$compliantAppsListAppListItem1->setAppStoreUrl('https://example.com/appStoreUrl/');
$compliantAppsListAppListItem1->setAppId('App Id value');
$compliantAppsListArray []= $compliantAppsListAppListItem1;
$requestBody->setCompliantAppsList($compliantAppsListArray);
$requestBody->setCompliantAppListType(new AppListType('appsInListCompliant'));
$requestBody->setEmailInDomainSuffixes(['Email In Domain Suffixes value', ]);
$requestBody->setPasswordBlockSimple(true);
$requestBody->setPasswordExpirationDays(6);
$requestBody->setPasswordMinimumCharacterSetCount(0);
$requestBody->setPasswordMinimumLength(5);
$requestBody->setPasswordMinutesOfInactivityBeforeLock(5);
$requestBody->setPasswordMinutesOfInactivityBeforeScreenTimeout(14);
$requestBody->setPasswordPreviousPasswordBlockCount(2);
$requestBody->setPasswordRequiredType(new RequiredPasswordType('alphanumeric'));
$requestBody->setPasswordRequired(true);
$result = $graphServiceClient->deviceManagement()->deviceConfigurations()->byDeviceConfigurationId('deviceConfiguration-id')->patch($requestBody)->wait();
Подробнее о том, как добавить SDK в свой проект и создать экземпляр authProvider , см. в документации по SDK .
Import-Module Microsoft.Graph.DeviceManagement
$params = @{
"@odata.type" = "#microsoft.graph.macOSGeneralDeviceConfiguration"
description = "Description value"
displayName = "Display Name value"
version = 7
compliantAppsList = @(
@{
"@odata.type" = "microsoft.graph.appListItem"
name = "Name value"
publisher = "Publisher value"
appStoreUrl = "https://example.com/appStoreUrl/"
appId = "App Id value"
}
)
compliantAppListType = "appsInListCompliant"
emailInDomainSuffixes = @(
"Email In Domain Suffixes value"
)
passwordBlockSimple = $true
passwordExpirationDays =
passwordMinimumCharacterSetCount =
passwordMinimumLength =
passwordMinutesOfInactivityBeforeLock =
passwordMinutesOfInactivityBeforeScreenTimeout =
passwordPreviousPasswordBlockCount =
passwordRequiredType = "alphanumeric"
passwordRequired = $true
}
Update-MgDeviceManagementDeviceConfiguration -DeviceConfigurationId $deviceConfigurationId -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.mac_o_s_general_device_configuration import MacOSGeneralDeviceConfiguration
from msgraph.generated.models.app_list_item import AppListItem
from msgraph.generated.models.app_list_type import AppListType
from msgraph.generated.models.required_password_type import RequiredPasswordType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = MacOSGeneralDeviceConfiguration(
odata_type = "#microsoft.graph.macOSGeneralDeviceConfiguration",
description = "Description value",
display_name = "Display Name value",
version = 7,
compliant_apps_list = [
AppListItem(
odata_type = "microsoft.graph.appListItem",
name = "Name value",
publisher = "Publisher value",
app_store_url = "https://example.com/appStoreUrl/",
app_id = "App Id value",
),
],
compliant_app_list_type = AppListType.AppsInListCompliant,
email_in_domain_suffixes = [
"Email In Domain Suffixes value",
],
password_block_simple = True,
password_expiration_days = 6,
password_minimum_character_set_count = 0,
password_minimum_length = 5,
password_minutes_of_inactivity_before_lock = 5,
password_minutes_of_inactivity_before_screen_timeout = 14,
password_previous_password_block_count = 2,
password_required_type = RequiredPasswordType.Alphanumeric,
password_required = True,
)
result = await graph_client.device_management.device_configurations.by_device_configuration_id('deviceConfiguration-id').patch(request_body)
Подробнее о том, как добавить SDK в свой проект и создать экземпляр authProvider , см. в документации по SDK .
Отклик
Ниже приведен пример отклика. Примечание. Представленный здесь объект отклика может быть усечен для краткости. При фактическом вызове будут возвращены все свойства.
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1078
{
"@odata.type": "#microsoft.graph.macOSGeneralDeviceConfiguration",
"id": "dc356aee-6aee-dc35-ee6a-35dcee6a35dc",
"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,
"compliantAppsList": [
{
"@odata.type": "microsoft.graph.appListItem",
"name": "Name value",
"publisher": "Publisher value",
"appStoreUrl": "https://example.com/appStoreUrl/",
"appId": "App Id value"
}
],
"compliantAppListType": "appsInListCompliant",
"emailInDomainSuffixes": [
"Email In Domain Suffixes value"
],
"passwordBlockSimple": true,
"passwordExpirationDays": 6,
"passwordMinimumCharacterSetCount": 0,
"passwordMinimumLength": 5,
"passwordMinutesOfInactivityBeforeLock": 5,
"passwordMinutesOfInactivityBeforeScreenTimeout": 14,
"passwordPreviousPasswordBlockCount": 2,
"passwordRequiredType": "alphanumeric",
"passwordRequired": true
}