Indicates if on premises conditional access is enabled for this organization
includedGroups
Guid collection
User groups that will be targeted by on premises conditional access. All users in these groups will be required to have mobile device managed and compliant for mail access.
excludedGroups
Guid collection
User groups that will be exempt by on premises conditional access. All users in these groups will be exempt from the conditional access policy.
overrideDefaultRule
Boolean
Override the default access rule when allowing a device to ensure access is granted.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new OnPremisesConditionalAccessSettings
{
OdataType = "#microsoft.graph.onPremisesConditionalAccessSettings",
Enabled = true,
IncludedGroups = new List<Guid?>
{
Guid.Parse("77c9d466-d466-77c9-66d4-c97766d4c977"),
},
ExcludedGroups = new List<Guid?>
{
Guid.Parse("2a0afae4-fae4-2a0a-e4fa-0a2ae4fa0a2a"),
},
OverrideDefaultRule = 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.ConditionalAccessSettings.PatchAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OnPremisesConditionalAccessSettings onPremisesConditionalAccessSettings = new OnPremisesConditionalAccessSettings();
onPremisesConditionalAccessSettings.setOdataType("#microsoft.graph.onPremisesConditionalAccessSettings");
onPremisesConditionalAccessSettings.setEnabled(true);
LinkedList<UUID> includedGroups = new LinkedList<UUID>();
includedGroups.add(UUID.fromString("77c9d466-d466-77c9-66d4-c97766d4c977"));
onPremisesConditionalAccessSettings.setIncludedGroups(includedGroups);
LinkedList<UUID> excludedGroups = new LinkedList<UUID>();
excludedGroups.add(UUID.fromString("2a0afae4-fae4-2a0a-e4fa-0a2ae4fa0a2a"));
onPremisesConditionalAccessSettings.setExcludedGroups(excludedGroups);
onPremisesConditionalAccessSettings.setOverrideDefaultRule(true);
OnPremisesConditionalAccessSettings result = graphClient.deviceManagement().conditionalAccessSettings().patch(onPremisesConditionalAccessSettings);
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.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback.