Actualizar macOSGeneralDeviceConfiguration
Artículo 08/01/2024
13 colaboradores
Comentarios
En este artículo
Espacio de nombres: microsoft.graph
Nota: la API de Microsoft Graph para Intune requiere una licencia activa de Intune para el espacio empresarial.
Actualice las propiedades de un objeto macOSGeneralDeviceConfiguration .
Esta API está disponible en las siguientes implementaciones nacionales de nube .
Servicio global
Gobierno de EE. UU. L4
Us Government L5 (DOD)
China operada por 21Vianet
✅
✅
✅
✅
Permisos
Se requiere uno de los siguientes permisos para llamar a esta API. Para obtener más información, incluido cómo elegir permisos, vea Permisos .
Tipo de permiso
Permisos (de menos a más privilegiados)
Delegado (cuenta profesional o educativa)
DeviceManagementConfiguration.ReadWrite.All
Delegado (cuenta personal de Microsoft)
No admitida.
Aplicación
DeviceManagementConfiguration.ReadWrite.All
Solicitud HTTP
PATCH /deviceManagement/deviceConfigurations/{deviceConfigurationId}
Cuerpo de la solicitud
En el cuerpo de la solicitud, especifique una representación JSON del objeto macOSGeneralDeviceConfiguration .
En la tabla siguiente se muestran las propiedades necesarias para crear el objeto macOSGeneralDeviceConfiguration .
Propiedad
Tipo
Descripción
id
Cadena
Clave de la entidad. Heredado de deviceConfiguration
lastModifiedDateTime
DateTimeOffset
Fecha y hora en la que se modificó el objeto por última vez. Heredado de deviceConfiguration
createdDateTime
DateTimeOffset
Fecha y hora en la que se creó el objeto. Heredado de deviceConfiguration
description
Cadena
Descripción proporcionada por el administrador de la configuración del dispositivo. Heredado de deviceConfiguration
displayName
Cadena
Nombre proporcionado por el administrador de la configuración del dispositivo. Heredado de deviceConfiguration
version
Int32
Versión de la configuración del dispositivo. Heredado de deviceConfiguration
compliantAppsList
Colección appListItem
Lista de aplicaciones en el cumplimiento (sea lista de permitidos o de bloqueados, controlado por CompliantAppListType). Esta colección puede contener un máximo de 10 000 elementos.
compliantAppListType
appListType
Lista que se encuentra en la CompliantAppsList. Los valores posibles son: none
, appsInListCompliant
y appsNotInListCompliant
.
emailInDomainSuffixes
Colección string
Una dirección de correo electrónico que carezca de un sufijo que coincida con cualquiera de estas cadenas se considerará fuera de dominio.
passwordBlockSimple
Booleano
Bloquear contraseñas sencillas.
passwordExpirationDays
Int32
Número de días antes de que expire la contraseña.
passwordMinimumCharacterSetCount
Int32
Número de juegos de caracteres que debe contener una contraseña. Valores válidos de 0 a 4.
passwordMinimumLength
Int32
Longitud mínima de las contraseñas.
passwordMinutesOfInactivityBeforeLock
Int32
Minutos de inactividad antes de que sea necesaria una contraseña.
passwordMinutesOfInactivityBeforeScreenTimeout
Int32
Minutos de inactividad que se requieren antes de que se agote el tiempo de espera de la pantalla.
passwordPreviousPasswordBlockCount
Int32
Número de contraseñas anteriores que bloquear.
passwordRequiredType
requiredPasswordType
Tipo de contraseña que es necesario. Los valores posibles son: deviceDefault
, alphanumeric
y numeric
.
passwordRequired
Booleano
Si quiere requerir o no una contraseña.
Respuesta
Si se ejecuta correctamente, este método devuelve un código de respuesta 200 OK
y un objeto macOSGeneralDeviceConfiguration actualizado en el cuerpo de la respuesta.
Ejemplo
Solicitud
Aquí tiene un ejemplo de la solicitud.
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://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.DeviceConfigurations["{deviceConfiguration-id}"].PatchAsync(requestBody);
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider , consulte la documentación del 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\
}\
'
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider , consulte la documentación del 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://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=go
deviceConfigurations, err := graphClient.DeviceManagement().DeviceConfigurations().ByDeviceConfigurationId("deviceConfiguration-id").Patch(context.Background(), requestBody, nil)
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider , consulte la documentación del 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);
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider , consulte la documentación del 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);
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider , consulte la documentación del 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();
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider , consulte la documentación del 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
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider , consulte la documentación del 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://zcusa.951200.xyz/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)
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider , consulte la documentación del SDK .
Respuesta
Aquí tiene un ejemplo de la respuesta. Nota: Es posible que el objeto de respuesta que aparezca aquí esté truncado para abreviar. Todas las propiedades se devolverán desde una llamada real.
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
}