名前空間: microsoft.graph
重要
Microsoft Graph の /beta
バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
ライセンス認証なしで ユーザーにハードウェア トークン を割り当てます。 アクティブ化するには、 アクティブ化 API 操作を使用します。
この 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
注:
/me
エンドポイントの呼び出しにはサインインしているユーザーが必要であり、そのため委任されたアクセス許可が必要です。
/me
エンドポイントを使用する場合、アプリケーションのアクセス許可はサポートされません。
ハードウェア OATH 認証方法を別のユーザーに割り当てます。
POST /users/{usersId}/authentication/hardwareOathMethods
名前 |
説明 |
Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
Content-Type |
application/json. 必須です。 |
要求本文
要求本文で、 hardwareOathAuthenticationMethod オブジェクトの JSON 表現を指定します。
hardwareOathAuthenticationMethod を作成するときに、次のプロパティを指定できます。
プロパティ |
型 |
説明 |
id |
String |
ユーザーに割り当てられ、アクティブ化されるハードウェア トークンの ID。 |
応答
成功した場合、このメソッドは応答コード 201 Created
と、応答本文に hardwareOathAuthenticationMethod オブジェクトを返します。
例
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/beta/me/authentication/hardwareOathMethods
Content-Type: application/json
{
"device": {
"id": "aad49556-####-####-####-############"
},
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new HardwareOathAuthenticationMethod
{
Device = new HardwareOathTokenAuthenticationMethodDevice
{
Id = "aad49556-####-####-####-############",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Authentication.HardwareOathMethods.PostAsync(requestBody);
mgc-beta users authentication hardware-oath-methods create --user-id {user-id} --body '{\
"device": {\
"id": "aad49556-####-####-####-############"\
},\
}\
'
// 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"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewHardwareOathAuthenticationMethod()
device := graphmodels.NewHardwareOathTokenAuthenticationMethodDevice()
id := "aad49556-####-####-####-############"
device.SetId(&id)
requestBody.SetDevice(device)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
hardwareOathMethods, err := graphClient.Me().Authentication().HardwareOathMethods().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
HardwareOathAuthenticationMethod hardwareOathAuthenticationMethod = new HardwareOathAuthenticationMethod();
HardwareOathTokenAuthenticationMethodDevice device = new HardwareOathTokenAuthenticationMethodDevice();
device.setId("aad49556-####-####-####-############");
hardwareOathAuthenticationMethod.setDevice(device);
HardwareOathAuthenticationMethod result = graphClient.me().authentication().hardwareOathMethods().post(hardwareOathAuthenticationMethod);
const options = {
authProvider,
};
const client = Client.init(options);
const hardwareOathAuthenticationMethod = {
device: {
id: 'aad49556-####-####-####-############'
},
};
await client.api('/me/authentication/hardwareOathMethods')
.version('beta')
.post(hardwareOathAuthenticationMethod);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\HardwareOathAuthenticationMethod;
use Microsoft\Graph\Beta\Generated\Models\HardwareOathTokenAuthenticationMethodDevice;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new HardwareOathAuthenticationMethod();
$device = new HardwareOathTokenAuthenticationMethodDevice();
$device->setId('aad49556-####-####-####-############');
$requestBody->setDevice($device);
$result = $graphServiceClient->me()->authentication()->hardwareOathMethods()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.SignIns
$params = @{
device = @{
id = "aad49556-####-####-####-############"
}
}
# A UPN can also be used as -UserId.
New-MgBetaUserAuthenticationHardwareOathMethod -UserId $userId -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.models.hardware_oath_authentication_method import HardwareOathAuthenticationMethod
from msgraph_beta.generated.models.hardware_oath_token_authentication_method_device import HardwareOathTokenAuthenticationMethodDevice
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = HardwareOathAuthenticationMethod(
device = HardwareOathTokenAuthenticationMethodDevice(
id = "aad49556-####-####-####-############",
),
)
result = await graph_client.me.authentication.hardware_oath_methods.post(request_body)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.hardwareOathAuthenticationMethod",
"id": "658d0bfe-3cb9-d4d3-5296-147bc3b1f130",
"createdDateTime": "String (timestamp)"
}