このパッケージには、Azure ComputeSchedule クライアント用の同型 SDK (Node.js とブラウザーの両方で実行) が含まれています。
Microsoft.ComputeSchedule リソース プロバイダー管理 API。
Key links:
Getting started
現在サポートされている環境
- Node.js の LTS バージョン
- Safari、Chrome、Edge、Firefox の最新バージョン。
See our support policy for more details.
Prerequisites
@azure/arm-computeschedule
パッケージをインストールする
JavaScript 用の Azure ComputeSchedule クライアント ライブラリを npm
でインストールします。
npm install @azure/arm-computeschedule
ComputeScheduleClient
を作成して認証する
Azure ComputeSchedule API にアクセスするためのクライアント オブジェクトを作成するには、Azure ComputeSchedule リソースの endpoint
と credential
が必要です。 Azure ComputeSchedule クライアントは、Azure Active Directory 資格情報を使用して認証できます。
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
また 、新しい AAD アプリケーションを登録し、 サービス プリンシパルに適切なロールを割り当てて Azure ComputeSchedule へのアクセス権を付与する必要もあります (注: "Owner"
などのロールでは必要なアクセス許可は付与されません)。
For more information about how to create an Azure AD Application check out this guide.
Node.js とノードに似た環境を使用すると、DefaultAzureCredential
クラスを使用してクライアントを認証できます。
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);
ブラウザー環境では、InteractiveBrowserCredential
パッケージの @azure/identity
を使用して認証します。
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
ブラウザーでこのクライアント ライブラリを使用するには、まず、バンドルを使用する必要があります。 For details on how to do this, please refer to our bundling documentation.
Key concepts
ComputeScheduleClient
ComputeScheduleClient
は、Azure ComputeSchedule クライアント ライブラリを使用する開発者向けの主要なインターフェイスです。 このクライアント オブジェクトのメソッドを調べて、アクセスできる Azure ComputeSchedule サービスのさまざまな機能を理解してください。
Troubleshooting
Logging
ログ記録を有効にすると、エラーに関する有用な情報を明らかにするのに役立つ場合があります。 HTTP 要求と応答のログを表示するには、AZURE_LOG_LEVEL
環境変数を info
に設定します。 または、setLogLevel
で @azure/logger
を呼び出すことによって、実行時にログを有効にすることもできます。
import { setLogLevel } from "@azure/logger";
setLogLevel("info");
ログを有効にする方法の詳細な手順については、@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
- Microsoft Azure SDK for JavaScript の
Azure SDK for JavaScript