名前空間: microsoft.graph
重要
Microsoft Graph の /beta
バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
ユーザーに既に割り当てられている ハードウェア OATH トークン をアクティブ化します。 ユーザーは自分のトークンを自己アクティブ化するか、管理者がユーザーに対してアクティブ化できます。
この API は、次の国内クラウド展開で使用できます。
グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
✅ |
❌ |
❌ |
❌ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
自己に対して動作するアクセス許可
アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
委任 (職場または学校のアカウント) |
UserAuthenticationMethod.ReadWrite |
UserAuthenticationMethod.ReadWrite.All |
委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
アプリケーション |
サポートされていません。 |
サポートされていません。 |
他のユーザーに対して動作するアクセス許可
アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
委任 (職場または学校のアカウント) |
UserAuthenticationMethod.ReadWrite.All |
注意事項なし。 |
委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
アプリケーション |
UserAuthenticationMethod.ReadWrite.All |
注意事項なし。 |
重要
サインインしているユーザーが別のユーザーを操作している職場または学校アカウントで委任されたシナリオでは、サポートされているMicrosoft Entraロールまたはサポートされているロールのアクセス許可を持つカスタム ロールを割り当てる必要があります。 この操作では、次の最小特権ロールがサポートされています。
HTTP 要求
割り当てられたハードウェア OATH 認証方法をアクティブ化します。
POST /me/authentication/hardwareOathMethods/{hardwareOathAuthenticationMethodId}/activate
注:
/me
エンドポイントの呼び出しにはサインインしているユーザーが必要であり、そのため委任されたアクセス許可が必要です。
/me
エンドポイントを使用する場合、アプリケーションのアクセス許可はサポートされません。
別のユーザーに割り当てられたハードウェア OATH 認証方法をアクティブ化します。
POST /users/{usersId}/authentication/hardwareOathMethods/{hardwareOathAuthenticationMethodId}/activate
名前 |
説明 |
Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
Content-Type |
application/json. 必須です。 |
要求本文
要求本文で、パラメーターの JSON 表現を指定します。
次の表に、このアクションを呼び出すときに必要なパラメーターを示します。
パラメーター |
型 |
説明 |
verificationCode |
String |
ハードウェア OATH トークンで 30 秒または 60 秒ごとに更新される 6 桁の TOTP コード。 |
displayName |
String |
ハードウェア OATH トークンに指定できる省略可能な名前。 |
応答
成功した場合、このアクションは 204 No Content
応答コードを返します。
例
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/beta/me/authentication/hardwareOathMethods/{hardwareOathAuthenticationMethodId}/activate
Content-Type: application/json
{
"verificationCode": "588651",
"displayName": "Amy Masters Token"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Me.Authentication.HardwareOathMethods.Item.Activate;
var requestBody = new ActivatePostRequestBody
{
VerificationCode = "588651",
DisplayName = "Amy Masters Token",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Me.Authentication.HardwareOathMethods["{hardwareOathAuthenticationMethod-id}"].Activate.PostAsync(requestBody);
mgc-beta users authentication hardware-oath-methods activate post --user-id {user-id} --hardware-oath-authentication-method-id {hardwareOathAuthenticationMethod-id} --body '{\
"verificationCode": "588651",\
"displayName": "Amy Masters Token"\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphusers "github.com/microsoftgraph/msgraph-beta-sdk-go/users"
//other-imports
)
requestBody := graphusers.NewItemActivatePostRequestBody()
verificationCode := "588651"
requestBody.SetVerificationCode(&verificationCode)
displayName := "Amy Masters Token"
requestBody.SetDisplayName(&displayName)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Me().Authentication().HardwareOathMethods().ByHardwareOathAuthenticationMethodId("hardwareOathAuthenticationMethod-id").Activate().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.users.item.authentication.hardwareoathmethods.item.activate.ActivatePostRequestBody activatePostRequestBody = new com.microsoft.graph.beta.users.item.authentication.hardwareoathmethods.item.activate.ActivatePostRequestBody();
activatePostRequestBody.setVerificationCode("588651");
activatePostRequestBody.setDisplayName("Amy Masters Token");
graphClient.me().authentication().hardwareOathMethods().byHardwareOathAuthenticationMethodId("{hardwareOathAuthenticationMethod-id}").activate().post(activatePostRequestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const activate = {
verificationCode: '588651',
displayName: 'Amy Masters Token'
};
await client.api('/me/authentication/hardwareOathMethods/{hardwareOathAuthenticationMethodId}/activate')
.version('beta')
.post(activate);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Users\Item\Authentication\HardwareOathMethods\Item\Activate\ActivatePostRequestBody;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ActivatePostRequestBody();
$requestBody->setVerificationCode('588651');
$requestBody->setDisplayName('Amy Masters Token');
$graphServiceClient->me()->authentication()->hardwareOathMethods()->byHardwareOathAuthenticationMethodId('hardwareOathAuthenticationMethod-id')->activate()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.SignIns
$params = @{
verificationCode = "588651"
displayName = "Amy Masters Token"
}
# A UPN can also be used as -UserId.
Initialize-MgBetaUserAuthenticationHardwareOathMethod -UserId $userId -HardwareOathAuthenticationMethodId $hardwareOathAuthenticationMethodId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.users.item.authentication.hardwareoathmethods.item.activate.activate_post_request_body import ActivatePostRequestBody
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ActivatePostRequestBody(
verification_code = "588651",
display_name = "Amy Masters Token",
)
await graph_client.me.authentication.hardware_oath_methods.by_hardware_oath_authentication_method_id('hardwareOathAuthenticationMethod-id').activate.post(request_body)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 204 No Content