APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
You can specify the following properties when creating an authenticationStrengthPolicy.
Property
Type
Description
displayName
String
The display name of the policy to be created. Required.
description
String
The description of the policy to be created. Optional.
allowedCombinations
authenticationMethodModes collection
The authentication method combinations allowed by this authentication strength policy. The possible values of this flagged enum are: password, voice, hardwareOath, softwareOath, sms, fido2, windowsHelloForBusiness, microsoftAuthenticatorPush, deviceBasedPush, temporaryAccessPassOneTime, temporaryAccessPassMultiUse, email, x509CertificateSingleFactor, x509CertificateMultiFactor, federatedSingleFactor, federatedMultiFactor, unknownFutureValue. For the list of allowed combinations, call the List authenticationMethodModes API. Required.
Response
If successful, this method returns a 201 Created response code and an authenticationStrengthPolicy object in the response body.
POST https://graph.microsoft.com/beta/policies/authenticationStrengthPolicies
Content-Type: application/json
Content-length: 239
{
"@odata.type" : "#microsoft.graph.authenticationStrengthPolicy",
"displayName": "Contoso authentication level",
"description": "The only authentication level allowed to access our secret apps",
"allowedCombinations": [
"password, hardwareOath",
"password, sms"
]
}
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new AuthenticationStrengthPolicy
{
OdataType = "#microsoft.graph.authenticationStrengthPolicy",
DisplayName = "Contoso authentication level",
Description = "The only authentication level allowed to access our secret apps",
AllowedCombinations = new List<AuthenticationMethodModes?>
{
AuthenticationMethodModes.Password | AuthenticationMethodModes.HardwareOath,
AuthenticationMethodModes.Password | AuthenticationMethodModes.Sms,
},
};
var result = await graphClient.Policies.AuthenticationStrengthPolicies.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
AuthenticationStrengthPolicy authenticationStrengthPolicy = new AuthenticationStrengthPolicy();
authenticationStrengthPolicy.displayName = "Contoso authentication level";
authenticationStrengthPolicy.description = "The only authentication level allowed to access our secret apps";
LinkedList<AuthenticationMethodModes> allowedCombinationsList = new LinkedList<AuthenticationMethodModes>();
allowedCombinationsList.add(AuthenticationMethodModes.PASSWORD);
allowedCombinationsList.add(AuthenticationMethodModes.HARDWARE_OATH);
allowedCombinationsList.add(AuthenticationMethodModes.PASSWORD);
allowedCombinationsList.add(AuthenticationMethodModes.SMS);
authenticationStrengthPolicy.allowedCombinations = allowedCombinationsList;
graphClient.policies().authenticationStrengthPolicies()
.buildRequest()
.post(authenticationStrengthPolicy);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewAuthenticationStrengthPolicy()
displayName := "Contoso authentication level"
requestBody.SetDisplayName(&displayName)
description := "The only authentication level allowed to access our secret apps"
requestBody.SetDescription(&description)
allowedCombinations := []graphmodels.AuthenticationMethodModesable {
authenticationMethodModes := graphmodels.PASSWORD, HARDWAREOATH_AUTHENTICATIONMETHODMODES
requestBody.SetAuthenticationMethodModes(&authenticationMethodModes)
authenticationMethodModes := graphmodels.PASSWORD, SMS_AUTHENTICATIONMETHODMODES
requestBody.SetAuthenticationMethodModes(&authenticationMethodModes)
}
requestBody.SetAllowedCombinations(allowedCombinations)
result, err := graphClient.Policies().AuthenticationStrengthPolicies().Post(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new AuthenticationStrengthPolicy();
$requestBody->set@odatatype('#microsoft.graph.authenticationStrengthPolicy');
$requestBody->setDisplayName('Contoso authentication level');
$requestBody->setDescription('The only authentication level allowed to access our secret apps');
$requestBody->setAllowedCombinations([$requestBody->setAuthenticationMethodModes(new AuthenticationMethodModes('password, hardwareoath'));
$requestBody->setAuthenticationMethodModes(new AuthenticationMethodModes('password, sms'));
]);
$requestResult = $graphServiceClient->policies()->authenticationStrengthPolicies()->post($requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.