One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
The following properties can be updated.
PATCH https://graph.microsoft.com/v1.0/policies/authenticationMethodsPolicy/authenticationMethodConfigurations/x509Certificate
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.x509CertificateAuthenticationMethodConfiguration",
"id": "X509Certificate",
"state": "enabled",
"certificateUserBindings": [
{
"x509CertificateField": "PrincipalName",
"userProperty": "onPremisesUserPrincipalName",
"priority": 1
}
],
"authenticationModeConfiguration": {
"x509CertificateAuthenticationDefaultMode": "x509CertificateMultiFactor",
"rules": [
{
"x509CertificateRuleType": "issuerSubject",
"identifier": "CN=ContosoCA,DC=Contoso,DC=org ",
"x509CertificateAuthenticationMode": "x509CertificateMultiFactor"
},
{
"x509CertificateRuleType": "policyOID",
"identifier": "1.2.3.4",
"x509CertificateAuthenticationMode": "x509CertificateMultiFactor"
}
]
},
"includeTargets": [
{
"targetType": "group",
"id": "all_users",
"isRegistrationRequired": false
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new X509CertificateAuthenticationMethodConfiguration
{
OdataType = "#microsoft.graph.x509CertificateAuthenticationMethodConfiguration",
Id = "X509Certificate",
State = AuthenticationMethodState.Enabled,
CertificateUserBindings = new List<X509CertificateUserBinding>
{
new X509CertificateUserBinding
{
X509CertificateField = "PrincipalName",
UserProperty = "onPremisesUserPrincipalName",
Priority = 1,
},
},
AuthenticationModeConfiguration = new X509CertificateAuthenticationModeConfiguration
{
X509CertificateAuthenticationDefaultMode = X509CertificateAuthenticationMode.X509CertificateMultiFactor,
Rules = new List<X509CertificateRule>
{
new X509CertificateRule
{
X509CertificateRuleType = X509CertificateRuleType.IssuerSubject,
Identifier = "CN=ContosoCA,DC=Contoso,DC=org ",
X509CertificateAuthenticationMode = X509CertificateAuthenticationMode.X509CertificateMultiFactor,
},
new X509CertificateRule
{
X509CertificateRuleType = X509CertificateRuleType.PolicyOID,
Identifier = "1.2.3.4",
X509CertificateAuthenticationMode = X509CertificateAuthenticationMode.X509CertificateMultiFactor,
},
},
},
IncludeTargets = new List<AuthenticationMethodTarget>
{
new AuthenticationMethodTarget
{
TargetType = AuthenticationMethodTargetType.Group,
Id = "all_users",
IsRegistrationRequired = false,
},
},
};
var result = await graphClient.Policies.AuthenticationMethodsPolicy.AuthenticationMethodConfigurations["{authenticationMethodConfiguration-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 policies authentication-methods-policy authentication-method-configurations patch --authentication-method-configuration-id {authenticationMethodConfiguration-id} --body '{\
"@odata.type": "#microsoft.graph.x509CertificateAuthenticationMethodConfiguration",\
"id": "X509Certificate",\
"state": "enabled",\
"certificateUserBindings": [\
{\
"x509CertificateField": "PrincipalName",\
"userProperty": "onPremisesUserPrincipalName",\
"priority": 1\
}\
],\
"authenticationModeConfiguration": {\
"x509CertificateAuthenticationDefaultMode": "x509CertificateMultiFactor",\
"rules": [\
{\
"x509CertificateRuleType": "issuerSubject",\
"identifier": "CN=ContosoCA,DC=Contoso,DC=org ",\
"x509CertificateAuthenticationMode": "x509CertificateMultiFactor"\
},\
{\
"x509CertificateRuleType": "policyOID",\
"identifier": "1.2.3.4",\
"x509CertificateAuthenticationMode": "x509CertificateMultiFactor"\
}\
]\
},\
"includeTargets": [\
{\
"targetType": "group",\
"id": "all_users",\
"isRegistrationRequired": false\
}\
]\
}\
'
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.NewAuthenticationMethodConfiguration()
id := "X509Certificate"
requestBody.SetId(&id)
state := graphmodels.ENABLED_AUTHENTICATIONMETHODSTATE
requestBody.SetState(&state)
x509CertificateUserBinding := graphmodels.NewX509CertificateUserBinding()
x509CertificateField := "PrincipalName"
x509CertificateUserBinding.SetX509CertificateField(&x509CertificateField)
userProperty := "onPremisesUserPrincipalName"
x509CertificateUserBinding.SetUserProperty(&userProperty)
priority := int32(1)
x509CertificateUserBinding.SetPriority(&priority)
certificateUserBindings := []graphmodels.X509CertificateUserBindingable {
x509CertificateUserBinding,
}
requestBody.SetCertificateUserBindings(certificateUserBindings)
authenticationModeConfiguration := graphmodels.NewX509CertificateAuthenticationModeConfiguration()
x509CertificateAuthenticationDefaultMode := graphmodels.X509CERTIFICATEMULTIFACTOR_X509CERTIFICATEAUTHENTICATIONMODE
authenticationModeConfiguration.SetX509CertificateAuthenticationDefaultMode(&x509CertificateAuthenticationDefaultMode)
x509CertificateRule := graphmodels.NewX509CertificateRule()
x509CertificateRuleType := graphmodels.ISSUERSUBJECT_X509CERTIFICATERULETYPE
x509CertificateRule.SetX509CertificateRuleType(&x509CertificateRuleType)
identifier := "CN=ContosoCA,DC=Contoso,DC=org "
x509CertificateRule.SetIdentifier(&identifier)
x509CertificateAuthenticationMode := graphmodels.X509CERTIFICATEMULTIFACTOR_X509CERTIFICATEAUTHENTICATIONMODE
x509CertificateRule.SetX509CertificateAuthenticationMode(&x509CertificateAuthenticationMode)
x509CertificateRule1 := graphmodels.NewX509CertificateRule()
x509CertificateRuleType := graphmodels.POLICYOID_X509CERTIFICATERULETYPE
x509CertificateRule1.SetX509CertificateRuleType(&x509CertificateRuleType)
identifier := "1.2.3.4"
x509CertificateRule1.SetIdentifier(&identifier)
x509CertificateAuthenticationMode := graphmodels.X509CERTIFICATEMULTIFACTOR_X509CERTIFICATEAUTHENTICATIONMODE
x509CertificateRule1.SetX509CertificateAuthenticationMode(&x509CertificateAuthenticationMode)
rules := []graphmodels.X509CertificateRuleable {
x509CertificateRule,
x509CertificateRule1,
}
authenticationModeConfiguration.SetRules(rules)
requestBody.SetAuthenticationModeConfiguration(authenticationModeConfiguration)
authenticationMethodTarget := graphmodels.NewAuthenticationMethodTarget()
targetType := graphmodels.GROUP_AUTHENTICATIONMETHODTARGETTYPE
authenticationMethodTarget.SetTargetType(&targetType)
id := "all_users"
authenticationMethodTarget.SetId(&id)
isRegistrationRequired := false
authenticationMethodTarget.SetIsRegistrationRequired(&isRegistrationRequired)
includeTargets := []graphmodels.AuthenticationMethodTargetable {
authenticationMethodTarget,
}
requestBody.SetIncludeTargets(includeTargets)
authenticationMethodConfigurations, err := graphClient.Policies().AuthenticationMethodsPolicy().AuthenticationMethodConfigurations().ByAuthenticationMethodConfigurationId("authenticationMethodConfiguration-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();
X509CertificateAuthenticationMethodConfiguration authenticationMethodConfiguration = new X509CertificateAuthenticationMethodConfiguration();
authenticationMethodConfiguration.id = "X509Certificate";
authenticationMethodConfiguration.state = AuthenticationMethodState.ENABLED;
LinkedList<X509CertificateUserBinding> certificateUserBindingsList = new LinkedList<X509CertificateUserBinding>();
X509CertificateUserBinding certificateUserBindings = new X509CertificateUserBinding();
certificateUserBindings.x509CertificateField = "PrincipalName";
certificateUserBindings.userProperty = "onPremisesUserPrincipalName";
certificateUserBindings.priority = 1;
certificateUserBindingsList.add(certificateUserBindings);
authenticationMethodConfiguration.certificateUserBindings = certificateUserBindingsList;
X509CertificateAuthenticationModeConfiguration authenticationModeConfiguration = new X509CertificateAuthenticationModeConfiguration();
authenticationModeConfiguration.x509CertificateAuthenticationDefaultMode = X509CertificateAuthenticationMode.X509_CERTIFICATE_MULTI_FACTOR;
LinkedList<X509CertificateRule> rulesList = new LinkedList<X509CertificateRule>();
X509CertificateRule rules = new X509CertificateRule();
rules.x509CertificateRuleType = X509CertificateRuleType.ISSUER_SUBJECT;
rules.identifier = "CN=ContosoCA,DC=Contoso,DC=org ";
rules.x509CertificateAuthenticationMode = X509CertificateAuthenticationMode.X509_CERTIFICATE_MULTI_FACTOR;
rulesList.add(rules);
X509CertificateRule rules1 = new X509CertificateRule();
rules1.x509CertificateRuleType = X509CertificateRuleType.POLICY_O_I_D;
rules1.identifier = "1.2.3.4";
rules1.x509CertificateAuthenticationMode = X509CertificateAuthenticationMode.X509_CERTIFICATE_MULTI_FACTOR;
rulesList.add(rules1);
authenticationModeConfiguration.rules = rulesList;
authenticationMethodConfiguration.authenticationModeConfiguration = authenticationModeConfiguration;
LinkedList<AuthenticationMethodTarget> includeTargetsList = new LinkedList<AuthenticationMethodTarget>();
AuthenticationMethodTarget includeTargets = new AuthenticationMethodTarget();
includeTargets.targetType = AuthenticationMethodTargetType.GROUP;
includeTargets.id = "all_users";
includeTargets.isRegistrationRequired = false;
includeTargetsList.add(includeTargets);
AuthenticationMethodTargetCollectionResponse authenticationMethodTargetCollectionResponse = new AuthenticationMethodTargetCollectionResponse();
authenticationMethodTargetCollectionResponse.value = includeTargetsList;
AuthenticationMethodTargetCollectionPage authenticationMethodTargetCollectionPage = new AuthenticationMethodTargetCollectionPage(authenticationMethodTargetCollectionResponse, null);
authenticationMethodConfiguration.includeTargets = authenticationMethodTargetCollectionPage;
graphClient.policies().authenticationMethodsPolicy().authenticationMethodConfigurations("x509Certificate")
.buildRequest()
.patch(authenticationMethodConfiguration);
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 authenticationMethodConfiguration = {
'@odata.type': '#microsoft.graph.x509CertificateAuthenticationMethodConfiguration',
id: 'X509Certificate',
state: 'enabled',
certificateUserBindings: [
{
x509CertificateField: 'PrincipalName',
userProperty: 'onPremisesUserPrincipalName',
priority: 1
}
],
authenticationModeConfiguration: {
x509CertificateAuthenticationDefaultMode: 'x509CertificateMultiFactor',
rules: [
{
x509CertificateRuleType: 'issuerSubject',
identifier: 'CN=ContosoCA,DC=Contoso,DC=org ',
x509CertificateAuthenticationMode: 'x509CertificateMultiFactor'
},
{
x509CertificateRuleType: 'policyOID',
identifier: '1.2.3.4',
x509CertificateAuthenticationMode: 'x509CertificateMultiFactor'
}
]
},
includeTargets: [
{
targetType: 'group',
id: 'all_users',
isRegistrationRequired: false
}
]
};
await client.api('/policies/authenticationMethodsPolicy/authenticationMethodConfigurations/x509Certificate')
.update(authenticationMethodConfiguration);
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 X509CertificateAuthenticationMethodConfiguration();
$requestBody->setOdataType('#microsoft.graph.x509CertificateAuthenticationMethodConfiguration');
$requestBody->setId('X509Certificate');
$requestBody->setState(new AuthenticationMethodState('enabled'));
$certificateUserBindingsX509CertificateUserBinding1 = new X509CertificateUserBinding();
$certificateUserBindingsX509CertificateUserBinding1->setX509CertificateField('PrincipalName');
$certificateUserBindingsX509CertificateUserBinding1->setUserProperty('onPremisesUserPrincipalName');
$certificateUserBindingsX509CertificateUserBinding1->setPriority(1);
$certificateUserBindingsArray []= $certificateUserBindingsX509CertificateUserBinding1;
$requestBody->setCertificateUserBindings($certificateUserBindingsArray);
$authenticationModeConfiguration = new X509CertificateAuthenticationModeConfiguration();
$authenticationModeConfiguration->setX509CertificateAuthenticationDefaultMode(new X509CertificateAuthenticationMode('x509CertificateMultiFactor'));
$rulesX509CertificateRule1 = new X509CertificateRule();
$rulesX509CertificateRule1->setX509CertificateRuleType(new X509CertificateRuleType('issuerSubject'));
$rulesX509CertificateRule1->setIdentifier('CN=ContosoCA,DC=Contoso,DC=org ');
$rulesX509CertificateRule1->setX509CertificateAuthenticationMode(new X509CertificateAuthenticationMode('x509CertificateMultiFactor'));
$rulesArray []= $rulesX509CertificateRule1;
$rulesX509CertificateRule2 = new X509CertificateRule();
$rulesX509CertificateRule2->setX509CertificateRuleType(new X509CertificateRuleType('policyOID'));
$rulesX509CertificateRule2->setIdentifier('1.2.3.4');
$rulesX509CertificateRule2->setX509CertificateAuthenticationMode(new X509CertificateAuthenticationMode('x509CertificateMultiFactor'));
$rulesArray []= $rulesX509CertificateRule2;
$authenticationModeConfiguration->setRules($rulesArray);
$requestBody->setAuthenticationModeConfiguration($authenticationModeConfiguration);
$includeTargetsAuthenticationMethodTarget1 = new AuthenticationMethodTarget();
$includeTargetsAuthenticationMethodTarget1->setTargetType(new AuthenticationMethodTargetType('group'));
$includeTargetsAuthenticationMethodTarget1->setId('all_users');
$includeTargetsAuthenticationMethodTarget1->setIsRegistrationRequired(false);
$includeTargetsArray []= $includeTargetsAuthenticationMethodTarget1;
$requestBody->setIncludeTargets($includeTargetsArray);
$result = $graphServiceClient->policies()->authenticationMethodsPolicy()->authenticationMethodConfigurations()->byAuthenticationMethodConfigurationId('authenticationMethodConfiguration-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.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.x509CertificateAuthenticationMethodConfiguration"
id = "X509Certificate"
state = "enabled"
certificateUserBindings = @(
)
includeTargets = @(
)
}
Update-MgPolicyAuthenticationMethodPolicyAuthenticationMethodConfiguration -AuthenticationMethodConfigurationId $authenticationMethodConfigurationId -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 = X509CertificateAuthenticationMethodConfiguration(
odata_type = "#microsoft.graph.x509CertificateAuthenticationMethodConfiguration",
id = "X509Certificate",
state = AuthenticationMethodState.Enabled,
certificate_user_bindings = [
X509CertificateUserBinding(
x509_certificate_field = "PrincipalName",
user_property = "onPremisesUserPrincipalName",
priority = 1,
),
]
authentication_mode_configuration = X509CertificateAuthenticationModeConfiguration(
x509_certificate_authentication_default_mode = X509CertificateAuthenticationMode.X509CertificateMultiFactor,
rules = [
X509CertificateRule(
x509_certificate_rule_type = X509CertificateRuleType.IssuerSubject,
identifier = "CN=ContosoCA,DC=Contoso,DC=org ",
x509_certificate_authentication_mode = X509CertificateAuthenticationMode.X509CertificateMultiFactor,
),
X509CertificateRule(
x509_certificate_rule_type = X509CertificateRuleType.PolicyOID,
identifier = "1.2.3.4",
x509_certificate_authentication_mode = X509CertificateAuthenticationMode.X509CertificateMultiFactor,
),
]
),
include_targets = [
AuthenticationMethodTarget(
target_type = AuthenticationMethodTargetType.Group,
id = "all_users",
is_registration_required = False,
),
]
)
result = await graph_client.policies.authentication_method_policy.authentication_method_configurations.by_authentication_method_configuration_id('authenticationMethodConfiguration-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.