Catatan
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba masuk atau mengubah direktori.
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba mengubah direktori.
Paket ini berisi SDK isomorfik (berjalan di Node.js dan di browser) untuk klien Azure ComputeSchedule.
API manajemen Penyedia Sumber Daya Microsoft.ComputeSchedule.
Key links:
Getting started
Lingkungan yang didukung saat ini
- Versi LTS dari Node.js
- Versi terbaru Safari, Chrome, Edge, dan Firefox.
See our support policy for more details.
Prerequisites
Pasang paket @azure/arm-computeschedule
Instal pustaka klien Azure ComputeSchedule untuk JavaScript dengan npm:
npm install @azure/arm-computeschedule
Membuat dan mengautentikasi ComputeScheduleClient
Untuk membuat objek klien untuk mengakses Azure ComputeSchedule API, Anda memerlukan endpoint sumber daya Azure ComputeSchedule dan .credential Klien Azure ComputeSchedule dapat menggunakan kredensial Azure Active Directory untuk mengautentikasi.
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
Anda juga perlu mendaftarkan aplikasi AAD baru dan memberikan akses ke Azure ComputeSchedule dengan menetapkan peran yang sesuai ke perwakilan layanan Anda (catatan: peran seperti tidak "Owner" akan memberikan izin yang diperlukan).
For more information about how to create an Azure AD Application check out this guide.
Dengan menggunakan lingkungan Node.js dan seperti Node, Anda dapat menggunakan kelas DefaultAzureCredential untuk mengautentikasi klien.
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);
Untuk lingkungan browser, gunakan InteractiveBrowserCredential dari paket @azure/identity untuk mengautentikasi.
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
Untuk menggunakan pustaka klien ini di browser, pertama-tama Anda perlu menggunakan bunder. For details on how to do this, please refer to our bundling documentation.
Key concepts
ComputeScheduleClient
ComputeScheduleClient adalah antarmuka utama untuk pengembang yang menggunakan pustaka klien Azure ComputeSchedule. Jelajahi metode pada objek klien ini untuk memahami berbagai fitur layanan Azure ComputeSchedule yang dapat Anda akses.
Troubleshooting
Logging
Mengaktifkan pengelogan dapat membantu menemukan informasi yang berguna tentang kegagalan. Untuk melihat log permintaan dan respons HTTP, atur variabel lingkungan AZURE_LOG_LEVEL ke info. Atau, pengelogan dapat diaktifkan saat runtime dengan memanggil setLogLevel di @azure/logger:
import { setLogLevel } from "@azure/logger";
setLogLevel("info");
Untuk instruksi lebih rinci tentang cara mengaktifkan log, Anda dapat melihat dokumen paket @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.
Related projects
Azure SDK for JavaScript