Update macOSGeneralDeviceConfiguration
Article
07/27/2023
9 contributors
Feedback
In this article
Namespace: microsoft.graph
Note: The Microsoft Graph API for Intune requires an active Intune license for the tenant.
Update the properties of a macOSGeneralDeviceConfiguration object.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions .
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
DeviceManagementConfiguration.ReadWrite.All
Delegated (personal Microsoft account)
Not supported.
Application
DeviceManagementConfiguration.ReadWrite.All
HTTP Request
PATCH /deviceManagement/deviceConfigurations/{deviceConfigurationId}
Header
Value
Authorization
Bearer <token> Required.
Accept
application/json
Request body
In the request body, supply a JSON representation for the macOSGeneralDeviceConfiguration object.
The following table shows the properties that are required when you create the macOSGeneralDeviceConfiguration .
Property
Type
Description
id
String
Key of the entity. Inherited from deviceConfiguration
lastModifiedDateTime
DateTimeOffset
DateTime the object was last modified. Inherited from deviceConfiguration
createdDateTime
DateTimeOffset
DateTime the object was created. Inherited from deviceConfiguration
description
String
Admin provided description of the Device Configuration. Inherited from deviceConfiguration
displayName
String
Admin provided name of the device configuration. Inherited from deviceConfiguration
version
Int32
Version of the device configuration. Inherited from deviceConfiguration
compliantAppsList
appListItem collection
List of apps in the compliance (either allow list or block list, controlled by CompliantAppListType). This collection can contain a maximum of 10000 elements.
compliantAppListType
appListType
List that is in the CompliantAppsList. Possible values are: none
, appsInListCompliant
, appsNotInListCompliant
.
emailInDomainSuffixes
String collection
An email address lacking a suffix that matches any of these strings will be considered out-of-domain.
passwordBlockSimple
Boolean
Block simple passwords.
passwordExpirationDays
Int32
Number of days before the password expires.
passwordMinimumCharacterSetCount
Int32
Number of character sets a password must contain. Valid values 0 to 4
passwordMinimumLength
Int32
Minimum length of passwords.
passwordMinutesOfInactivityBeforeLock
Int32
Minutes of inactivity required before a password is required.
passwordMinutesOfInactivityBeforeScreenTimeout
Int32
Minutes of inactivity required before the screen times out.
passwordPreviousPasswordBlockCount
Int32
Number of previous passwords to block.
passwordRequiredType
requiredPasswordType
Type of password that is required. Possible values are: deviceDefault
, alphanumeric
, numeric
.
passwordRequired
Boolean
Whether or not to require a password.
Response
If successful, this method returns a 200 OK
response code and an updated macOSGeneralDeviceConfiguration object in the response body.
Example
Request
Here is an example of the request.
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
var graphClient = new GraphServiceClient(requestAdapter);
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,
};
var result = await graphClient.DeviceManagement.DeviceConfigurations["{deviceConfiguration-id}"].PatchAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
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\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
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)
deviceConfigurations, err := graphClient.DeviceManagement().DeviceConfigurations().ByDeviceConfigurationId("deviceConfiguration-id").Patch(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
MacOSGeneralDeviceConfiguration deviceConfiguration = new MacOSGeneralDeviceConfiguration();
deviceConfiguration.description = "Description value";
deviceConfiguration.displayName = "Display Name value";
deviceConfiguration.version = 7;
LinkedList<AppListItem> compliantAppsListList = new LinkedList<AppListItem>();
AppListItem compliantAppsList = new AppListItem();
compliantAppsList.name = "Name value";
compliantAppsList.publisher = "Publisher value";
compliantAppsList.appStoreUrl = "https://example.com/appStoreUrl/";
compliantAppsList.appId = "App Id value";
compliantAppsListList.add(compliantAppsList);
deviceConfiguration.compliantAppsList = compliantAppsListList;
deviceConfiguration.compliantAppListType = AppListType.APPS_IN_LIST_COMPLIANT;
LinkedList<String> emailInDomainSuffixesList = new LinkedList<String>();
emailInDomainSuffixesList.add("Email In Domain Suffixes value");
deviceConfiguration.emailInDomainSuffixes = emailInDomainSuffixesList;
deviceConfiguration.passwordBlockSimple = true;
deviceConfiguration.passwordExpirationDays = 6;
deviceConfiguration.passwordMinimumCharacterSetCount = 0;
deviceConfiguration.passwordMinimumLength = 5;
deviceConfiguration.passwordMinutesOfInactivityBeforeLock = 5;
deviceConfiguration.passwordMinutesOfInactivityBeforeScreenTimeout = 14;
deviceConfiguration.passwordPreviousPasswordBlockCount = 2;
deviceConfiguration.passwordRequiredType = AndroidRequiredPasswordType.ALPHANUMERIC;
deviceConfiguration.passwordRequired = true;
graphClient.deviceManagement().deviceConfigurations("{deviceConfigurationId}")
.buildRequest()
.patch(deviceConfiguration);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW VERSION OF THE SDK. NON-PRODUCTION USE ONLY
$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();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
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
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY
graph_client = GraphServiceClient(request_adapter)
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(body = request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.
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
}