Create tokenIssuancePolicy
Article
03/02/2023
7 contributors
Feedback
In this article
Namespace: microsoft.graph
Create a new tokenIssuancePolicy 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)
Policy.ReadWrite.ApplicationConfiguration
Delegated (personal Microsoft account)
Not supported.
Application
Policy.ReadWrite.ApplicationConfiguration
HTTP request
POST policies/tokenIssuancePolicies
Name
Description
Authorization
Bearer {token}. Required.
Content-type
application/json. Required.
Request body
In the request body, supply a JSON representation of a tokenIssuancePolicy object.
Response
If successful, this method returns a 201 Created
response code and a new tokenIssuancePolicy object in the response body.
Examples
Request
The following is an example of the request.
POST https://graph.microsoft.com/v1.0/policies/tokenIssuancePolicies
Content-type: application/json
{
"definition": [
"definition-value"
],
"displayName": "displayName-value",
"isOrganizationDefault": true
}
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new TokenIssuancePolicy
{
Definition = new List<string>
{
"definition-value",
},
DisplayName = "displayName-value",
IsOrganizationDefault = true,
};
var result = await graphClient.Policies.TokenIssuancePolicies.PostAsync(requestBody);
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.NewTokenIssuancePolicy()
definition := []string {
"definition-value",
}
requestBody.SetDefinition(definition)
displayName := "displayName-value"
requestBody.SetDisplayName(&displayName)
isOrganizationDefault := true
requestBody.SetIsOrganizationDefault(&isOrganizationDefault)
result, err := graphClient.Policies().TokenIssuancePolicies().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 .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
TokenIssuancePolicy tokenIssuancePolicy = new TokenIssuancePolicy();
LinkedList<String> definitionList = new LinkedList<String>();
definitionList.add("definition-value");
tokenIssuancePolicy.definition = definitionList;
tokenIssuancePolicy.displayName = "displayName-value";
tokenIssuancePolicy.isOrganizationDefault = true;
graphClient.policies().tokenIssuancePolicies()
.buildRequest()
.post(tokenIssuancePolicy);
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 tokenIssuancePolicy = {
definition: [
'definition-value'
],
displayName: 'displayName-value',
isOrganizationDefault: true
};
await client.api('/policies/tokenIssuancePolicies')
.post(tokenIssuancePolicy);
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 FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new TokenIssuancePolicy();
$requestBody->setDefinition(['definition-value', ]);
$requestBody->setDisplayName('displayName-value');
$requestBody->setIsOrganizationDefault(true);
$result = $graphServiceClient->policies()->tokenIssuancePolicies()->post($requestBody);
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 = @{
definition = @(
"definition-value"
)
displayName = "displayName-value"
isOrganizationDefault = $true
}
New-MgPolicyTokenIssuancePolicy -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
The following is an example of the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-type: application/json
{
"definition": [
"definition-value"
],
"displayName": "displayName-value",
"isOrganizationDefault": true,
"id": "id-value"
}