Namespace: microsoft.graph
Wichtig
Die APIs unter der /beta Version in Microsoft Graph können sich ändern. Die Verwendung dieser APIs in Produktionsanwendungen wird nicht unterstützt. Um festzustellen, ob eine API in v1.0 verfügbar ist, verwenden Sie die Version Selektor.
Listet alle HARDWARE-OATH-Token im Verzeichnis auf.
Diese API ist in den folgenden nationalen Cloudbereitstellungen verfügbar.
| Weltweiter Service |
US Government L4 |
US Government L5 (DOD) |
China, betrieben von 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Berechtigungen
Wählen Sie die Berechtigungen aus, die für diese API als am wenigsten privilegiert markiert sind. Verwenden Sie eine höhere Berechtigung oder Berechtigungen nur, wenn Ihre App dies erfordert. Ausführliche Informationen zu delegierten Berechtigungen und Anwendungsberechtigungen finden Sie unter Berechtigungstypen. Weitere Informationen zu diesen Berechtigungen finden Sie in der Berechtigungsreferenz.
| Berechtigungstyp |
Berechtigungen mit den geringsten Berechtigungen |
Berechtigungen mit höheren Berechtigungen |
| Delegiert (Geschäfts-, Schul- oder Unikonto) |
Policy.Read.All |
Policy.ReadWrite.AuthenticationMethod |
| Delegiert (persönliches Microsoft-Konto) |
Nicht unterstützt |
Nicht unterstützt |
| Anwendung |
Policy.Read.All |
Policy.ReadWrite.AuthenticationMethod |
Wichtig
In delegierten Szenarien mit Geschäfts-, Schul- oder Unikonten muss dem angemeldeten Benutzer eine unterstützte Microsoft Entra Rolle oder eine benutzerdefinierte Rolle mit einer unterstützten Rollenberechtigung zugewiesen werden. Die folgenden Rollen mit den geringsten Berechtigungen werden für diesen Vorgang unterstützt.
- Globaler Leser
- Authentifizierungsrichtlinienadministrator
HTTP-Anforderung
GET /directory/authenticationMethodDevices/hardwareOathDevices
Optionale Abfrageparameter
Diese Methode unterstützt $selectdie Abfrageparameter , $filter (eq) und $top OData, um die Antwort anzupassen. Allgemeine Informationen finden Sie unter OData-Abfrageparameter.
Anforderungstext
Geben Sie keinen Anforderungstext für diese Methode an.
Antwort
Wenn die Methode erfolgreich verläuft, werden der 200 OK Antwortcode und eine Sammlung von hardwareOathTokenAuthenticationMethodDevice-Objekten im Antworttext zurückgegeben.
Beispiele
Beispiel 1: Auflisten aller Token im Bestand
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
GET https://graph.microsoft.com/beta/directory/authenticationMethodDevices/hardwareOathDevices
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Directory.AuthenticationMethodDevices.HardwareOathDevices.GetAsync();
// 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"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
hardwareOathDevices, err := graphClient.Directory().AuthenticationMethodDevices().HardwareOathDevices().Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
HardwareOathTokenAuthenticationMethodDeviceCollectionResponse result = graphClient.directory().authenticationMethodDevices().hardwareOathDevices().get();
const options = {
authProvider,
};
const client = Client.init(options);
let hardwareOathDevices = await client.api('/directory/authenticationMethodDevices/hardwareOathDevices')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->directory()->authenticationMethodDevices()->hardwareOathDevices()->get()->wait();
Import-Module Microsoft.Graph.Beta.Identity.DirectoryManagement
Get-MgBetaDirectoryAuthenticationMethodDeviceHardwareOathDevice
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.directory.authentication_method_devices.hardware_oath_devices.get()
Antwort
Das folgende Beispiel zeigt die Antwort.
Hinweis: Das hier gezeigte Antwortobjekt kann zur besseren Lesbarkeit gekürzt werden.
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": [
{
"@odata.type": "#microsoft.graph.hardwareOathAuthenticationMethod",
"id": "aad49556-####-####-####-############",
"device": {
"id": "aad49556-####-####-####-############",
"displayName": "Amy Masters Token 1",
"serialNumber": "TOTP123456",
"manufacturer": "Contoso",
"model": "Hardware Token 1000",
"secretKey": null,
"timeIntervalInSeconds": 30,
"status": "activated",
"hashFunction": "hmacsha1",
"assignedTo": {
"id": "0cadbf92-####-####-####-############",
"displayName": "Amy Masters"
}
}
},
{
"@odata.type": "#microsoft.graph.hardwareOathAuthenticationMethod",
"id": "3dee0e53-####-####-####-############",
"device": {
"id": "3dee0e53-####-####-####-############",
"displayName": "Amy Masters Token 2",
"serialNumber": "TOTP654321",
"manufacturer": "Contoso",
"model": "Hardware Token 1000",
"secretKey": null,
"timeIntervalInSeconds": 30,
"status": "assigned",
"hashFunction": "hmacsha1",
"assignedTo": {
"id": "0cadbf92-####-####-####-############",
"displayName": "Amy Masters"
}
}
}
]
}
Beispiel 2: Auflisten aller Token im Bestand, gefiltert nach status
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
GET https://graph.microsoft.com/beta/directory/authenticationMethodDevices/hardwareOathDevices?$filter=status eq 'activated'
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Directory.AuthenticationMethodDevices.HardwareOathDevices.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Filter = "status eq 'activated'";
});
// 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"
graphdirectory "github.com/microsoftgraph/msgraph-beta-sdk-go/directory"
//other-imports
)
requestFilter := "status eq 'activated'"
requestParameters := &graphdirectory.AuthenticationMethodDevicesHardwareOathDevicesRequestBuilderGetQueryParameters{
Filter: &requestFilter,
}
configuration := &graphdirectory.AuthenticationMethodDevicesHardwareOathDevicesRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
hardwareOathDevices, err := graphClient.Directory().AuthenticationMethodDevices().HardwareOathDevices().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
HardwareOathTokenAuthenticationMethodDeviceCollectionResponse result = graphClient.directory().authenticationMethodDevices().hardwareOathDevices().get(requestConfiguration -> {
requestConfiguration.queryParameters.filter = "status eq 'activated'";
});
const options = {
authProvider,
};
const client = Client.init(options);
let hardwareOathDevices = await client.api('/directory/authenticationMethodDevices/hardwareOathDevices')
.version('beta')
.filter('status eq \'activated\'')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Directory\AuthenticationMethodDevices\HardwareOathDevices\HardwareOathDevicesRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new HardwareOathDevicesRequestBuilderGetRequestConfiguration();
$queryParameters = HardwareOathDevicesRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->filter = "status eq 'activated'";
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->directory()->authenticationMethodDevices()->hardwareOathDevices()->get($requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Identity.DirectoryManagement
Get-MgBetaDirectoryAuthenticationMethodDeviceHardwareOathDevice -Filter "status eq 'activated'"
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.directory.authentication_method_devices.hardware_oath_devices.hardware_oath_devices_request_builder import HardwareOathDevicesRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = HardwareOathDevicesRequestBuilder.HardwareOathDevicesRequestBuilderGetQueryParameters(
filter = "status eq 'activated'",
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.directory.authentication_method_devices.hardware_oath_devices.get(request_configuration = request_configuration)
Antwort
Das folgende Beispiel zeigt die Antwort.
Hinweis: Das hier gezeigte Antwortobjekt kann zur besseren Lesbarkeit gekürzt werden.
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": [
{
"@odata.type": "#microsoft.graph.hardwareOathAuthenticationMethod",
"id": "3dee0e53-####-####-####-############",
"device": {
"id": "3dee0e53-####-####-####-############",
"displayName": "Amy Masters Token 2",
"serialNumber": "TOTP654321",
"manufacturer": "Contoso",
"model": "Hardware Token 1000",
"secretKey": null,
"timeIntervalInSeconds": 30,
"status": "assigned",
"hashFunction": "hmacsha1",
"assignedTo": {
"id": "0cadbf92-####-####-####-############",
"displayName": "Amy Masters"
}
}
}
]
}
Beispiel 3: Suchen eines bestimmten Tokens nach Seriennummer
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
GET https://graph.microsoft.com/beta/directory/authenticationMethodDevices/hardwareOathDevices?$filter=serialNumber eq 'TOTP123456'
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Directory.AuthenticationMethodDevices.HardwareOathDevices.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Filter = "serialNumber eq 'TOTP123456'";
});
// 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"
graphdirectory "github.com/microsoftgraph/msgraph-beta-sdk-go/directory"
//other-imports
)
requestFilter := "serialNumber eq 'TOTP123456'"
requestParameters := &graphdirectory.AuthenticationMethodDevicesHardwareOathDevicesRequestBuilderGetQueryParameters{
Filter: &requestFilter,
}
configuration := &graphdirectory.AuthenticationMethodDevicesHardwareOathDevicesRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
hardwareOathDevices, err := graphClient.Directory().AuthenticationMethodDevices().HardwareOathDevices().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
HardwareOathTokenAuthenticationMethodDeviceCollectionResponse result = graphClient.directory().authenticationMethodDevices().hardwareOathDevices().get(requestConfiguration -> {
requestConfiguration.queryParameters.filter = "serialNumber eq 'TOTP123456'";
});
const options = {
authProvider,
};
const client = Client.init(options);
let hardwareOathDevices = await client.api('/directory/authenticationMethodDevices/hardwareOathDevices')
.version('beta')
.filter('serialNumber eq \'TOTP123456\'')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Directory\AuthenticationMethodDevices\HardwareOathDevices\HardwareOathDevicesRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new HardwareOathDevicesRequestBuilderGetRequestConfiguration();
$queryParameters = HardwareOathDevicesRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->filter = "serialNumber eq 'TOTP123456'";
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->directory()->authenticationMethodDevices()->hardwareOathDevices()->get($requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Identity.DirectoryManagement
Get-MgBetaDirectoryAuthenticationMethodDeviceHardwareOathDevice -Filter "serialNumber eq 'TOTP123456'"
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.directory.authentication_method_devices.hardware_oath_devices.hardware_oath_devices_request_builder import HardwareOathDevicesRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = HardwareOathDevicesRequestBuilder.HardwareOathDevicesRequestBuilderGetQueryParameters(
filter = "serialNumber eq 'TOTP123456'",
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.directory.authentication_method_devices.hardware_oath_devices.get(request_configuration = request_configuration)
Antwort
Das folgende Beispiel zeigt die Antwort.
Hinweis: Das hier gezeigte Antwortobjekt kann zur besseren Lesbarkeit gekürzt werden.
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": [
{
"@odata.type": "#microsoft.graph.hardwareOathAuthenticationMethod",
"id": "aad49556-####-####-####-############",
"device": {
"id": "aad49556-####-####-####-############",
"displayName": "Amy Masters Token 1",
"serialNumber": "TOTP123456",
"manufacturer": "Contoso",
"model": "Hardware Token 1000",
"secretKey": null,
"timeIntervalInSeconds": 30,
"status": "activated",
"hashFunction": "hmacsha1",
"assignedTo": {
"id": "0cadbf92-####-####-####-############",
"displayName": "Amy Masters"
}
}
}
]
}