title | description | author | ms.reviewer | ms.localizationpriority | ms.subservice | doc_type |
---|---|---|---|---|---|---|
Create temporaryAccessPassMethod |
Create a new temporaryAccessPassAuthenticationMethod object for a user. |
tilarso |
intelligentaccesspm |
medium |
entra-sign-in |
apiPageType |
Namespace: microsoft.graph
[!INCLUDE beta-disclaimer]
Create a new temporaryAccessPassAuthenticationMethod object on a user. A user can only have one Temporary Access Pass that's usable within its specified lifetime. If the user requires a new Temporary Access Pass while the current Temporary Access Pass is valid, the admin can create a new Temporary Access Pass for the user, the previous Temporary Access Pass will be deleted, and a new Temporary Access Pass will be created.
[!INCLUDE national-cloud-support]
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
[!INCLUDE permissions-table]
[!INCLUDE rbac-authentication-methods-apis-write-others]
POST /users/{id | userPrincipalName}/authentication/temporaryAccessPassMethods
Name | Description |
---|---|
Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
Content-Type | application/json. Required. |
In the request body, supply a JSON representation of the temporaryAccessPassAuthenticationMethod object.
The following table describes optional properties that can be used when creating the temporaryAccessPassAuthenticationMethod.
Property | Type | Description |
---|---|---|
isUsableOnce | Boolean | Optional. Determines if the pass is limited to a one-time use. If true , the pass can be used once; if false , the pass can be used multiple times within its lifetimeInMinutes setting. A multi-use Temporary Access Pass (isUsableOnce = false ), can only be created and used for sign-in if it is allowed by the Temporary Access Pass authentication method policy. |
lifetimeInMinutes | Int32 | Optional. The lifetime of the temporaryAccessPass in minutes starting at creation time or at startDateTime, if set. Must be between 10 and 43200 (equivalent to 30 days). If not specified, the defaultLifetimeInMinutes setting in the Temporary Access Pass authentication method policy is applied. |
startDateTime | DateTimeOffset | Optional. The date and time when the temporaryAccessPass becomes available to use. If not specified, the Temporary Access Pass is available to use immediately after it's created. |
If successful, this method returns a 201 Created
response code and a temporaryAccessPassAuthenticationMethod object in the response body.
POST https://graph.microsoft.com/beta/users/071cc716-8147-4397-a5ba-b2105951cc0b/authentication/temporaryAccessPassMethods
Content-Type: application/json
{
"startDateTime": "2022-06-05T00:00:00.000Z",
"lifetimeInMinutes": 60,
"isUsableOnce": false
}
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.temporaryAccessPassAuthenticationMethod",
"id": "6f1967b7-15e8-4935-ac26-d50770ed07a7",
"temporaryAccessPass": "+drkzqAD",
"createdDateTime": "2022-06-02T16:21:09.765173Z",
"startDateTime": "2022-06-05T00:00:00Z",
"lifetimeInMinutes": 60,
"isUsableOnce": false,
"isUsable": false,
"methodUsabilityReason": "NotYetValid"
}