Namespace: microsoft.graph
Importante
As APIs na versão /beta no Microsoft Graph estão sujeitas a alterações. Não há suporte para o uso dessas APIs em aplicativos de produção. Para determinar se uma API está disponível na v1.0, use o seletor Versão.
Atualize as propriedades de um objeto hardwareOathTokenAuthenticationMethodDevice . O token tem de ser não atribuído.
Esta API está disponível nas seguintes implementações de cloud nacionais.
| Serviço global |
US Government L4 |
US Government L5 (DOD) |
China operada pela 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Permissões
Escolha a permissão ou permissões marcadas como menos privilegiadas para esta API. Utilize uma permissão ou permissões com privilégios mais elevados apenas se a sua aplicação o exigir. Para obter detalhes sobre as permissões delegadas e de aplicação, veja Tipos de permissão. Para saber mais sobre estas permissões, veja a referência de permissões.
| Tipo de permissão |
Permissões com menos privilégios |
Permissões com privilégios superiores |
| Delegada (conta corporativa ou de estudante) |
Policy.ReadWrite.AuthenticationMethod |
Indisponível. |
| Delegado (conta pessoal da Microsoft) |
Sem suporte. |
Sem suporte. |
| Aplicativo |
Policy.ReadWrite.AuthenticationMethod |
Indisponível. |
Importante
Em cenários delegados com contas escolares ou profissionais, o utilizador com sessão iniciada tem de ter uma função de Microsoft Entra suportada ou uma função personalizada com uma permissão de função suportada.
O Administrador de Políticas de Autenticação é a função com menos privilégios suportada para esta operação.
Solicitação HTTP
PATCH /directory/authenticationMethodDevices/hardwareOathDevices/{hardwareOathTokenAuthenticationMethodDeviceId}
| Nome |
Descrição |
| Autorização |
{token} de portador. Obrigatório. Saiba mais sobre autenticação e autorização. |
| Content-Type |
application/json. Obrigatório. |
Corpo da solicitação
No corpo do pedido, forneça apenas os valores das propriedades a atualizar. As propriedades existentes que não estão incluídas no corpo do pedido mantêm os valores anteriores ou são recalculadas com base em alterações a outros valores de propriedade.
A tabela a seguir especifica as propriedades que podem ser atualizadas.
| Propriedade |
Tipo |
Descrição |
| fabricante |
Cadeia de caracteres |
Nome do fabricante do token de hardware. Opcional. |
| modelo |
Cadeia de caracteres |
Nome do modelo do token de hardware. Opcional. |
| timeIntervalInSeconds |
Int32 |
Intervalo de atualização do código de verificação de 6 dígitos, em segundos. Os valores possíveis são: 30 ou 60. Opcional. |
| hashFunction |
hardwareOathTokenHashFunction |
Função hash do token hardrware. Os valores possíveis são: hmacsha1 ou hmacsha256. O valor predefinido é: hmacsha1. Opcional. |
| displayName |
Cadeia de caracteres |
Nome que pode ser fornecido ao token OATH de Hardware. Opcional. |
Resposta
Se tiver êxito, este método retornará um código de resposta 204 No Content.
Exemplos
Solicitação
O exemplo a seguir mostra uma solicitação.
PATCH https://graph.microsoft.com/beta/directory/authenticationMethodDevices/hardwareOathDevices/{hardwareOathTokenAuthenticationMethodDeviceId}
Content-Type: application/json
{
"hashFunction": "hmacsha256"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new HardwareOathTokenAuthenticationMethodDevice
{
HashFunction = HardwareOathTokenHashFunction.Hmacsha256,
};
// 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["{hardwareOathTokenAuthenticationMethodDevice-id}"].PatchAsync(requestBody);
// 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.NewHardwareOathTokenAuthenticationMethodDevice()
hashFunction := graphmodels.HMACSHA256_HARDWAREOATHTOKENHASHFUNCTION
requestBody.SetHashFunction(&hashFunction)
// 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().ByHardwareOathTokenAuthenticationMethodDeviceId("hardwareOathTokenAuthenticationMethodDevice-id").Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
HardwareOathTokenAuthenticationMethodDevice hardwareOathTokenAuthenticationMethodDevice = new HardwareOathTokenAuthenticationMethodDevice();
hardwareOathTokenAuthenticationMethodDevice.setHashFunction(HardwareOathTokenHashFunction.Hmacsha256);
HardwareOathTokenAuthenticationMethodDevice result = graphClient.directory().authenticationMethodDevices().hardwareOathDevices().byHardwareOathTokenAuthenticationMethodDeviceId("{hardwareOathTokenAuthenticationMethodDevice-id}").patch(hardwareOathTokenAuthenticationMethodDevice);
const options = {
authProvider,
};
const client = Client.init(options);
const hardwareOathTokenAuthenticationMethodDevice = {
hashFunction: 'hmacsha256'
};
await client.api('/directory/authenticationMethodDevices/hardwareOathDevices/{hardwareOathTokenAuthenticationMethodDeviceId}')
.version('beta')
.update(hardwareOathTokenAuthenticationMethodDevice);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\HardwareOathTokenAuthenticationMethodDevice;
use Microsoft\Graph\Beta\Generated\Models\HardwareOathTokenHashFunction;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new HardwareOathTokenAuthenticationMethodDevice();
$requestBody->setHashFunction(new HardwareOathTokenHashFunction('hmacsha256'));
$result = $graphServiceClient->directory()->authenticationMethodDevices()->hardwareOathDevices()->byHardwareOathTokenAuthenticationMethodDeviceId('hardwareOathTokenAuthenticationMethodDevice-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.DirectoryManagement
$params = @{
hashFunction = "hmacsha256"
}
Update-MgBetaDirectoryAuthenticationMethodDeviceHardwareOathDevice -HardwareOathTokenAuthenticationMethodDeviceId $hardwareOathTokenAuthenticationMethodDeviceId -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_token_authentication_method_device import HardwareOathTokenAuthenticationMethodDevice
from msgraph_beta.generated.models.hardware_oath_token_hash_function import HardwareOathTokenHashFunction
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = HardwareOathTokenAuthenticationMethodDevice(
hash_function = HardwareOathTokenHashFunction.Hmacsha256,
)
result = await graph_client.directory.authentication_method_devices.hardware_oath_devices.by_hardware_oath_token_authentication_method_device_id('hardwareOathTokenAuthenticationMethodDevice-id').patch(request_body)
Resposta
O exemplo a seguir mostra a resposta.
HTTP/1.1 204 No Content