Compartilhar via


Biblioteca de clientes do Azure ComputeSchedule para JavaScript – versão 1.1.0

Este pacote contém um SDK isomórfico (executado em Node.js e em navegadores) para o cliente Azure ComputeSchedule.

API de gerenciamento do Provedor de Recursos Microsoft.ComputeSchedule.

Key links:

Getting started

Ambientes com suporte no momento

See our support policy for more details.

Prerequisites

Instalar o pacote @azure/arm-computeschedule

Instale a biblioteca de clientes do Azure ComputeSchedule para JavaScript com npm:

npm install @azure/arm-computeschedule

Criar e autenticar um ComputeScheduleClient

Para criar um objeto de cliente para acessar a API do Azure ComputeSchedule, você precisará do endpoint recurso Azure ComputeSchedule e de um credentialarquivo . O cliente do Azure ComputeSchedule pode usar as credenciais do Azure Active Directory para autenticação. You can find the endpoint for your Azure ComputeSchedule resource in the Azure Portal.

You can authenticate with Azure Active Directory using a credential from the @azure/identity library or an existing AAD Token.

To use the DefaultAzureCredential provider shown below, or other credential providers provided with the Azure SDK, please install the @azure/identity package:

npm install @azure/identity

Você também precisará registrar um novo aplicativo AAD e conceder acesso ao Azure ComputeSchedule atribuindo a função adequada à entidade de serviço (observação: funções como não "Owner" concederão as permissões necessárias).

For more information about how to create an Azure AD Application check out this guide.

Usando ambientes semelhantes a Node.js e nó, você pode usar a classe DefaultAzureCredential para autenticar o cliente.

import { ComputeScheduleClient } from "@azure/arm-computeschedule";
import { DefaultAzureCredential } from "@azure/identity";

const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ComputeScheduleClient(new DefaultAzureCredential(), subscriptionId);

Para ambientes de navegador, use o InteractiveBrowserCredential do pacote @azure/identity para autenticar.

import { InteractiveBrowserCredential } from "@azure/identity";
import { ComputeScheduleClient } from "@azure/arm-computeschedule";

const subscriptionId = "00000000-0000-0000-0000-000000000000";
const credential = new InteractiveBrowserCredential({
  tenantId: "<YOUR_TENANT_ID>",
  clientId: "<YOUR_CLIENT_ID>",
});
const client = new ComputeScheduleClient(credential, subscriptionId);

JavaScript Bundle

Para usar essa biblioteca de clientes no navegador, primeiro você precisa usar um empacotador. For details on how to do this, please refer to our bundling documentation.

Key concepts

ComputeScheduleClient

ComputeScheduleClient é a interface principal para desenvolvedores que usam a biblioteca de clientes do Azure ComputeSchedule. Explore os métodos nesse objeto de cliente para entender os diferentes recursos do serviço Azure ComputeSchedule que você pode acessar.

Troubleshooting

Logging

Habilitar o registro em log pode ajudar a descobrir informações úteis sobre falhas. Para ver um log de solicitações e respostas HTTP, defina a variável de ambiente AZURE_LOG_LEVEL como info. Como alternativa, o registro em log pode ser habilitado em runtime chamando setLogLevel no @azure/logger:

import { setLogLevel } from "@azure/logger";

setLogLevel("info");

Para obter instruções mais detalhadas sobre como habilitar logs, você pode examinar os documentos do pacote @azure/agente.

Contributing

If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code.

  • do SDK do Microsoft Azure para JavaScript