このパッケージには、AlertProcessingRulesManagementクライアント用の同型SDKが含まれており(Node.js およびブラウザの両方で動作Azureます。
APIS for Azure alert processing rules CRUD operations.
主要なリンク:
作業の開始
現在サポートされている環境
- Node.js の LTS バージョン
- Safari、Chrome、Edge、Firefox の最新バージョン。
詳細については、 サポート ポリシー を参照してください。
[前提条件]
@azure/arm-alertprocessingrules パッケージをインストールする
JavaScript用のAzure AlertProcessingRulesManagementクライアントライブラリをnpmでインストールしてください:
npm install @azure/arm-alertprocessingrules
AlertProcessingRulesManagementClient を作成して認証する
Azure AlertProcessingRulesManagement API にアクセスするクライアントオブジェクトを作成するには、Azure AlertProcessingRulesManagement リソースの endpoint と credential が必要です。 Azure AlertProcessingRulesManagementクライアントはAzure Active Directoryの認証情報を使用できます。
Azure AlertProcessingRulesManagement リソースのエンドポイントは Azure portal にあります。
以下に示す DefaultAzureCredential プロバイダー、または Azure SDK で提供されているその他の資格情報プロバイダーを使用するには、 @azure/identity パッケージをインストールしてください。
npm install @azure/identity
また、新しいAADアプリケーションを登録し、適切な役割をサービスプリンシパルに割り当てることでAzure AlertProcessingRulesManagementへのアクセスを許可する必要があります(注:"Owner"のような役割は必要な権限を与えません)。
Azure AD アプリケーションを作成する方法の詳細については、このガイド
Node.js とノードに似た環境を使用すると、DefaultAzureCredential クラスを使用してクライアントを認証できます。
import { AlertProcessingRulesManagementClient } from "@azure/arm-alertprocessingrules";
import { DefaultAzureCredential } from "@azure/identity";
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new AlertProcessingRulesManagementClient(
new DefaultAzureCredential(),
subscriptionId,
);
ブラウザー環境では、InteractiveBrowserCredential パッケージの @azure/identity を使用して認証します。
import { InteractiveBrowserCredential } from "@azure/identity";
import { AlertProcessingRulesManagementClient } from "@azure/arm-alertprocessingrules";
const credential = new InteractiveBrowserCredential({
tenantId: "<YOUR_TENANT_ID>",
clientId: "<YOUR_CLIENT_ID>",
});
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new AlertProcessingRulesManagementClient(credential, subscriptionId);
JavaScript バンドル
ブラウザーでこのクライアント ライブラリを使用するには、まず、バンドルを使用する必要があります。 これを行う方法の詳細については、
主な概念
AlertProcessingRulesManagementClient
AlertProcessingRulesManagementClient は、Azure AlertProcessingRulesManagement クライアントライブラリを使用する開発者の主要なインターフェースです。 このクライアントオブジェクトのメソッドを探索し、アクセス可能なAzure AlertProcessingRulesManagementサービスのさまざまな機能を理解してください。
Troubleshooting
ロギング(記録)
ログ記録を有効にすると、エラーに関する有用な情報を明らかにするのに役立つ場合があります。 HTTP 要求と応答のログを表示するには、AZURE_LOG_LEVEL 環境変数を infoに設定します。 または、setLogLevelで @azure/logger を呼び出すことによって、実行時にログを有効にすることもできます。
import { setLogLevel } from "@azure/logger";
setLogLevel("info");
ログを有効にする方法の詳細な手順については、 @azure/logger パッケージのドキュメントを参照してください。
次のステップ
このライブラリの使用方法の詳細な例については、ディレクトリ
Contributing
このライブラリに投稿する場合は、コードをビルドしてテストする方法の詳細については、 投稿ガイド をお読みください。
関連プロジェクト
- Microsoft Azure SDK for JavaScript の
Azure SDK for JavaScript