Condividi tramite


Libreria client Azure ComputeSchedule per JavaScript - versione 1.1.0

Questo pacchetto contiene un SDK isomorfico (viene eseguito sia in Node.js che nei browser) per il client Azure ComputeSchedule.

API di gestione del provider di risorse Microsoft.ComputeSchedule.

Key links:

Getting started

Ambienti attualmente supportati

See our support policy for more details.

Prerequisites

Installare il pacchetto @azure/arm-computeschedule

Installare la libreria client Azure ComputeSchedule per JavaScript con npm:

npm install @azure/arm-computeschedule

Creare ed autenticare un ComputeScheduleClient

Per creare un oggetto client per accedere all'API Azure ComputeSchedule, è necessario disporre endpoint della risorsa Azure ComputeSchedule e di un credentialfile . Il client Azure ComputeSchedule può usare le credenziali di Azure Active Directory per l'autenticazione. 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

Sarà anche necessario registrare una nuova applicazione AAD e concedere l'accesso ad Azure ComputeSchedule assegnando il ruolo appropriato all'entità servizio (nota: ruoli come non "Owner" concederanno le autorizzazioni necessarie).

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

Usando Node.js e ambienti simili a Node, è possibile usare la classe DefaultAzureCredential per autenticare il client.

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);

Per gli ambienti del browser, usare il InteractiveBrowserCredential dal pacchetto di @azure/identity per l'autenticazione.

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

Per usare questa libreria client nel browser, è prima necessario usare un bundler. For details on how to do this, please refer to our bundling documentation.

Key concepts

ComputeScheduleClient

ComputeScheduleClient è l'interfaccia principale per gli sviluppatori che usano la libreria client Azure ComputeSchedule. Esplorare i metodi in questo oggetto client per comprendere le diverse funzionalità del servizio Azure ComputeSchedule a cui è possibile accedere.

Troubleshooting

Logging

L'abilitazione della registrazione può aiutare a individuare informazioni utili sugli errori. Per visualizzare un log di richieste e risposte HTTP, impostare la variabile di ambiente AZURE_LOG_LEVEL su info. In alternativa, la registrazione può essere abilitata in fase di esecuzione chiamando setLogLevel nel @azure/logger:

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

setLogLevel("info");

Per istruzioni più dettagliate su come abilitare i log, è possibile esaminare la documentazione del pacchetto @azure/logger.

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.