One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
In the request body, supply a JSON representation for the deviceEnrollmentPlatformRestrictionsConfiguration object.
The following table shows the properties that are required when you create the deviceEnrollmentPlatformRestrictionsConfiguration.
Here is an example of the request.
POST https://graph.microsoft.com/v1.0/deviceManagement/deviceEnrollmentConfigurations
Content-type: application/json
Content-length: 1650
{
"@odata.type": "#microsoft.graph.deviceEnrollmentPlatformRestrictionsConfiguration",
"displayName": "Display Name value",
"description": "Description value",
"priority": 8,
"version": 7,
"iosRestriction": {
"@odata.type": "microsoft.graph.deviceEnrollmentPlatformRestriction",
"platformBlocked": true,
"personalDeviceEnrollmentBlocked": true,
"osMinimumVersion": "Os Minimum Version value",
"osMaximumVersion": "Os Maximum Version value"
},
"windowsRestriction": {
"@odata.type": "microsoft.graph.deviceEnrollmentPlatformRestriction",
"platformBlocked": true,
"personalDeviceEnrollmentBlocked": true,
"osMinimumVersion": "Os Minimum Version value",
"osMaximumVersion": "Os Maximum Version value"
},
"windowsMobileRestriction": {
"@odata.type": "microsoft.graph.deviceEnrollmentPlatformRestriction",
"platformBlocked": true,
"personalDeviceEnrollmentBlocked": true,
"osMinimumVersion": "Os Minimum Version value",
"osMaximumVersion": "Os Maximum Version value"
},
"androidRestriction": {
"@odata.type": "microsoft.graph.deviceEnrollmentPlatformRestriction",
"platformBlocked": true,
"personalDeviceEnrollmentBlocked": true,
"osMinimumVersion": "Os Minimum Version value",
"osMaximumVersion": "Os Maximum Version value"
},
"macOSRestriction": {
"@odata.type": "microsoft.graph.deviceEnrollmentPlatformRestriction",
"platformBlocked": true,
"personalDeviceEnrollmentBlocked": true,
"osMinimumVersion": "Os Minimum Version value",
"osMaximumVersion": "Os Maximum Version value"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new DeviceEnrollmentPlatformRestrictionsConfiguration
{
OdataType = "#microsoft.graph.deviceEnrollmentPlatformRestrictionsConfiguration",
DisplayName = "Display Name value",
Description = "Description value",
Priority = 8,
Version = 7,
IosRestriction = new DeviceEnrollmentPlatformRestriction
{
OdataType = "microsoft.graph.deviceEnrollmentPlatformRestriction",
PlatformBlocked = true,
PersonalDeviceEnrollmentBlocked = true,
OsMinimumVersion = "Os Minimum Version value",
OsMaximumVersion = "Os Maximum Version value",
},
WindowsRestriction = new DeviceEnrollmentPlatformRestriction
{
OdataType = "microsoft.graph.deviceEnrollmentPlatformRestriction",
PlatformBlocked = true,
PersonalDeviceEnrollmentBlocked = true,
OsMinimumVersion = "Os Minimum Version value",
OsMaximumVersion = "Os Maximum Version value",
},
WindowsMobileRestriction = new DeviceEnrollmentPlatformRestriction
{
OdataType = "microsoft.graph.deviceEnrollmentPlatformRestriction",
PlatformBlocked = true,
PersonalDeviceEnrollmentBlocked = true,
OsMinimumVersion = "Os Minimum Version value",
OsMaximumVersion = "Os Maximum Version value",
},
AndroidRestriction = new DeviceEnrollmentPlatformRestriction
{
OdataType = "microsoft.graph.deviceEnrollmentPlatformRestriction",
PlatformBlocked = true,
PersonalDeviceEnrollmentBlocked = true,
OsMinimumVersion = "Os Minimum Version value",
OsMaximumVersion = "Os Maximum Version value",
},
MacOSRestriction = new DeviceEnrollmentPlatformRestriction
{
OdataType = "microsoft.graph.deviceEnrollmentPlatformRestriction",
PlatformBlocked = true,
PersonalDeviceEnrollmentBlocked = true,
OsMinimumVersion = "Os Minimum Version value",
OsMaximumVersion = "Os Maximum Version value",
},
};
// To initialize your graphClient, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.DeviceEnrollmentConfigurations.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc device-management device-enrollment-configurations create --body '{\
"@odata.type": "#microsoft.graph.deviceEnrollmentPlatformRestrictionsConfiguration",\
"displayName": "Display Name value",\
"description": "Description value",\
"priority": 8,\
"version": 7,\
"iosRestriction": {\
"@odata.type": "microsoft.graph.deviceEnrollmentPlatformRestriction",\
"platformBlocked": true,\
"personalDeviceEnrollmentBlocked": true,\
"osMinimumVersion": "Os Minimum Version value",\
"osMaximumVersion": "Os Maximum Version value"\
},\
"windowsRestriction": {\
"@odata.type": "microsoft.graph.deviceEnrollmentPlatformRestriction",\
"platformBlocked": true,\
"personalDeviceEnrollmentBlocked": true,\
"osMinimumVersion": "Os Minimum Version value",\
"osMaximumVersion": "Os Maximum Version value"\
},\
"windowsMobileRestriction": {\
"@odata.type": "microsoft.graph.deviceEnrollmentPlatformRestriction",\
"platformBlocked": true,\
"personalDeviceEnrollmentBlocked": true,\
"osMinimumVersion": "Os Minimum Version value",\
"osMaximumVersion": "Os Maximum Version value"\
},\
"androidRestriction": {\
"@odata.type": "microsoft.graph.deviceEnrollmentPlatformRestriction",\
"platformBlocked": true,\
"personalDeviceEnrollmentBlocked": true,\
"osMinimumVersion": "Os Minimum Version value",\
"osMaximumVersion": "Os Maximum Version value"\
},\
"macOSRestriction": {\
"@odata.type": "microsoft.graph.deviceEnrollmentPlatformRestriction",\
"platformBlocked": true,\
"personalDeviceEnrollmentBlocked": true,\
"osMinimumVersion": "Os Minimum Version value",\
"osMaximumVersion": "Os Maximum Version value"\
}\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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.NewDeviceEnrollmentConfiguration()
displayName := "Display Name value"
requestBody.SetDisplayName(&displayName)
description := "Description value"
requestBody.SetDescription(&description)
priority := int32(8)
requestBody.SetPriority(&priority)
version := int32(7)
requestBody.SetVersion(&version)
iosRestriction := graphmodels.NewDeviceEnrollmentPlatformRestriction()
platformBlocked := true
iosRestriction.SetPlatformBlocked(&platformBlocked)
personalDeviceEnrollmentBlocked := true
iosRestriction.SetPersonalDeviceEnrollmentBlocked(&personalDeviceEnrollmentBlocked)
osMinimumVersion := "Os Minimum Version value"
iosRestriction.SetOsMinimumVersion(&osMinimumVersion)
osMaximumVersion := "Os Maximum Version value"
iosRestriction.SetOsMaximumVersion(&osMaximumVersion)
requestBody.SetIosRestriction(iosRestriction)
windowsRestriction := graphmodels.NewDeviceEnrollmentPlatformRestriction()
platformBlocked := true
windowsRestriction.SetPlatformBlocked(&platformBlocked)
personalDeviceEnrollmentBlocked := true
windowsRestriction.SetPersonalDeviceEnrollmentBlocked(&personalDeviceEnrollmentBlocked)
osMinimumVersion := "Os Minimum Version value"
windowsRestriction.SetOsMinimumVersion(&osMinimumVersion)
osMaximumVersion := "Os Maximum Version value"
windowsRestriction.SetOsMaximumVersion(&osMaximumVersion)
requestBody.SetWindowsRestriction(windowsRestriction)
windowsMobileRestriction := graphmodels.NewDeviceEnrollmentPlatformRestriction()
platformBlocked := true
windowsMobileRestriction.SetPlatformBlocked(&platformBlocked)
personalDeviceEnrollmentBlocked := true
windowsMobileRestriction.SetPersonalDeviceEnrollmentBlocked(&personalDeviceEnrollmentBlocked)
osMinimumVersion := "Os Minimum Version value"
windowsMobileRestriction.SetOsMinimumVersion(&osMinimumVersion)
osMaximumVersion := "Os Maximum Version value"
windowsMobileRestriction.SetOsMaximumVersion(&osMaximumVersion)
requestBody.SetWindowsMobileRestriction(windowsMobileRestriction)
androidRestriction := graphmodels.NewDeviceEnrollmentPlatformRestriction()
platformBlocked := true
androidRestriction.SetPlatformBlocked(&platformBlocked)
personalDeviceEnrollmentBlocked := true
androidRestriction.SetPersonalDeviceEnrollmentBlocked(&personalDeviceEnrollmentBlocked)
osMinimumVersion := "Os Minimum Version value"
androidRestriction.SetOsMinimumVersion(&osMinimumVersion)
osMaximumVersion := "Os Maximum Version value"
androidRestriction.SetOsMaximumVersion(&osMaximumVersion)
requestBody.SetAndroidRestriction(androidRestriction)
macOSRestriction := graphmodels.NewDeviceEnrollmentPlatformRestriction()
platformBlocked := true
macOSRestriction.SetPlatformBlocked(&platformBlocked)
personalDeviceEnrollmentBlocked := true
macOSRestriction.SetPersonalDeviceEnrollmentBlocked(&personalDeviceEnrollmentBlocked)
osMinimumVersion := "Os Minimum Version value"
macOSRestriction.SetOsMinimumVersion(&osMinimumVersion)
osMaximumVersion := "Os Maximum Version value"
macOSRestriction.SetOsMaximumVersion(&osMaximumVersion)
requestBody.SetMacOSRestriction(macOSRestriction)
// To initialize your graphClient, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=go
deviceEnrollmentConfigurations, err := graphClient.DeviceManagement().DeviceEnrollmentConfigurations().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DeviceEnrollmentPlatformRestrictionsConfiguration deviceEnrollmentConfiguration = new DeviceEnrollmentPlatformRestrictionsConfiguration();
deviceEnrollmentConfiguration.setOdataType("#microsoft.graph.deviceEnrollmentPlatformRestrictionsConfiguration");
deviceEnrollmentConfiguration.setDisplayName("Display Name value");
deviceEnrollmentConfiguration.setDescription("Description value");
deviceEnrollmentConfiguration.setPriority(8);
deviceEnrollmentConfiguration.setVersion(7);
DeviceEnrollmentPlatformRestriction iosRestriction = new DeviceEnrollmentPlatformRestriction();
iosRestriction.setOdataType("microsoft.graph.deviceEnrollmentPlatformRestriction");
iosRestriction.setPlatformBlocked(true);
iosRestriction.setPersonalDeviceEnrollmentBlocked(true);
iosRestriction.setOsMinimumVersion("Os Minimum Version value");
iosRestriction.setOsMaximumVersion("Os Maximum Version value");
deviceEnrollmentConfiguration.setIosRestriction(iosRestriction);
DeviceEnrollmentPlatformRestriction windowsRestriction = new DeviceEnrollmentPlatformRestriction();
windowsRestriction.setOdataType("microsoft.graph.deviceEnrollmentPlatformRestriction");
windowsRestriction.setPlatformBlocked(true);
windowsRestriction.setPersonalDeviceEnrollmentBlocked(true);
windowsRestriction.setOsMinimumVersion("Os Minimum Version value");
windowsRestriction.setOsMaximumVersion("Os Maximum Version value");
deviceEnrollmentConfiguration.setWindowsRestriction(windowsRestriction);
DeviceEnrollmentPlatformRestriction windowsMobileRestriction = new DeviceEnrollmentPlatformRestriction();
windowsMobileRestriction.setOdataType("microsoft.graph.deviceEnrollmentPlatformRestriction");
windowsMobileRestriction.setPlatformBlocked(true);
windowsMobileRestriction.setPersonalDeviceEnrollmentBlocked(true);
windowsMobileRestriction.setOsMinimumVersion("Os Minimum Version value");
windowsMobileRestriction.setOsMaximumVersion("Os Maximum Version value");
deviceEnrollmentConfiguration.setWindowsMobileRestriction(windowsMobileRestriction);
DeviceEnrollmentPlatformRestriction androidRestriction = new DeviceEnrollmentPlatformRestriction();
androidRestriction.setOdataType("microsoft.graph.deviceEnrollmentPlatformRestriction");
androidRestriction.setPlatformBlocked(true);
androidRestriction.setPersonalDeviceEnrollmentBlocked(true);
androidRestriction.setOsMinimumVersion("Os Minimum Version value");
androidRestriction.setOsMaximumVersion("Os Maximum Version value");
deviceEnrollmentConfiguration.setAndroidRestriction(androidRestriction);
DeviceEnrollmentPlatformRestriction macOSRestriction = new DeviceEnrollmentPlatformRestriction();
macOSRestriction.setOdataType("microsoft.graph.deviceEnrollmentPlatformRestriction");
macOSRestriction.setPlatformBlocked(true);
macOSRestriction.setPersonalDeviceEnrollmentBlocked(true);
macOSRestriction.setOsMinimumVersion("Os Minimum Version value");
macOSRestriction.setOsMaximumVersion("Os Maximum Version value");
deviceEnrollmentConfiguration.setMacOSRestriction(macOSRestriction);
DeviceEnrollmentConfiguration result = graphClient.deviceManagement().deviceEnrollmentConfigurations().post(deviceEnrollmentConfiguration);
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 deviceEnrollmentConfiguration = {
'@odata.type': '#microsoft.graph.deviceEnrollmentPlatformRestrictionsConfiguration',
displayName: 'Display Name value',
description: 'Description value',
priority: 8,
version: 7,
iosRestriction: {
'@odata.type': 'microsoft.graph.deviceEnrollmentPlatformRestriction',
platformBlocked: true,
personalDeviceEnrollmentBlocked: true,
osMinimumVersion: 'Os Minimum Version value',
osMaximumVersion: 'Os Maximum Version value'
},
windowsRestriction: {
'@odata.type': 'microsoft.graph.deviceEnrollmentPlatformRestriction',
platformBlocked: true,
personalDeviceEnrollmentBlocked: true,
osMinimumVersion: 'Os Minimum Version value',
osMaximumVersion: 'Os Maximum Version value'
},
windowsMobileRestriction: {
'@odata.type': 'microsoft.graph.deviceEnrollmentPlatformRestriction',
platformBlocked: true,
personalDeviceEnrollmentBlocked: true,
osMinimumVersion: 'Os Minimum Version value',
osMaximumVersion: 'Os Maximum Version value'
},
androidRestriction: {
'@odata.type': 'microsoft.graph.deviceEnrollmentPlatformRestriction',
platformBlocked: true,
personalDeviceEnrollmentBlocked: true,
osMinimumVersion: 'Os Minimum Version value',
osMaximumVersion: 'Os Maximum Version value'
},
macOSRestriction: {
'@odata.type': 'microsoft.graph.deviceEnrollmentPlatformRestriction',
platformBlocked: true,
personalDeviceEnrollmentBlocked: true,
osMinimumVersion: 'Os Minimum Version value',
osMaximumVersion: 'Os Maximum Version value'
}
};
await client.api('/deviceManagement/deviceEnrollmentConfigurations')
.post(deviceEnrollmentConfiguration);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\DeviceEnrollmentPlatformRestrictionsConfiguration;
use Microsoft\Graph\Generated\Models\DeviceEnrollmentPlatformRestriction;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DeviceEnrollmentPlatformRestrictionsConfiguration();
$requestBody->setOdataType('#microsoft.graph.deviceEnrollmentPlatformRestrictionsConfiguration');
$requestBody->setDisplayName('Display Name value');
$requestBody->setDescription('Description value');
$requestBody->setPriority(8);
$requestBody->setVersion(7);
$iosRestriction = new DeviceEnrollmentPlatformRestriction();
$iosRestriction->setOdataType('microsoft.graph.deviceEnrollmentPlatformRestriction');
$iosRestriction->setPlatformBlocked(true);
$iosRestriction->setPersonalDeviceEnrollmentBlocked(true);
$iosRestriction->setOsMinimumVersion('Os Minimum Version value');
$iosRestriction->setOsMaximumVersion('Os Maximum Version value');
$requestBody->setIosRestriction($iosRestriction);
$windowsRestriction = new DeviceEnrollmentPlatformRestriction();
$windowsRestriction->setOdataType('microsoft.graph.deviceEnrollmentPlatformRestriction');
$windowsRestriction->setPlatformBlocked(true);
$windowsRestriction->setPersonalDeviceEnrollmentBlocked(true);
$windowsRestriction->setOsMinimumVersion('Os Minimum Version value');
$windowsRestriction->setOsMaximumVersion('Os Maximum Version value');
$requestBody->setWindowsRestriction($windowsRestriction);
$windowsMobileRestriction = new DeviceEnrollmentPlatformRestriction();
$windowsMobileRestriction->setOdataType('microsoft.graph.deviceEnrollmentPlatformRestriction');
$windowsMobileRestriction->setPlatformBlocked(true);
$windowsMobileRestriction->setPersonalDeviceEnrollmentBlocked(true);
$windowsMobileRestriction->setOsMinimumVersion('Os Minimum Version value');
$windowsMobileRestriction->setOsMaximumVersion('Os Maximum Version value');
$requestBody->setWindowsMobileRestriction($windowsMobileRestriction);
$androidRestriction = new DeviceEnrollmentPlatformRestriction();
$androidRestriction->setOdataType('microsoft.graph.deviceEnrollmentPlatformRestriction');
$androidRestriction->setPlatformBlocked(true);
$androidRestriction->setPersonalDeviceEnrollmentBlocked(true);
$androidRestriction->setOsMinimumVersion('Os Minimum Version value');
$androidRestriction->setOsMaximumVersion('Os Maximum Version value');
$requestBody->setAndroidRestriction($androidRestriction);
$macOSRestriction = new DeviceEnrollmentPlatformRestriction();
$macOSRestriction->setOdataType('microsoft.graph.deviceEnrollmentPlatformRestriction');
$macOSRestriction->setPlatformBlocked(true);
$macOSRestriction->setPersonalDeviceEnrollmentBlocked(true);
$macOSRestriction->setOsMinimumVersion('Os Minimum Version value');
$macOSRestriction->setOsMaximumVersion('Os Maximum Version value');
$requestBody->setMacOSRestriction($macOSRestriction);
$result = $graphServiceClient->deviceManagement()->deviceEnrollmentConfigurations()->post($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.Enrollment
$params = @{
"@odata.type" = "#microsoft.graph.deviceEnrollmentPlatformRestrictionsConfiguration"
displayName = "Display Name value"
description = "Description value"
priority = 8
version = 7
iosRestriction = @{
"@odata.type" = "microsoft.graph.deviceEnrollmentPlatformRestriction"
platformBlocked = $true
personalDeviceEnrollmentBlocked = $true
osMinimumVersion = "Os Minimum Version value"
osMaximumVersion = "Os Maximum Version value"
}
windowsRestriction = @{
"@odata.type" = "microsoft.graph.deviceEnrollmentPlatformRestriction"
platformBlocked = $true
personalDeviceEnrollmentBlocked = $true
osMinimumVersion = "Os Minimum Version value"
osMaximumVersion = "Os Maximum Version value"
}
windowsMobileRestriction = @{
"@odata.type" = "microsoft.graph.deviceEnrollmentPlatformRestriction"
platformBlocked = $true
personalDeviceEnrollmentBlocked = $true
osMinimumVersion = "Os Minimum Version value"
osMaximumVersion = "Os Maximum Version value"
}
androidRestriction = @{
"@odata.type" = "microsoft.graph.deviceEnrollmentPlatformRestriction"
platformBlocked = $true
personalDeviceEnrollmentBlocked = $true
osMinimumVersion = "Os Minimum Version value"
osMaximumVersion = "Os Maximum Version value"
}
macOSRestriction = @{
"@odata.type" = "microsoft.graph.deviceEnrollmentPlatformRestriction"
platformBlocked = $true
personalDeviceEnrollmentBlocked = $true
osMinimumVersion = "Os Minimum Version value"
osMaximumVersion = "Os Maximum Version value"
}
}
New-MgDeviceManagementDeviceEnrollmentConfiguration -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.device_enrollment_platform_restrictions_configuration import DeviceEnrollmentPlatformRestrictionsConfiguration
from msgraph.generated.models.device_enrollment_platform_restriction import DeviceEnrollmentPlatformRestriction
# To initialize your graph_client, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DeviceEnrollmentPlatformRestrictionsConfiguration(
odata_type = "#microsoft.graph.deviceEnrollmentPlatformRestrictionsConfiguration",
display_name = "Display Name value",
description = "Description value",
priority = 8,
version = 7,
ios_restriction = DeviceEnrollmentPlatformRestriction(
odata_type = "microsoft.graph.deviceEnrollmentPlatformRestriction",
platform_blocked = True,
personal_device_enrollment_blocked = True,
os_minimum_version = "Os Minimum Version value",
os_maximum_version = "Os Maximum Version value",
),
windows_restriction = DeviceEnrollmentPlatformRestriction(
odata_type = "microsoft.graph.deviceEnrollmentPlatformRestriction",
platform_blocked = True,
personal_device_enrollment_blocked = True,
os_minimum_version = "Os Minimum Version value",
os_maximum_version = "Os Maximum Version value",
),
windows_mobile_restriction = DeviceEnrollmentPlatformRestriction(
odata_type = "microsoft.graph.deviceEnrollmentPlatformRestriction",
platform_blocked = True,
personal_device_enrollment_blocked = True,
os_minimum_version = "Os Minimum Version value",
os_maximum_version = "Os Maximum Version value",
),
android_restriction = DeviceEnrollmentPlatformRestriction(
odata_type = "microsoft.graph.deviceEnrollmentPlatformRestriction",
platform_blocked = True,
personal_device_enrollment_blocked = True,
os_minimum_version = "Os Minimum Version value",
os_maximum_version = "Os Maximum Version value",
),
mac_o_s_restriction = DeviceEnrollmentPlatformRestriction(
odata_type = "microsoft.graph.deviceEnrollmentPlatformRestriction",
platform_blocked = True,
personal_device_enrollment_blocked = True,
os_minimum_version = "Os Minimum Version value",
os_maximum_version = "Os Maximum Version value",
),
)
result = await graph_client.device_management.device_enrollment_configurations.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
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.