次の方法で共有


JavaScript 用 Azure StorageManagement クライアント ライブラリ - バージョン 18.6.0

このパッケージには、Azure StorageManagement クライアント用の同型 SDK (Node.js とブラウザーの両方で実行されます) が含まれています。

Azure Storage Management API。

Source code | Package (NPM) | API reference documentation | Samples

Getting started

現在サポートされている環境

See our support policy for more details.

Prerequisites

@azure/arm-storage パッケージをインストールする

npmを使用して JavaScript 用 Azure StorageManagement クライアント ライブラリをインストールします。

npm install @azure/arm-storage

StorageManagementClient を作成して認証する

Azure StorageManagement API にアクセスするクライアント オブジェクトを作成するには、Azure StorageManagement リソースの endpointcredentialが必要です。 Azure StorageManagement クライアントは、Azure Active Directory 資格情報を使用して認証できます。 You can find the endpoint for your Azure StorageManagement 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 StorageManagement へのアクセス 権を付与する必要があります (注: "Owner" などのロールは、必要なアクセス許可を付与しません)。

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

Node.js とノードに似た環境を使用すると、DefaultAzureCredential クラスを使用してクライアントを認証できます。

import { StorageManagementClient } from "@azure/arm-storage";
import { DefaultAzureCredential } from "@azure/identity";

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

ブラウザー環境では、InteractiveBrowserCredential パッケージの @azure/identity を使用して認証します。

import { InteractiveBrowserCredential } from "@azure/identity";
import { StorageManagementClient } from "@azure/arm-storage";

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

JavaScript Bundle

ブラウザーでこのクライアント ライブラリを使用するには、まず、バンドルを使用する必要があります。 For details on how to do this, please refer to our bundling documentation.

Key concepts

StorageManagementClient

StorageManagementClient は、Azure StorageManagement クライアント ライブラリを使用する開発者向けの主要なインターフェイスです。 このクライアント オブジェクトのメソッドを調べて、アクセスできる Azure StorageManagement サービスのさまざまな機能を理解します。

Troubleshooting

Logging

ログ記録を有効にすると、エラーに関する有用な情報を明らかにするのに役立つ場合があります。 HTTP 要求と応答のログを表示するには、 AZURE_LOG_LEVEL 環境変数を info に設定します。 または、setLogLevel@azure/loggerを呼び出すことによって、実行時にログ記録を有効にすることもできます。

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

setLogLevel("info");

ログを有効にする方法の詳細な手順については、 @azure/logger パッケージのドキュメントを参照してください。

Next steps

Please take a look at the samples directory for detailed examples on how to use this library.

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.

  • Microsoft Azure SDK for JavaScript の