이 패키지에는 Azure ManagedServiceIdentity 클라이언트에 대한 동형 SDK(Node.js 및 브라우저 모두에서 실행됨)가 포함되어 있습니다.
관리 서비스 ID 클라이언트입니다.
Source code | Package (NPM) | API reference documentation | Samples
Getting started
현재 지원되는 환경
- Node.js의 LTS 버전
- Safari, Chrome, Edge 및 Firefox의 최신 버전입니다.
See our support policy for more details.
Prerequisites
@azure/arm-msi 패키지 설치
다음을 사용하여 npmJavaScript용 Azure ManagedServiceIdentity 클라이언트 라이브러리를 설치합니다.
npm install @azure/arm-msi
ManagedServiceIdentityClient를 만들고 인증하기
Azure ManagedServiceIdentity API에 액세스하기 위한 클라이언트 개체를 만들려면 Azure ManagedServiceIdentity 리소스credential의 와 endpoint . Azure ManagedServiceIdentity 클라이언트는 Azure Active Directory 자격 증명을 사용하여 인증할 수 있습니다.
You can find the endpoint for your Azure ManagedServiceIdentity 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 ManagedServiceIdentity에 대한 액세스 권한을 부여 해야 합니다(참고: 다음과 "Owner" 같은 역할은 필요한 권한을 부여하지 않음).
For more information about how to create an Azure AD Application check out this guide.
Node.js 및 노드와 유사한 환경을 사용하여 DefaultAzureCredential 클래스를 사용하여 클라이언트를 인증할 수 있습니다.
import { ManagedServiceIdentityClient } from "@azure/arm-msi";
import { DefaultAzureCredential } from "@azure/identity";
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ManagedServiceIdentityClient(new DefaultAzureCredential(), subscriptionId);
브라우저 환경의 경우 InteractiveBrowserCredential 패키지의 @azure/identity 사용하여 인증합니다.
import { InteractiveBrowserCredential } from "@azure/identity";
import { ManagedServiceIdentityClient } from "@azure/arm-msi";
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const credential = new InteractiveBrowserCredential({
tenantId: "<YOUR_TENANT_ID>",
clientId: "<YOUR_CLIENT_ID>",
});
const client = new ManagedServiceIdentityClient(credential, subscriptionId);
JavaScript Bundle
브라우저에서 이 클라이언트 라이브러리를 사용하려면 먼저 번들러를 사용해야 합니다. For details on how to do this, please refer to our bundling documentation.
Key concepts
ManagedServiceIdentityClient
ManagedServiceIdentityClient Azure ManagedServiceIdentity 클라이언트 라이브러리를 사용하는 개발자를 위한 기본 인터페이스입니다. 이 클라이언트 개체의 메서드를 탐색하여 액세스할 수 있는 Azure ManagedServiceIdentity 서비스의 다양한 기능을 이해합니다.
Troubleshooting
Logging
로깅을 사용하도록 설정하면 장애에 대한 유용한 정보를 얻는 데 도움이 될 수 있습니다. HTTP 요청 및 응답 로그를 보려면 AZURE_LOG_LEVEL 환경 변수를 info로 설정합니다. 또는 setLogLevel에서 @azure/logger을 호출하여 런타임에 로깅을 사용하도록 설정할 수 있습니다.
import { setLogLevel } from "@azure/logger";
setLogLevel("info");
로그를 사용하는 방법에 대한 자세한 내용은 @azure/logger package docs를 참조하세요.
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.
Related projects
- JavaScript용 Microsoft Azure SDK
Azure SDK for JavaScript